git: 8f20299b473a - main - nfs_commonkrpc.c: Get rid of NFSv4.0 delegation cruft
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Tue, 04 Aug 2026 15:57:13 UTC
The branch main has been updated by rmacklem:
URL: https://cgit.FreeBSD.org/src/commit/?id=8f20299b473af6132e0f146d7f634640993aeb81
commit 8f20299b473af6132e0f146d7f634640993aeb81
Author: Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2026-08-04 15:55:24 +0000
Commit: Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2026-08-04 15:55:24 +0000
nfs_commonkrpc.c: Get rid of NFSv4.0 delegation cruft
Delegations in NFSv4.0 never worked well and, since
the NFSv4.0 protocol is now deprecated, use of delegations
for NFSv4.0 is disabled as far as the client can do so.
It turns out that some Illumos NFSv4.0 server issues
delegations anyhow (even when the callback path is
specified as 0.0.0.0) and this can cause use after free
problems.
This patch deleted some cruft that did an nfsrpc_openrpc()
call recursively when an NFSv4.0 server failed to issue
a delegation when it had previously done so.
This code was only meant to be an optimization and
would have been rarely exercised. Since this recursive
call of nfsrpc_openrpc() is in some of the backtraces
in the bugzilla PR, getting rid of the cruft makes sense.
It is not known if this helps w.r.t. the use after free
problems at this time.
PR: 297233
MFC after: 3 days
---
sys/fs/nfsclient/nfs_clrpcops.c | 27 ---------------------------
1 file changed, 27 deletions(-)
diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index fedfc7259197..7984737a2f65 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -735,33 +735,6 @@ nfsrpc_openrpc(struct nfsmount *nmp, vnode_t vp, u_int8_t *nfhp, int fhlen,
else
op->nfso_posixlock = 0;
- /*
- * If the server is handing out delegations, but we didn't
- * get one because an OpenConfirm was required, try the
- * Open again, to get a delegation. This is a harmless no-op,
- * from a server's point of view.
- */
- if (!reclaim && (rflags & NFSV4OPEN_RESULTCONFIRM) &&
- (op->nfso_own->nfsow_clp->nfsc_flags & NFSCLFLAGS_GOTDELEG)
- && !error && dp == NULL && ndp == NULL && !recursed) {
- do {
- ret = nfsrpc_openrpc(nmp, vp, nfhp, fhlen, newfhp,
- newfhlen, mode, op, name, namelen, &ndp, 0, 0x0,
- cred, p, syscred, 1);
- if (ret == NFSERR_DELAY)
- (void) nfs_catnap(PZERO, ret, "nfs_open2");
- } while (ret == NFSERR_DELAY);
- if (ret) {
- if (ndp != NULL) {
- free(ndp, M_NFSCLDELEG);
- ndp = NULL;
- }
- if (ret == NFSERR_STALECLIENTID ||
- ret == NFSERR_STALEDONTRECOVER ||
- ret == NFSERR_BADSESSION)
- error = ret;
- }
- }
}
if (nd->nd_repstat != 0 && error == 0)
error = nd->nd_repstat;