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
Subject: Re: [PATCH v2 2/2] xfs: clean up attr intent recovery error paths
Date: Tue, 9 Jun 2026 22:12:44 -0700 [thread overview]
Message-ID: <20260610051244.GG6078@frogsfrogsfrogs> (raw)
In-Reply-To: <20260610022028.79846-3-gaoyingjie@uniontech.com>
On Wed, Jun 10, 2026 at 10:20:28AM +0800, Yingjie Gao wrote:
> xfs_attr_recover_work() still uses a backward goto from out_cancel to
> out_unlock.
What's so bad about backwards gotos?
--D
> Restructure the cleanup labels into the same linear fallthrough style
> used by the neighboring bmap and exchmaps recovery helpers. Initialize
> the local error variable to zero as those helpers do as well, which
> makes the shared return path easier to follow.
>
> No functional change intended.
>
> Signed-off-by: Yingjie Gao <gaoyingjie@uniontech.com>
> ---
> fs/xfs/xfs_attr_item.c | 14 ++++++++++----
> 1 file changed, 10 insertions(+), 4 deletions(-)
>
> diff --git a/fs/xfs/xfs_attr_item.c b/fs/xfs/xfs_attr_item.c
> index 841838bc1d0f..f8aa9dd80bb9 100644
> --- a/fs/xfs/xfs_attr_item.c
> +++ b/fs/xfs/xfs_attr_item.c
> @@ -739,7 +739,7 @@ xfs_attr_recover_work(
> struct xfs_trans_res resv;
> struct xfs_attri_log_format *attrp;
> struct xfs_attri_log_nameval *nv = attrip->attri_nameval;
> - int error;
> + int error = 0;
> unsigned int total = 0;
>
> /*
> @@ -789,14 +789,20 @@ xfs_attr_recover_work(
> goto out_cancel;
>
> error = xfs_defer_ops_capture_and_commit(tp, capture_list);
> + if (error)
> + goto out_unlock;
> +
> + xfs_iunlock(ip, XFS_ILOCK_EXCL);
> + xfs_irele(ip);
> + return 0;
> +
> +out_cancel:
> + xfs_trans_cancel(tp);
> out_unlock:
> xfs_iunlock(ip, XFS_ILOCK_EXCL);
> out_rele:
> xfs_irele(ip);
> return error;
> -out_cancel:
> - xfs_trans_cancel(tp);
> - goto out_unlock;
> }
>
> /* Re-log an intent item to push the log tail forward. */
> --
> 2.20.1
>
>
next prev parent reply other threads:[~2026-06-10 5:12 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
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 [this message]
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=20260610051244.GG6078@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 \
/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