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>
Subject: [PATCH v2 2/2] xfs: clean up attr intent recovery error paths
Date: Wed, 10 Jun 2026 10:20:28 +0800 [thread overview]
Message-ID: <20260610022028.79846-3-gaoyingjie@uniontech.com> (raw)
In-Reply-To: <20260610022028.79846-1-gaoyingjie@uniontech.com>
xfs_attr_recover_work() still uses a backward goto from out_cancel to
out_unlock.
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 2:22 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 ` Yingjie Gao [this message]
2026-06-10 5:12 ` [PATCH v2 2/2] xfs: clean up attr intent recovery error paths 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-3-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 \
/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®