git: 3f1e7e07459f - stable/13 - nfscommon: Revert use of nfsstatsv1_p in nfs_commonkrpc.c

From: Rick Macklem <rmacklem_at_FreeBSD.org>
Date: Wed, 17 May 2023 23:13:53 UTC
The branch stable/13 has been updated by rmacklem:

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

commit 3f1e7e07459f54ecd0cdbe586570f00a88c55d0f
Author:     Rick Macklem <rmacklem@FreeBSD.org>
AuthorDate: 2023-02-17 01:44:19 +0000
Commit:     Rick Macklem <rmacklem@FreeBSD.org>
CommitDate: 2023-05-17 23:12:49 +0000

    nfscommon: Revert use of nfsstatsv1_p in nfs_commonkrpc.c
    
    Commit 9d329bbc9aea converted a lot of accesses to nfsstatsv1
    to use nfsstatsv1_p instead.  However, the accesses in
    nfs_commonkrpc.c are for client side and should not be
    converted.  This patch puts them back in the correct
    pre-commit 9d329bbc9aea form.
    
    (cherry picked from commit a63b5d488badce9298e4272da2d5344e9f83a13d)
---
 sys/fs/nfs/nfs_commonkrpc.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/sys/fs/nfs/nfs_commonkrpc.c b/sys/fs/nfs/nfs_commonkrpc.c
index 0d2cb9ec279a..9badd8be47d4 100644
--- a/sys/fs/nfs/nfs_commonkrpc.c
+++ b/sys/fs/nfs/nfs_commonkrpc.c
@@ -92,6 +92,7 @@ NFSSTATESPINLOCK;
 NFSREQSPINLOCK;
 NFSDLOCKMUTEX;
 NFSCLSTATEMUTEX;
+extern struct nfsstatsv1 nfsstatsv1;
 extern struct nfsreqhead nfsd_reqq;
 extern int nfscl_ticks;
 extern void (*ncl_call_invalcaches)(struct vnode *);
@@ -99,8 +100,6 @@ extern int nfs_numnfscbd;
 extern int nfscl_debuglevel;
 extern int nfsrv_lease;
 
-NFSD_VNET_DECLARE(struct nfsstatsv1 *, nfsstatsv1_p);
-
 SVCPOOL		*nfscbd_pool;
 int		nfs_bufpackets = 4;
 static int	nfsrv_gsscallbackson = 0;
@@ -783,7 +782,7 @@ newnfs_request(struct nfsrv_descript *nd, struct nfsmount *nmp,
 		procnum = NFSV4PROC_COMPOUND;
 
 	if (nmp != NULL) {
-		NFSINCRGLOBAL(NFSD_VNET(nfsstatsv1_p)->rpcrequests);
+		NFSINCRGLOBAL(nfsstatsv1.rpcrequests);
 
 		/* Map the procnum to the old NFSv2 one, as required. */
 		if ((nd->nd_flag & ND_NFSV2) != 0) {
@@ -918,13 +917,13 @@ tryagain:
 	if (stat == RPC_SUCCESS) {
 		error = 0;
 	} else if (stat == RPC_TIMEDOUT) {
-		NFSINCRGLOBAL(NFSD_VNET(nfsstatsv1_p)->rpctimeouts);
+		NFSINCRGLOBAL(nfsstatsv1.rpctimeouts);
 		error = ETIMEDOUT;
 	} else if (stat == RPC_VERSMISMATCH) {
-		NFSINCRGLOBAL(NFSD_VNET(nfsstatsv1_p)->rpcinvalid);
+		NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
 		error = EOPNOTSUPP;
 	} else if (stat == RPC_PROGVERSMISMATCH) {
-		NFSINCRGLOBAL(NFSD_VNET(nfsstatsv1_p)->rpcinvalid);
+		NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
 		error = EPROTONOSUPPORT;
 	} else if (stat == RPC_CANTSEND || stat == RPC_CANTRECV ||
 	     stat == RPC_SYSTEMERROR || stat == RPC_INTR) {
@@ -958,11 +957,11 @@ tryagain:
 		if (stat == RPC_INTR)
 			error = EINTR;
 		else {
-			NFSINCRGLOBAL(NFSD_VNET(nfsstatsv1_p)->rpcinvalid);
+			NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
 			error = ENXIO;
 		}
 	} else {
-		NFSINCRGLOBAL(NFSD_VNET(nfsstatsv1_p)->rpcinvalid);
+		NFSINCRGLOBAL(nfsstatsv1.rpcinvalid);
 		error = EACCES;
 	}
 	if (error) {