]> git.proxmox.com Git - mirror_ubuntu-kernels.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)
committerStefan Bader <stefan.bader@canonical.com>
Mon, 30 Oct 2023 11:00:26 +0000 (12:00 +0100)
commit0cef8abfbe7d570474ae39fcb022d1097f619059
treed64a124902bbe648fc2dee9e4cef00ec9a86e80c
parent26df96e25348ef1c8ef8daeaa925da4339fda7fe
NFSv4: Fix dropped lock for racing OPEN and delegation return

BugLink: https://bugs.launchpad.net/bugs/2039742
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>
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Signed-off-by: Stefan Bader <stefan.bader@canonical.com>
fs/nfs/nfs4proc.c