FAILED: patch "[PATCH] erofs: skip sufficiently large global buffers when resizing" failed to apply to 6.18-stable tree
Subsystems (2)
[email protected]
maintainerThe patch below does not apply to the 6.18-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.18.y
git checkout FETCH_HEAD
git cherry-pick -x a7d097cf01301c5da37927c8f26123d006f0fd8a
# <resolve conflicts, build, test, etc.>
git commit -s
git send-email --to '<[email protected]>' --in-reply-to '2026090345-used-spearfish-a45c@gregkh' --subject-prefix 'PATCH 6.18.y' 'HEAD^..'
Possible dependencies:
thanks,
greg k-h
------------------ original commit in Linus's tree ------------------
From a7d097cf01301c5da37927c8f26123d006f0fd8a Mon Sep 17 00:00:00 2001
From: Nikhil Gurudasani <[email protected]>
Date: Sat, 22 Aug 2026 19:30:17 +0530
Subject: [PATCH] erofs: skip sufficiently large global buffers when resizing
z_erofs_gbuf_nrpages is advanced only after every global buffer has been grown. If a resize fails after some buffers were enlarged, a retry revisits those enlarged buffers.
Retrying the same size then returns -ENOMEM because alloc_pages_bulk() has no pages to add and the unchanged return value is treated as a failure. Retrying an intermediate size allocates a temporary pointer array smaller than gbuf->nrpages and copies more existing pointers than the array can hold.
Skip buffers that already satisfy the request. Once all remaining buffers have caught up, advancing z_erofs_gbuf_nrpages again describes the guaranteed minimum size across the pool.
fs/erofs/zutil.c +2 -0
@@ -79,6 +79,8 @@ int z_erofs_gbuf_growsize(unsigned int nrpages)for (i =0 ; i < z_erofs_gbuf_count; ++i) { gbuf = &z_erofs_gbufpool[i]; +if (gbuf->nrpages >= nrpages) +continue ; tmp_pages =kzalloc_objs (*tmp_pages, nrpages);if (!tmp_pages) goto out;
Sasha Levin
maintainerPATCH 1/1 erofs: skip sufficiently large global buffers when resizing
From: Nikhil Gurudasani <[email protected]>
[ Upstream commit a7d097cf01301c5da37927c8f26123d006f0fd8a ]
z_erofs_gbuf_nrpages is advanced only after every global buffer has been grown. If a resize fails after some buffers were enlarged, a retry revisits those enlarged buffers.
Retrying the same size then returns -ENOMEM because alloc_pages_bulk() has no pages to add and the unchanged return value is treated as a failure. Retrying an intermediate size allocates a temporary pointer array smaller than gbuf->nrpages and copies more existing pointers than the array can hold.
Skip buffers that already satisfy the request. Once all remaining buffers have caught up, advancing z_erofs_gbuf_nrpages again describes the guaranteed minimum size across the pool.
--- fs/erofs/zutil.c | 2 ++ 1 file changed, 2 insertions(+)
fs/erofs/zutil.c +2 -0
@@ -79,6 +79,8 @@ int z_erofs_gbuf_growsize(unsigned int nrpages)for (i =0 ; i < z_erofs_gbuf_count; ++i) { gbuf = &z_erofs_gbufpool[i]; +if (gbuf->nrpages >= nrpages) +continue ; tmp_pages =kcalloc (nrpages,sizeof (*tmp_pages),GFP_KERNEL );if (!tmp_pages) goto out;
Signature · 1 line
2.53.0