FAILED: patch "[PATCH] xfs: don't let memory failures leak blocks and kill repairs" failed to apply to 6.12-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.12-stable tree.
If someone wants it applied there, or to any other stable or longterm tree, then please email the backport, including the original git commit id to <[email protected]>.
To reproduce the conflict and resubmit, you may use the following commands:
git fetch https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git/ linux-6.12.y
git checkout FETCH_HEAD
git cherry-pick -x ab1c416d2377cdc16123ef521aac4da1c468c3d4
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026092928-handstand-epidermal-33bb@gregkh' --subject-prefix 'PATCH 6.12.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From ab1c416d2377cdc16123ef521aac4da1c468c3d4 Mon Sep 17 00:00:00 2001
From: "Darrick J. Wong" <[email protected]>
Date: Mon, 14 Sep 2026 22:37:52 -0700
Subject: [PATCH] xfs: don't let memory failures leak blocks and kill repairs
LOLLM complains that a memory allocation failure in xrep_newbt_add_blocks results in online repair leaking blocks that were previously allocated to write a new btree, but the problem is worse than that -- a limitation of the codebase is that the callers cannot undo the transaction /and/ return the error -- either you undo all changes and commit the transaction, or you error out and the filesystem goes down.
However, the new btree space reservation object isn't that big (~48 bytes). Let's just do a NOFAIL allocation and the problem goes away.
fs/xfs/scrub/newbt.c +5 -3
@@ -193,9 +193,11 @@ xrep_newbt_add_blocks(struct xrep_newbt_resv *resv;int error; - resv = kmalloc_obj(struct xrep_newbt_resv, XCHK_GFP_FLAGS); -if (!resv) -return -ENOMEM ; +/* +* We have no way to clean up the allocated space *and* return an +* ENOMEM if we fail to allocate this control structure. +*/ + resv = kmalloc_obj(struct xrep_newbt_resv, GFP_KERNEL | __GFP_NOFAIL);INIT_LIST_HEAD (&resv->list); resv->agbno =XFS_FSB_TO_AGBNO (mp, args->fsbno);
Sasha Levin
maintainerPATCH 1/1 xfs: don't let memory failures leak blocks and kill repairs
From: "Darrick J. Wong" <[email protected]>
[ Upstream commit ab1c416d2377cdc16123ef521aac4da1c468c3d4 ]
LOLLM complains that a memory allocation failure in xrep_newbt_add_blocks results in online repair leaking blocks that were previously allocated to write a new btree, but the problem is worse than that -- a limitation of the codebase is that the callers cannot undo the transaction /and/ return the error -- either you undo all changes and commit the transaction, or you error out and the filesystem goes down.
However, the new btree space reservation object isn't that big (~48 bytes). Let's just do a NOFAIL allocation and the problem goes away.
--- fs/xfs/scrub/newbt.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-)
fs/xfs/scrub/newbt.c +5 -3
@@ -147,9 +147,11 @@ xrep_newbt_add_blocks(struct xrep_newbt_resv *resv;int error; - resv =kmalloc (sizeof (struct xrep_newbt_resv ),XCHK_GFP_FLAGS ); -if (!resv) -return -ENOMEM ; +/* +* We have no way to clean up the allocated space *and* return an +* ENOMEM if we fail to allocate this control structure. +*/ + resv =kmalloc (sizeof (struct xrep_newbt_resv ),GFP_KERNEL | __GFP_NOFAIL);INIT_LIST_HEAD (&resv->list); resv->agbno =XFS_FSB_TO_AGBNO (mp, args->fsbno);
Signature · 1 line
2.53.0