Skip to content

Commit c017762

Browse files
bcodding-rhAnna Schumaker
authored andcommitted
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 <[email protected]> Signed-off-by: Anna Schumaker <[email protected]>
1 parent e8d6f3a commit c017762

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
@@ -2059,8 +2059,10 @@ static void nfs_layoutget_begin(struct pnfs_layout_hdr *lo)
20592059
static void nfs_layoutget_end(struct pnfs_layout_hdr *lo)
20602060
{
20612061
if (atomic_dec_and_test(&lo->plh_outstanding) &&
2062-
test_and_clear_bit(NFS_LAYOUT_DRAIN, &lo->plh_flags))
2062+
test_and_clear_bit(NFS_LAYOUT_DRAIN, &lo->plh_flags)) {
2063+
smp_mb__after_atomic();
20632064
wake_up_bit(&lo->plh_flags, NFS_LAYOUT_DRAIN);
2065+
}
20642066
}
20652067

20662068
static bool pnfs_is_first_layoutget(struct pnfs_layout_hdr *lo)

0 commit comments

Comments
 (0)