]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
nfsd: fix GET_DIR_DELEGATION when VFS leases are disabled
authorOlga Kornievskaia <okorniev@redhat.com>
Fri, 3 Apr 2026 15:20:55 +0000 (11:20 -0400)
committerChuck Lever <chuck.lever@oracle.com>
Mon, 27 Apr 2026 01:05:49 +0000 (21:05 -0400)
When leases are disabled on the server, running xfstest generic/309 leads
to an error because GET_DIR_DELEGATION returns EINVAL.

nfsd_get_dir_deleg() can fail in several ways: like memory allocation and
unable to get a lease because either leases are disable or it's already
held. Currently only the condition "already held" is translated to
returning directory-delegation-is-unavailable error. However, other failure
conditions are likely temporary and thus should result in the same kind
of error.

Fixes: 8b99f6a8c116 ("nfsd: wire up GET_DIR_DELEGATION handling")
Cc: stable@vger.kernel.org
Signed-off-by: Olga Kornievskaia <okorniev@redhat.com>
Signed-off-by: Chuck Lever <chuck.lever@oracle.com>
fs/nfsd/nfs4proc.c

index 85e94c30285a26e6f1b5f0298ad98584341e2240..2797da8cc9501fe46fce8ce4841876558df89e31 100644 (file)
@@ -2535,10 +2535,6 @@ nfsd4_get_dir_delegation(struct svc_rqst *rqstp,
        dd = nfsd_get_dir_deleg(cstate, gdd, nf);
        nfsd_file_put(nf);
        if (IS_ERR(dd)) {
-               int err = PTR_ERR(dd);
-
-               if (err != -EAGAIN)
-                       return nfserrno(err);
                gdd->gddrnf_status = GDD4_UNAVAIL;
                return nfs_ok;
        }