linux-yocto/fs/nfs
Trond Myklebust 202a3432d2 NFS: Fix a race when updating an existing write
commit 76d2e3890fb169168c73f2e4f8375c7cc24a765e upstream.

After nfs_lock_and_join_requests() tests for whether the request is
still attached to the mapping, nothing prevents a call to
nfs_inode_remove_request() from succeeding until we actually lock the
page group.
The reason is that whoever called nfs_inode_remove_request() doesn't
necessarily have a lock on the page group head.

So in order to avoid races, let's take the page group lock earlier in
nfs_lock_and_join_requests(), and hold it across the removal of the
request in nfs_inode_remove_request().

Reported-by: Jeff Layton <jlayton@kernel.org>
Tested-by: Joe Quanaim <jdq@meta.com>
Tested-by: Andrew Steffen <aksteffen@meta.com>
Reviewed-by: Jeff Layton <jlayton@kernel.org>
Fixes: bd37d6fce1 ("NFSv4: Convert nfs_lock_and_join_requests() to use nfs_page_find_head_request()")
Cc: stable@vger.kernel.org
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2025-08-28 16:34:35 +02:00
..
blocklayout pNFS: Fix uninited ptr deref in block/scsi layout 2025-08-20 18:41:33 +02:00
filelayout nfs: don't share pNFS DS connections between net namespaces 2025-04-27 23:25:44 -04:00
flexfilelayout pNFS/flexfiles: don't attempt pnfs on fatal DS errors 2025-08-15 16:39:22 +02:00
cache_lib.c
cache_lib.h
callback_proc.c NFS: CB_OFFLOAD can return NFS4ERR_DELAY 2025-01-21 11:34:50 -05:00
callback_xdr.c nfsd: don't use sv_nrthreads in connection limiting calculations. 2025-01-06 09:37:36 -05:00
callback.c nfsd: don't use sv_nrthreads in connection limiting calculations. 2025-01-06 09:37:36 -05:00
callback.h
client.c NFS: Fix the setting of capabilities when automounting a new filesystem 2025-08-20 18:40:47 +02:00
delegation.c NFSv4: Allow FREE_STATEID to clean up delegations 2025-05-28 17:17:13 -04:00
delegation.h NFSv4: Fix a deadlock when recovering state on a sillyrenamed file 2025-02-19 16:45:24 -05:00
dir.c NFS: Fix wakeup of __nfs_lookup_revalidate() in unblock_revalidate() 2025-08-15 16:39:22 +02:00
direct.c nfs: direct: drop useless initializer in nfs_direct_write_completion() 2025-04-27 23:25:44 -04:00
dns_resolve.c
dns_resolve.h
export.c NFS: Fix filehandle bounds checking in nfs_fh_to_dentry() 2025-08-15 16:39:22 +02:00
file.c NFS: fix nfs_release_folio() to not deadlock via kcompactd writeback 2025-03-05 21:36:15 -08:00
fs_context.c NFS: Add a mount option to make ENETUNREACH errors fatal 2025-03-21 12:44:09 -04:00
fscache.c netfs: Fix undifferentiation of DIO reads from unbuffered reads 2025-05-23 10:35:03 +02:00
fscache.h netfs: Drop the was_async arg from netfs_read_subreq_terminated() 2024-12-20 22:34:03 +01:00
getroot.c nfs: fix the comment of nfs_get_root 2024-09-23 15:03:13 -04:00
inode.c nfs: Clean up /proc/net/rpc/nfs when nfs_fs_proc_net_init() fails. 2025-06-23 11:01:16 -04:00
internal.h NFS: Fix the setting of capabilities when automounting a new filesystem 2025-08-20 18:40:47 +02:00
io.c fs/nfs/io: make nfs_start_io_*() killable 2024-11-28 12:55:33 -05:00
iostat.h
Kconfig nfs: add missing selections of CONFIG_CRC32 2025-04-13 16:39:42 -04:00
localio.c nfs_localio: change nfsd_file_put_local() to take a pointer to __rcu pointer 2025-05-28 17:17:14 -04:00
Makefile nfs: add LOCALIO support 2024-09-23 15:03:30 -04:00
mount_clnt.c
namespace.c saner calling conventions for ->d_automount() 2025-05-05 13:42:49 -04:00
netns.h nfs: move the nfs4_data_server_cache into struct nfs_net 2025-04-27 23:25:44 -04:00
nfs.h NFS: Implement get_nfs_version() 2024-11-08 14:17:37 -05:00
nfs2super.c
nfs2xdr.c nfs_common: factor out nfs_errtbl and nfs_stat_to_errno 2024-09-23 15:03:29 -04:00
nfs3_fs.h
nfs3acl.c nfs: nfs3acl: drop useless assignment in nfs3_get_acl() 2025-04-27 23:25:44 -04:00
nfs3client.c pNFS/flexfiles: Treat ENETUNREACH errors as fatal in containers 2025-03-21 12:44:24 -04:00
nfs3proc.c NFS client updates for Linux 6.15 2025-04-02 17:06:31 -07:00
nfs3super.c
nfs3xdr.c nfs_common: factor out nfs_errtbl and nfs_stat_to_errno 2024-09-23 15:03:29 -04:00
nfs4_fs.h NFSv4: Allow FREE_STATEID to clean up delegations 2025-05-28 17:17:13 -04:00
nfs4client.c NFS: Fix the setting of capabilities when automounting a new filesystem 2025-08-20 18:40:47 +02:00
nfs4file.c NFS: Add support for fallocate(FALLOC_FL_ZERO_RANGE) 2025-05-28 17:17:13 -04:00
nfs4getroot.c
nfs4idmap.c
nfs4idmap.h
nfs4namespace.c
nfs4proc.c NFS: Fix the setting of capabilities when automounting a new filesystem 2025-08-20 18:40:47 +02:00
nfs4renewd.c
nfs4session.c
nfs4session.h nfs: add missing selections of CONFIG_CRC32 2025-04-13 16:39:42 -04:00
nfs4state.c NFSv4: Treat ENETUNREACH errors as fatal for state recovery 2025-03-26 12:19:58 -04:00
nfs4super.c
nfs4sysctl.c treewide: const qualify ctl_tables where applicable 2025-01-28 13:48:37 +01:00
nfs4trace.c
nfs4trace.h pNFS/flexfiles: Record the RPC errors in the I/O tracepoints 2025-04-27 23:25:44 -04:00
nfs4xdr.c NFS: Add support for fallocate(FALLOC_FL_ZERO_RANGE) 2025-05-28 17:17:13 -04:00
nfs42.h NFS: Add support for fallocate(FALLOC_FL_ZERO_RANGE) 2025-05-28 17:17:13 -04:00
nfs42proc.c NFS: Add support for fallocate(FALLOC_FL_ZERO_RANGE) 2025-05-28 17:17:13 -04:00
nfs42xattr.c mm/list_lru: simplify the list_lru walk callback function 2024-11-11 17:22:26 -08:00
nfs42xdr.c NFS: Add support for fallocate(FALLOC_FL_ZERO_RANGE) 2025-05-28 17:17:13 -04:00
nfsroot.c
nfstrace.c
nfstrace.h nfs/localio: remove redundant code and simplify LOCALIO enablement 2025-01-14 17:05:10 -05:00
pagelist.c NFS: Fix a race when updating an existing write 2025-08-28 16:34:35 +02:00
pnfs_dev.c
pnfs_nfs.c pnfs/flexfiles: connect to NFSv3 DS using TLS if MDS connection uses TLS 2025-05-28 17:17:13 -04:00
pnfs.c pNFS: Handle RPC size limit for layoutcommits 2025-08-20 18:41:33 +02:00
pnfs.h nfs: don't share pNFS DS connections between net namespaces 2025-04-27 23:25:44 -04:00
proc.c nfs: change mkdir inode_operation to return alternate dentry if needed. 2025-03-05 11:52:50 +01:00
read.c fs/nfs/read: fix double-unlock bug in nfs_return_empty_folio() 2025-05-28 17:17:13 -04:00
super.c nfs: ignore SB_RDONLY when remounting nfs 2025-05-28 17:17:14 -04:00
symlink.c fs: Pass a folio to page_put_link() 2025-05-15 12:14:29 +02:00
sysctl.c treewide: const qualify ctl_tables where applicable 2025-01-28 13:48:37 +01:00
sysfs.c NFS: add localio to sysfs 2025-05-28 17:17:13 -04:00
sysfs.h
unlink.c VFS: rename lookup_one_len family to lookup_noperm and remove permission check 2025-04-08 11:24:36 +02:00
write.c NFS: Fix a race when updating an existing write 2025-08-28 16:34:35 +02:00