Files
linux/fs/nfs
Trond Myklebust 76d2e3890f NFS: Fix a race when updating an existing write
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>
2025-08-19 11:16:02 -07:00
..
2024-09-23 15:03:13 -04:00
2025-07-22 08:10:17 -04:00
2024-11-28 12:55:33 -05:00
2024-09-23 15:03:30 -04:00
2023-03-06 09:57:12 +01:00
2025-07-14 15:20:02 -07:00
2024-11-08 14:17:37 -05:00
2025-06-10 22:21:16 -04:00
2025-05-15 12:14:29 +02:00
2025-05-28 17:17:13 -04:00