]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
nfsd: nfserr_jukebox in nlm_fopen should lead to a retry
authorOlga Kornievskaia <okorniev@redhat.com>
Thu, 21 Aug 2025 20:31:46 +0000 (16:31 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 19 Oct 2025 14:21:49 +0000 (16:21 +0200)
commit a082e4b4d08a4a0e656d90c2c05da85f23e6d0c9 upstream.

When v3 NLM request finds a conflicting delegation, it triggers
a delegation recall and nfsd_open fails with EAGAIN. nfsd_open
then translates EAGAIN into nfserr_jukebox. In nlm_fopen, instead
of returning nlm_failed for when there is a conflicting delegation,
drop this NLM request so that the client retries. Once delegation
is recalled and if a local lock is claimed, a retry would lead to
nfsd returning a nlm_lck_blocked error or a successful nlm lock.

Fixes: d343fce148a4 ("[PATCH] knfsd: Allow lockd to drop replies as appropriate")
Cc: stable@vger.kernel.org # v6.6
Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
fs/nfsd/lockd.c

index 46a7f9b813e527707f305ab85ee8e97e8564edec..b02886f38925f86db5d15e70cc963cafe7ca2ff4 100644 (file)
@@ -48,6 +48,21 @@ nlm_fopen(struct svc_rqst *rqstp, struct nfs_fh *f, struct file **filp,
        switch (nfserr) {
        case nfs_ok:
                return 0;
+       case nfserr_jukebox:
+               /* this error can indicate a presence of a conflicting
+                * delegation to an NLM lock request. Options are:
+                * (1) For now, drop this request and make the client
+                * retry. When delegation is returned, client's lock retry
+                * will complete.
+                * (2) NLM4_DENIED as per "spec" signals to the client
+                * that the lock is unavailable now but client can retry.
+                * Linux client implementation does not. It treats
+                * NLM4_DENIED same as NLM4_FAILED and errors the request.
+                * (3) For the future, treat this as blocked lock and try
+                * to callback when the delegation is returned but might
+                * not have a proper lock request to block on.
+                */
+               fallthrough;
        case nfserr_dropit:
                return nlm_drop_reply;
        case nfserr_stale: