NFS/localio: Fix a race in nfs_local_open_fh()
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 21 Apr 2025 18:43:34 +0000 (14:43 -0400)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Mon, 28 Apr 2025 16:50:50 +0000 (09:50 -0700)
commitfa7ab64f1e2fdc8f2603aab8e0dd20de89cb10d9
tree6a0f74b5d8c5cab8c8a2c9f95a67922a536620d4
parentc367eea5041c2e5ef6836fe0ba8c5dc75a965b1b
NFS/localio: Fix a race in nfs_local_open_fh()

Once the clp->cl_uuid.lock has been dropped, another CPU could come in
and free the struct nfsd_file that was just added. To prevent that from
happening, take the RCU read lock before dropping the spin lock.

Fixes: 86e00412254a ("nfs: cache all open LOCALIO nfsd_file(s) in client")
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Reviewed-by: Mike Snitzer <snitzer@kernel.org>
fs/nfs/localio.c