]> git.ipfire.org Git - thirdparty/kernel/stable.git/commit
NFSv4: Fix dropped lock for racing OPEN and delegation return
authorBenjamin Coddington <bcodding@redhat.com>
Fri, 30 Jun 2023 13:18:13 +0000 (09:18 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 30 Aug 2023 14:23:14 +0000 (16:23 +0200)
commitf979b92db1f5ef3b8798d51bd40c43560aebbbe2
tree7f4a4b2c80d09220d5467c14524d30e9064a4efa
parent0a809e01578bfb12aa7ac72cf83e9e818b9702a1
NFSv4: Fix dropped lock for racing OPEN and delegation return

commit 1cbc11aaa01f80577b67ae02c73ee781112125fd upstream.

Commmit f5ea16137a3f ("NFSv4: Retry LOCK on OLD_STATEID during delegation
return") attempted to solve this problem by using nfs4's generic async error
handling, but introduced a regression where v4.0 lock recovery would hang.
The additional complexity introduced by overloading that error handling is
not necessary for this case.  This patch expects that commit to be
reverted.

The problem as originally explained in the above commit is:

    There's a small window where a LOCK sent during a delegation return can
    race with another OPEN on client, but the open stateid has not yet been
    updated.  In this case, the client doesn't handle the OLD_STATEID error
    from the server and will lose this lock, emitting:
    "NFS: nfs4_handle_delegation_recall_error: unhandled error -10024".

Fix this by using the old_stateid refresh helpers if the server replies
with OLD_STATEID.

Suggested-by: Trond Myklebust <trondmy@hammerspace.com>
Signed-off-by: Benjamin Coddington <bcodding@redhat.com>
Signed-off-by: Trond Myklebust <trond.myklebust@hammerspace.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfs/nfs4proc.c