]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
NFS/pnfs: Fix a live lock between recalled layouts and layoutget
authorTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 17 Dec 2024 00:28:06 +0000 (19:28 -0500)
committerTrond Myklebust <trond.myklebust@hammerspace.com>
Tue, 17 Dec 2024 16:10:55 +0000 (11:10 -0500)
When the server is recalling a layout, we should ignore the count of
outstanding layoutget calls, since the server is expected to return
either NFS4ERR_RECALLCONFLICT or NFS4ERR_RETURNCONFLICT for as long as
the recall is outstanding.
Currently, we may end up livelocking, causing the layout to eventually
be forcibly revoked.

Fixes: bf0291dd2267 ("pNFS: Ensure LAYOUTGET and LAYOUTRETURN are properly serialised")
Cc: stable@vger.kernel.org
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
fs/nfs/pnfs.c

index 0d16b383a45262f75f06db6601669b7f55df4fa4..5f582713bf05eb72eb34b2e2c06d1edcd3c258d3 100644 (file)
@@ -1308,7 +1308,7 @@ pnfs_prepare_layoutreturn(struct pnfs_layout_hdr *lo,
                enum pnfs_iomode *iomode)
 {
        /* Serialise LAYOUTGET/LAYOUTRETURN */
-       if (atomic_read(&lo->plh_outstanding) != 0)
+       if (atomic_read(&lo->plh_outstanding) != 0 && lo->plh_return_seq == 0)
                return false;
        if (test_and_set_bit(NFS_LAYOUT_RETURN_LOCK, &lo->plh_flags))
                return false;