cifs: Fix missing fscache invalidation
authorDavid Howells <dhowells@redhat.com>
Fri, 19 Jul 2024 15:01:48 +0000 (16:01 +0100)
committerSteve French <stfrench@microsoft.com>
Sat, 20 Jul 2024 18:55:29 +0000 (13:55 -0500)
A network filesystem needs to implement a netfslib hook to invalidate
fscache if it's to be able to use the cache.

Fix cifs to implement the cache invalidation hook.

Signed-off-by: David Howells <dhowells@redhat.com>
Reviewed-by: Paulo Alcantara (Red Hat) <pc@manguebit.com>
cc: Jeff Layton <jlayton@kernel.org>
cc: linux-cifs@vger.kernel.org
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
Cc: stable@vger.kernel.org
Fixes: 3ee1a1fc3981 ("cifs: Cut over to using netfslib")
Signed-off-by: Steve French <stfrench@microsoft.com>
fs/smb/client/file.c

index f8d6ad88335eaf85b37b2203aed99ffcaf7cd416..b2405dd4d4d4da6e515c554b9c3e9649ec59c4cb 100644 (file)
@@ -133,6 +133,11 @@ fail:
        goto out;
 }
 
+static void cifs_netfs_invalidate_cache(struct netfs_io_request *wreq)
+{
+       cifs_invalidate_cache(wreq->inode, 0);
+}
+
 /*
  * Split the read up according to how many credits we can get for each piece.
  * It's okay to sleep here if we need to wait for more credit to become
@@ -337,6 +342,7 @@ const struct netfs_request_ops cifs_req_ops = {
        .begin_writeback        = cifs_begin_writeback,
        .prepare_write          = cifs_prepare_write,
        .issue_write            = cifs_issue_write,
+       .invalidate_cache       = cifs_netfs_invalidate_cache,
 };
 
 /*