]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
netfs: Fix netfs_create_write_req() to handle async cache object creation
authorDavid Howells <dhowells@redhat.com>
Thu, 25 Jun 2026 14:06:20 +0000 (15:06 +0100)
committerChristian Brauner <brauner@kernel.org>
Wed, 1 Jul 2026 13:26:28 +0000 (15:26 +0200)
netfs_create_write_req() will skip caching if the fscache cookie is
disabled, but this is a problem because async cache object creation might
not have got far enough yet that has been enabled - thereby causing the
call to fscache_begin_write_operation() to be skipped.

Fix this by removing the checks on the cookie and delegating this to
fscache_begin_write_operation().

Fixes: 7b589a9b45ae ("netfs: Fix handling of USE_PGPRIV2 and WRITE_TO_CACHE flags")
Closes: https://sashiko.dev/#/patchset/20260624115737.2964520-1-dhowells%40redhat.com
Signed-off-by: David Howells <dhowells@redhat.com>
Link: https://patch.msgid.link/20260625140640.3116900-3-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/write_issue.c

index c03c7cc45e4716344cc7347aaa0d474a036b9faf..4f55228f0fd497ae6885715dc624c0c27c1a5419 100644 (file)
@@ -106,7 +106,7 @@ struct netfs_io_request *netfs_create_write_req(struct address_space *mapping,
        _enter("R=%x", wreq->debug_id);
 
        ictx = netfs_inode(wreq->inode);
-       if (is_cacheable && netfs_is_cache_enabled(ictx))
+       if (is_cacheable)
                fscache_begin_write_operation(&wreq->cache_resources, netfs_i_cookie(ictx));
        if (rolling_buffer_init(&wreq->buffer, wreq->debug_id, ITER_SOURCE) < 0)
                goto nomem;