From: "Darrick J. Wong" <djwong@kernel.org>
To: Yingjie Gao <gaoyingjie@uniontech.com>
Cc: linux-xfs@vger.kernel.org, cem@kernel.org,
linux-kernel@vger.kernel.org, stable@vger.kernel.org
Subject: Re: [PATCH v2 1/2] xfs: fix inode ref leak in attr intent recovery
Date: Tue, 9 Jun 2026 22:00:32 -0700 [thread overview]
Message-ID: <20260610050032.GD6078@frogsfrogsfrogs> (raw)
In-Reply-To: <20260610022028.79846-2-gaoyingjie@uniontech.com>
On Wed, Jun 10, 2026 at 10:20:27AM +0800, Yingjie Gao wrote:
> 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>
Looks good,
Reviewed-by: "Darrick J. Wong" <djwong@kernel.org>
--D
> ---
> 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 5:00 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 attr intent recovery 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 ` [PATCH v2 1/2] xfs: fix inode ref leak in " Yingjie Gao
2026-06-10 5:00 ` Darrick J. Wong [this message]
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=20260610050032.GD6078@frogsfrogsfrogs \
--to=djwong@kernel.org \
--cc=cem@kernel.org \
--cc=gaoyingjie@uniontech.com \
--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