Skip to content

Commit 1fd7372

Browse files
committed
Merge: NFSv4/pNFS: Fix a race to wake on NFS_LAYOUT_DRAIN
MR: https://gitlab.com/redhat/centos-stream/src/kernel/centos-stream-9/-/merge_requests/7105 JIRA: https://issues.redhat.com/browse/RHEL-92556 commit c017762 Author: Benjamin Coddington <bcodding@redhat.com> Date: Thu Jun 19 11:02:21 2025 -0400 NFSv4/pNFS: Fix a race to wake on NFS_LAYOUT_DRAIN We found a few different systems hung up in writeback waiting on the same page lock, and one task waiting on the NFS_LAYOUT_DRAIN bit in pnfs_update_layout(), however the pnfs_layout_hdr's plh_outstanding count was zero. It seems most likely that this is another race between the waiter and waker similar to commit ed0172a ("SUNRPC: Fix a race to wake a sync task"). Fix it up by applying the advised barrier. Fixes: 880265c ("pNFS: Avoid a live lock condition in pnfs_update_layout()") Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Signed-off-by: Anna Schumaker <anna.schumaker@oracle.com> Signed-off-by: Benjamin Coddington <bcodding@redhat.com> Approved-by: Scott Mayhew <smayhew@redhat.com> Approved-by: Olga Kornievskaia <okorniev@redhat.com> Approved-by: CKI KWF Bot <cki-ci-bot+kwf-gitlab-com@redhat.com> Merged-by: Augusto Caringi <acaringi@redhat.com>
2 parents b7abe37 + 2898f23 commit 1fd7372

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

fs/nfs/pnfs.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2042,8 +2042,10 @@ static void nfs_layoutget_begin(struct pnfs_layout_hdr *lo)
20422042
static void nfs_layoutget_end(struct pnfs_layout_hdr *lo)
20432043
{
20442044
if (atomic_dec_and_test(&lo->plh_outstanding) &&
2045-
test_and_clear_bit(NFS_LAYOUT_DRAIN, &lo->plh_flags))
2045+
test_and_clear_bit(NFS_LAYOUT_DRAIN, &lo->plh_flags)) {
2046+
smp_mb__after_atomic();
20462047
wake_up_bit(&lo->plh_flags, NFS_LAYOUT_DRAIN);
2048+
}
20472049
}
20482050

20492051
static bool pnfs_is_first_layoutget(struct pnfs_layout_hdr *lo)

0 commit comments

Comments
 (0)