* [PATCH] netfs: add missing folio_end_private_2() to netfs_pgpriv2_copy_folio()
@ 2026-03-30 10:55 Max Kellermann
0 siblings, 0 replies; only message in thread
From: Max Kellermann @ 2026-03-30 10:55 UTC (permalink / raw)
To: dhowells, pc, netfs, linux-fsdevel, linux-kernel; +Cc: Max Kellermann, stable
This deprecated PG_private_2 copy-to-cache path can leak folio private
state on rolling-buffer allocation failure.
netfs_pgpriv2_copy_to_cache() sets PG_private_2 first, then
netfs_pgpriv2_copy_folio() tries to append the folio to the tracking
buffer. If that append fails, it just returns without calling
folio_end_private_2(). The folio is then no longer tracked for copy
completion, but later invalidate/release paths still block on that bit
in netfs_invalidate_folio() and netfs_release_folio(), so the folio
can become permanently stuck/unreclaimable.
Fixes: ee4cdf7ba857 ("netfs: Speed up buffered reading")
Cc: stable@vger.kernel.org
Signed-off-by: Max Kellermann <max.kellermann@ionos.com>
---
fs/netfs/read_pgpriv2.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/fs/netfs/read_pgpriv2.c b/fs/netfs/read_pgpriv2.c
index a1489aa29f78..ab73fa62378b 100644
--- a/fs/netfs/read_pgpriv2.c
+++ b/fs/netfs/read_pgpriv2.c
@@ -55,6 +55,7 @@ static void netfs_pgpriv2_copy_folio(struct netfs_io_request *creq, struct folio
/* Attach the folio to the rolling buffer. */
if (rolling_buffer_append(&creq->buffer, folio, 0) < 0) {
clear_bit(NETFS_RREQ_FOLIO_COPY_TO_CACHE, &creq->flags);
+ folio_end_private_2(folio);
return;
}
--
2.47.3
^ permalink raw reply related [flat|nested] only message in thread
only message in thread, other threads:[~2026-03-30 10:55 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-30 10:55 [PATCH] netfs: add missing folio_end_private_2() to netfs_pgpriv2_copy_folio() Max Kellermann
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox