]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
netfs: clear PG_private_2 on copy-to-cache append failure
authorYichong Chen <chenyichong@uniontech.com>
Mon, 27 Jul 2026 13:07:12 +0000 (14:07 +0100)
committerChristian Brauner <brauner@kernel.org>
Tue, 28 Jul 2026 13:42:31 +0000 (15:42 +0200)
netfs_pgpriv2_copy_to_cache() marks the folio with PG_private_2 before
netfs_pgpriv2_copy_folio() appends it to the copy-to-cache rolling
buffer.

If the append fails, the folio is not queued for cache writeback, so
the PG_private_2 state and its reference must be released immediately.

Fixes: e2d46f2ec332 ("netfs: Change the read result collector to only use one work item")
Signed-off-by: Yichong Chen <chenyichong@uniontech.com>
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://patch.msgid.link/20260727130716.1099906-2-dhowells@redhat.com
cc: Paulo Alcantara <pc@manguebit.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Signed-off-by: Christian Brauner (Amutable) <brauner@kernel.org>
fs/netfs/read_pgpriv2.c

index a1489aa29f782ae30166874ec8222f9de0565c87..7eacc58abadb73127216008126328ac0f9fd846c 100644 (file)
@@ -54,6 +54,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) {
+               folio_end_private_2(folio);
                clear_bit(NETFS_RREQ_FOLIO_COPY_TO_CACHE, &creq->flags);
                return;
        }