aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRick Macklem <rmacklem@FreeBSD.org>2026-08-04 15:55:24 +0000
committerRick Macklem <rmacklem@FreeBSD.org>2026-08-06 19:46:22 +0000
commit6154eec89acb3aa6561f2e8ba365115a8056591d (patch)
treec81a23616d915115bedba56df45d771ee51165a6
parent037232c2001528995d75556c8e2007c686e50134 (diff)
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 (cherry picked from commit 8f20299b473af6132e0f146d7f634640993aeb81)
-rw-r--r--sys/fs/nfsclient/nfs_clrpcops.c27
1 files changed, 0 insertions, 27 deletions
diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index 43fc0af299b1..dc42170e0577 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -731,33 +731,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;