]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
NFS/localio: nfs_close_local_fh() fix check for file closed
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 15 Jul 2025 19:43:41 +0000 (12:43 -0700)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 5 Aug 2025 23:45:39 +0000 (16:45 -0700)
If the struct nfs_file_localio is closed, its list entry will be empty,
but the nfs_uuid->files list might still contain other entries.

Acked-by: Mike Snitzer <snitzer@kernel.org>
Tested-by: Mike Snitzer <snitzer@kernel.org>
Reviewed-by: NeilBrown <neil@brown.name>
Fixes: 21fb44034695 ("nfs_localio: protect race between nfs_uuid_put() and nfs_close_local_fh()")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs_common/nfslocalio.c

index 05c7c16e37ab4c431719c30d789e5cf793442de4..64949c46c1741351e4df9e3e7cc838a0fabdaa23 100644 (file)
@@ -314,7 +314,7 @@ void nfs_close_local_fh(struct nfs_file_localio *nfl)
                rcu_read_unlock();
                return;
        }
-       if (list_empty(&nfs_uuid->files)) {
+       if (list_empty(&nfl->list)) {
                /* nfs_uuid_put() has started closing files, wait for it
                 * to finished
                 */