From: <gregkh@linuxfoundation.org>
To: amir73il@gmail.com,catherine.hoang@oracle.com,chandan.babu@oracle.com,chandanbabu@kernel.org,djwong@kernel.org,gregkh@linuxfoundation.org,leah.rumancik@gmail.com,leo.lilong@huawei.com,xfs-stable@lists.linux.dev
Cc: <stable-commits@vger.kernel.org>
Subject: Patch "xfs: abort intent items when recovery intents fail" has been added to the 6.1-stable tree
Date: Thu, 30 Jan 2025 09:40:58 +0100 [thread overview]
Message-ID: <2025013058-proximity-passage-83c5@gregkh> (raw)
In-Reply-To: <20250129184717.80816-12-leah.rumancik@gmail.com>
This is a note to let you know that I've just added the patch titled
xfs: abort intent items when recovery intents fail
to the 6.1-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
xfs-abort-intent-items-when-recovery-intents-fail.patch
and it can be found in the queue-6.1 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
From stable+bounces-111222-greg=kroah.com@vger.kernel.org Wed Jan 29 19:47:57 2025
From: Leah Rumancik <leah.rumancik@gmail.com>
Date: Wed, 29 Jan 2025 10:47:09 -0800
Subject: xfs: abort intent items when recovery intents fail
To: stable@vger.kernel.org
Cc: xfs-stable@lists.linux.dev, amir73il@gmail.com, chandan.babu@oracle.com, catherine.hoang@oracle.com, Long Li <leo.lilong@huawei.com>, "Darrick J. Wong" <djwong@kernel.org>, Chandan Babu R <chandanbabu@kernel.org>, Leah Rumancik <leah.rumancik@gmail.com>
Message-ID: <20250129184717.80816-12-leah.rumancik@gmail.com>
From: Long Li <leo.lilong@huawei.com>
[ Upstream commit f8f9d952e42dd49ae534f61f2fa7ca0876cb9848 ]
When recovering intents, we capture newly created intent items as part of
committing recovered intent items. If intent recovery fails at a later
point, we forget to remove those newly created intent items from the AIL
and hang:
[root@localhost ~]# cat /proc/539/stack
[<0>] xfs_ail_push_all_sync+0x174/0x230
[<0>] xfs_unmount_flush_inodes+0x8d/0xd0
[<0>] xfs_mountfs+0x15f7/0x1e70
[<0>] xfs_fs_fill_super+0x10ec/0x1b20
[<0>] get_tree_bdev+0x3c8/0x730
[<0>] vfs_get_tree+0x89/0x2c0
[<0>] path_mount+0xecf/0x1800
[<0>] do_mount+0xf3/0x110
[<0>] __x64_sys_mount+0x154/0x1f0
[<0>] do_syscall_64+0x39/0x80
[<0>] entry_SYSCALL_64_after_hwframe+0x63/0xcd
When newly created intent items fail to commit via transaction, intent
recovery hasn't created done items for these newly created intent items,
so the capture structure is the sole owner of the captured intent items.
We must release them explicitly or else they leak:
unreferenced object 0xffff888016719108 (size 432):
comm "mount", pid 529, jiffies 4294706839 (age 144.463s)
hex dump (first 32 bytes):
08 91 71 16 80 88 ff ff 08 91 71 16 80 88 ff ff ..q.......q.....
18 91 71 16 80 88 ff ff 18 91 71 16 80 88 ff ff ..q.......q.....
backtrace:
[<ffffffff8230c68f>] xfs_efi_init+0x18f/0x1d0
[<ffffffff8230c720>] xfs_extent_free_create_intent+0x50/0x150
[<ffffffff821b671a>] xfs_defer_create_intents+0x16a/0x340
[<ffffffff821bac3e>] xfs_defer_ops_capture_and_commit+0x8e/0xad0
[<ffffffff82322bb9>] xfs_cui_item_recover+0x819/0x980
[<ffffffff823289b6>] xlog_recover_process_intents+0x246/0xb70
[<ffffffff8233249a>] xlog_recover_finish+0x8a/0x9a0
[<ffffffff822eeafb>] xfs_log_mount_finish+0x2bb/0x4a0
[<ffffffff822c0f4f>] xfs_mountfs+0x14bf/0x1e70
[<ffffffff822d1f80>] xfs_fs_fill_super+0x10d0/0x1b20
[<ffffffff81a21fa2>] get_tree_bdev+0x3d2/0x6d0
[<ffffffff81a1ee09>] vfs_get_tree+0x89/0x2c0
[<ffffffff81a9f35f>] path_mount+0xecf/0x1800
[<ffffffff81a9fd83>] do_mount+0xf3/0x110
[<ffffffff81aa00e4>] __x64_sys_mount+0x154/0x1f0
[<ffffffff83968739>] do_syscall_64+0x39/0x80
Fix the problem above by abort intent items that don't have a done item
when recovery intents fail.
Fixes: e6fff81e4870 ("xfs: proper replay of deferred ops queued during log recovery")
Signed-off-by: Long Li <leo.lilong@huawei.com>
Reviewed-by: Darrick J. Wong <djwong@kernel.org>
Signed-off-by: Chandan Babu R <chandanbabu@kernel.org>
Signed-off-by: Leah Rumancik <leah.rumancik@gmail.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
fs/xfs/libxfs/xfs_defer.c | 5 +++--
fs/xfs/libxfs/xfs_defer.h | 2 +-
fs/xfs/xfs_log_recover.c | 2 +-
3 files changed, 5 insertions(+), 4 deletions(-)
--- a/fs/xfs/libxfs/xfs_defer.c
+++ b/fs/xfs/libxfs/xfs_defer.c
@@ -761,12 +761,13 @@ xfs_defer_ops_capture(
/* Release all resources that we used to capture deferred ops. */
void
-xfs_defer_ops_capture_free(
+xfs_defer_ops_capture_abort(
struct xfs_mount *mp,
struct xfs_defer_capture *dfc)
{
unsigned short i;
+ xfs_defer_pending_abort(mp, &dfc->dfc_dfops);
xfs_defer_cancel_list(mp, &dfc->dfc_dfops);
for (i = 0; i < dfc->dfc_held.dr_bufs; i++)
@@ -807,7 +808,7 @@ xfs_defer_ops_capture_and_commit(
/* Commit the transaction and add the capture structure to the list. */
error = xfs_trans_commit(tp);
if (error) {
- xfs_defer_ops_capture_free(mp, dfc);
+ xfs_defer_ops_capture_abort(mp, dfc);
return error;
}
--- a/fs/xfs/libxfs/xfs_defer.h
+++ b/fs/xfs/libxfs/xfs_defer.h
@@ -121,7 +121,7 @@ int xfs_defer_ops_capture_and_commit(str
struct list_head *capture_list);
void xfs_defer_ops_continue(struct xfs_defer_capture *d, struct xfs_trans *tp,
struct xfs_defer_resources *dres);
-void xfs_defer_ops_capture_free(struct xfs_mount *mp,
+void xfs_defer_ops_capture_abort(struct xfs_mount *mp,
struct xfs_defer_capture *d);
void xfs_defer_resources_rele(struct xfs_defer_resources *dres);
--- a/fs/xfs/xfs_log_recover.c
+++ b/fs/xfs/xfs_log_recover.c
@@ -2514,7 +2514,7 @@ xlog_abort_defer_ops(
list_for_each_entry_safe(dfc, next, capture_list, dfc_list) {
list_del_init(&dfc->dfc_list);
- xfs_defer_ops_capture_free(mp, dfc);
+ xfs_defer_ops_capture_abort(mp, dfc);
}
}
Patches currently in stable-queue which might be from leah.rumancik@gmail.com are
queue-6.1/xfs-allow-read-io-and-ficlone-to-run-concurrently.patch
queue-6.1/xfs-hoist-freeing-of-rt-data-fork-extent-mappings.patch
queue-6.1/xfs-make-sure-maxlen-is-still-congruent-with-prod-when-rounding-down.patch
queue-6.1/xfs-only-remap-the-written-blocks-in-xfs_reflink_end_cow_extent.patch
queue-6.1/xfs-dquot-recovery-does-not-validate-the-recovered-dquot.patch
queue-6.1/xfs-clean-up-dqblk-extraction.patch
queue-6.1/xfs-abort-intent-items-when-recovery-intents-fail.patch
queue-6.1/xfs-up-ic_sema-if-flushing-data-device-fails.patch
queue-6.1/xfs-fix-internal-error-from-agfl-exhaustion.patch
queue-6.1/xfs-factor-out-xfs_defer_pending_abort.patch
queue-6.1/xfs-fix-units-conversion-error-in-xfs_bmap_del_extent_delay.patch
queue-6.1/xfs-bump-max-fsgeom-struct-version.patch
queue-6.1/xfs-handle-nimaps-0-from-xfs_bmapi_write-in-xfs_alloc_file_space.patch
queue-6.1/xfs-rt-stubs-should-return-negative-errnos-when-rt-disabled.patch
queue-6.1/xfs-clean-up-fs_xflag_realtime-handling-in-xfs_ioctl_setattr_xflags.patch
queue-6.1/xfs-respect-the-stable-writes-flag-on-the-rt-device.patch
queue-6.1/xfs-introduce-protection-for-drop-nlink.patch
queue-6.1/xfs-prevent-rt-growfs-when-quota-is-enabled.patch
queue-6.1/xfs-inode-recovery-does-not-validate-the-recovered-inode.patch
next prev parent reply other threads:[~2025-01-30 8:41 UTC|newest]
Thread overview: 40+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-29 18:46 [PATCH 6.1 00/19] xfs 6.1.y fixes from 6.7 Leah Rumancik
2025-01-29 18:46 ` [PATCH 6.1 01/19] xfs: bump max fsgeom struct version Leah Rumancik
2025-01-30 8:40 ` Patch "xfs: bump max fsgeom struct version" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 02/19] xfs: hoist freeing of rt data fork extent mappings Leah Rumancik
2025-01-30 8:41 ` Patch "xfs: hoist freeing of rt data fork extent mappings" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 03/19] xfs: prevent rt growfs when quota is enabled Leah Rumancik
2025-01-30 8:41 ` Patch "xfs: prevent rt growfs when quota is enabled" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 04/19] xfs: rt stubs should return negative errnos when rt disabled Leah Rumancik
2025-01-30 8:41 ` Patch "xfs: rt stubs should return negative errnos when rt disabled" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 05/19] xfs: fix units conversion error in xfs_bmap_del_extent_delay Leah Rumancik
2025-01-30 8:41 ` Patch "xfs: fix units conversion error in xfs_bmap_del_extent_delay" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 06/19] xfs: make sure maxlen is still congruent with prod when rounding down Leah Rumancik
2025-01-30 8:41 ` Patch "xfs: make sure maxlen is still congruent with prod when rounding down" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 07/19] xfs: introduce protection for drop nlink Leah Rumancik
2025-01-30 8:41 ` Patch "xfs: introduce protection for drop nlink" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 08/19] xfs: handle nimaps=0 from xfs_bmapi_write in xfs_alloc_file_space Leah Rumancik
2025-01-30 8:41 ` Patch "xfs: handle nimaps=0 from xfs_bmapi_write in xfs_alloc_file_space" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 09/19] xfs: allow read IO and FICLONE to run concurrently Leah Rumancik
2025-01-30 8:40 ` Patch "xfs: allow read IO and FICLONE to run concurrently" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 10/19] xfs: factor out xfs_defer_pending_abort Leah Rumancik
2025-01-30 8:40 ` Patch "xfs: factor out xfs_defer_pending_abort" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 11/19] xfs: abort intent items when recovery intents fail Leah Rumancik
2025-01-30 8:40 ` gregkh [this message]
2025-01-29 18:47 ` [PATCH 6.1 12/19] xfs: only remap the written blocks in xfs_reflink_end_cow_extent Leah Rumancik
2025-01-30 8:41 ` Patch "xfs: only remap the written blocks in xfs_reflink_end_cow_extent" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 13/19] xfs: up(ic_sema) if flushing data device fails Leah Rumancik
2025-01-30 8:41 ` Patch "xfs: up(ic_sema) if flushing data device fails" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 14/19] xfs: fix internal error from AGFL exhaustion Leah Rumancik
2025-01-30 8:40 ` Patch "xfs: fix internal error from AGFL exhaustion" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 15/19] xfs: inode recovery does not validate the recovered inode Leah Rumancik
2025-01-30 8:41 ` Patch "xfs: inode recovery does not validate the recovered inode" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 16/19] xfs: clean up dqblk extraction Leah Rumancik
2025-01-30 8:40 ` Patch "xfs: clean up dqblk extraction" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 17/19] xfs: dquot recovery does not validate the recovered dquot Leah Rumancik
2025-01-30 8:40 ` Patch "xfs: dquot recovery does not validate the recovered dquot" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 18/19] xfs: clean up FS_XFLAG_REALTIME handling in xfs_ioctl_setattr_xflags Leah Rumancik
2025-01-30 8:40 ` Patch "xfs: clean up FS_XFLAG_REALTIME handling in xfs_ioctl_setattr_xflags" has been added to the 6.1-stable tree gregkh
2025-01-29 18:47 ` [PATCH 6.1 19/19] xfs: respect the stable writes flag on the RT device Leah Rumancik
2025-01-30 8:41 ` Patch "xfs: respect the stable writes flag on the RT device" has been added to the 6.1-stable tree gregkh
2025-01-30 8:41 ` [PATCH 6.1 00/19] xfs 6.1.y fixes from 6.7 Greg KH
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=2025013058-proximity-passage-83c5@gregkh \
--to=gregkh@linuxfoundation.org \
--cc=amir73il@gmail.com \
--cc=catherine.hoang@oracle.com \
--cc=chandan.babu@oracle.com \
--cc=chandanbabu@kernel.org \
--cc=djwong@kernel.org \
--cc=leah.rumancik@gmail.com \
--cc=leo.lilong@huawei.com \
--cc=stable-commits@vger.kernel.org \
--cc=xfs-stable@lists.linux.dev \
/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