From: Yingjie Gao <gaoyingjie@uniontech.com>
To: linux-xfs@vger.kernel.org
Cc: cem@kernel.org, djwong@kernel.org, linux-kernel@vger.kernel.org,
Yingjie Gao <gaoyingjie@uniontech.com>,
stable@vger.kernel.org
Subject: [PATCH v2 1/2] xfs: fix inode ref leak in attr intent recovery
Date: Wed, 10 Jun 2026 10:20:27 +0800 [thread overview]
Message-ID: <20260610022028.79846-2-gaoyingjie@uniontech.com> (raw)
In-Reply-To: <20260610022028.79846-1-gaoyingjie@uniontech.com>
xfs_attri_recover_work() grabs the target inode, attaches it to the
reconstructed attr work item, and adds that work item to the defer
pending list.
If xfs_attr_recover_work() fails to allocate the recovery transaction,
it returns immediately without dropping the inode reference. The later
cancel path only frees the attr work item state, so the inode reference
leaks.
Send the failure through the existing cleanup path so the inode
reference is dropped before the function returns the error.
Fixes: e70fb328d527 ("xfs: recreate work items when recovering intent items")
Cc: <stable@vger.kernel.org> # v6.8
Signed-off-by: Yingjie Gao <gaoyingjie@uniontech.com>
---
fs/xfs/xfs_attr_item.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)
diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
index deab14f31b38..841838bc1d0f 100644
--- a/fs/xfs/xfs_attr_item.c
+++ b/fs/xfs/xfs_attr_item.c
@@ -774,7 +774,7 @@ xfs_attr_recover_work(
resv = xlog_recover_resv(&resv);
error = xfs_trans_alloc(mp, &resv, total, 0, XFS_TRANS_RESERVE, &tp);
if (error)
- return error;
+ goto out_rele;
args->trans = tp;
xfs_ilock(ip, XFS_ILOCK_EXCL);
@@ -791,6 +791,7 @@ xfs_attr_recover_work(
error = xfs_defer_ops_capture_and_commit(tp, capture_list);
out_unlock:
xfs_iunlock(ip, XFS_ILOCK_EXCL);
+out_rele:
xfs_irele(ip);
return error;
out_cancel:
--
2.20.1
next prev parent reply other threads:[~2026-06-10 2:21 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-06-09 11:16 [PATCH 0/2] xfs: fix inode leak and clean up " Yingjie Gao
2026-06-09 11:16 ` [PATCH 1/2] xfs: fix inode ref leak in " Yingjie Gao
2026-06-09 14:57 ` Darrick J. Wong
2026-06-10 1:54 ` Yingjie Gao
2026-06-09 11:16 ` [PATCH 2/2] xfs: clean up attr intent recovery error paths Yingjie Gao
2026-06-10 2:20 ` [PATCH v2 0/2] xfs: fix inode leak and clean up attr intent recovery Yingjie Gao
2026-06-10 2:20 ` Yingjie Gao [this message]
2026-06-10 5:00 ` [PATCH v2 1/2] xfs: fix inode ref leak in " Darrick J. Wong
2026-06-10 2:20 ` [PATCH v2 2/2] xfs: clean up attr intent recovery error paths Yingjie Gao
2026-06-10 5:12 ` Darrick J. Wong
2026-06-10 5:38 ` Yingjie Gao
2026-06-10 6:30 ` [PATCH v2 0/2] xfs: fix inode leak and clean up attr intent recovery Carlos Maiolino
2026-06-10 6:52 ` Yingjie Gao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20260610022028.79846-2-gaoyingjie@uniontech.com \
--to=gaoyingjie@uniontech.com \
--cc=cem@kernel.org \
--cc=djwong@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-xfs@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®