Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 18 Oct 2021 00:54:40 GMT
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: d95c0a12a2dd - main - nfscl: Modify Close RPC so that it does not use "owner" for NFSv4.1/4.2
Message-ID:  <202110180054.19I0seBh000681@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by rmacklem:

URL: https://cgit.FreeBSD.org/src/commit/?id=d95c0a12a2dd58b4b13cbc2d1a9fccd848f8ac5e

commit d95c0a12a2dd58b4b13cbc2d1a9fccd848f8ac5e
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2021-10-18 00:50:56 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2021-10-18 00:50:56 +0000

    nfscl: Modify Close RPC so that it does not use "owner" for NFSv4.1/4.2
    
    This patch modifies the function that does the Close RPC (nfsrpc_closerpc)
    so that it does not use the open_owner (nfso_own) for NFSv4.1/4.2.
    Use of the seqid in the open_owner structure is only needed for NFSv4.0.
    Same applies to a NFSERR_STALESTATEID reply, which should only happen
    for NFSv4.0.  This allows nfsrpc_closerpc() to be called when nfso_own
    is no longer valid.  This, in turn, allows nfsrpc_closerpc() to be called
    after the shared lock on the clientID is released, for NFSv4.1/4.2.
    
    This is being done to prepare the code for a future patch that fixes
    the case where an NFSv4.1/4.2 server replies NFSERR_DELAY to a Close
    operation.
    
    MFC after:      2 week
---
 sys/fs/nfsclient/nfs_clrpcops.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c
index 08c9117a8fc1..6b6fdc03441f 100644
--- a/sys/fs/nfsclient/nfs_clrpcops.c
+++ b/sys/fs/nfsclient/nfs_clrpcops.c
@@ -868,11 +868,13 @@ nfsrpc_closerpc(struct nfsrv_descript *nd, struct nfsmount *nmp,
 	nfscl_reqstart(nd, NFSPROC_CLOSE, nmp, op->nfso_fh,
 	    op->nfso_fhlen, NULL, NULL, 0, 0);
 	NFSM_BUILD(tl, u_int32_t *, NFSX_UNSIGNED + NFSX_STATEID);
-	*tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid);
-	if (NFSHASNFSV4N(nmp))
+	if (NFSHASNFSV4N(nmp)) {
 		*tl++ = 0;
-	else
+		*tl++ = 0;
+	} else {
+		*tl++ = txdr_unsigned(op->nfso_own->nfsow_seqid);
 		*tl++ = op->nfso_stateid.seqid;
+	}
 	*tl++ = op->nfso_stateid.other[0];
 	*tl++ = op->nfso_stateid.other[1];
 	*tl = op->nfso_stateid.other[2];
@@ -882,11 +884,12 @@ nfsrpc_closerpc(struct nfsrv_descript *nd, struct nfsmount *nmp,
 	    NFS_PROG, NFS_VER4, NULL, 1, NULL, NULL);
 	if (error)
 		return (error);
-	NFSCL_INCRSEQID(op->nfso_own->nfsow_seqid, nd);
+	if (!NFSHASNFSV4N(nmp))
+		NFSCL_INCRSEQID(op->nfso_own->nfsow_seqid, nd);
 	if (nd->nd_repstat == 0)
 		NFSM_DISSECT(tl, u_int32_t *, NFSX_STATEID);
 	error = nd->nd_repstat;
-	if (error == NFSERR_STALESTATEID)
+	if (!NFSHASNFSV4N(nmp) && error == NFSERR_STALESTATEID)
 		nfscl_initiate_recovery(op->nfso_own->nfsow_clp);
 nfsmout:
 	m_freem(nd->nd_mrep);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202110180054.19I0seBh000681>