From owner-dev-commits-src-branches@freebsd.org Mon Mar 15 20:53:43 2021 Return-Path: Delivered-To: dev-commits-src-branches@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CA3C5AF4FB; Mon, 15 Mar 2021 20:53:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4DzpYM40kvz4RHD; Mon, 15 Mar 2021 20:53:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7C2A517681; Mon, 15 Mar 2021 20:53:43 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 12FKrhaQ020368; Mon, 15 Mar 2021 20:53:43 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 12FKrhLi020367; Mon, 15 Mar 2021 20:53:43 GMT (envelope-from git) Date: Mon, 15 Mar 2021 20:53:43 GMT Message-Id: <202103152053.12FKrhLi020367@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Rick Macklem Subject: git: 960f07a448d0 - stable/12 - nfsclient: Fix ReadDS/WriteDS/CommitDS nfsstats RPC counts for a NFSv3 DS MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: rmacklem X-Git-Repository: src X-Git-Refname: refs/heads/stable/12 X-Git-Reftype: branch X-Git-Commit: 960f07a448d01b09595732cf87afe7ba657564b4 Auto-Submitted: auto-generated X-BeenThere: dev-commits-src-branches@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Commits to the stable branches of the FreeBSD src repository List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 15 Mar 2021 20:53:43 -0000 The branch stable/12 has been updated by rmacklem: URL: https://cgit.FreeBSD.org/src/commit/?id=960f07a448d01b09595732cf87afe7ba657564b4 commit 960f07a448d01b09595732cf87afe7ba657564b4 Author: Rick Macklem AuthorDate: 2021-03-02 22:18:23 +0000 Commit: Rick Macklem CommitDate: 2021-03-15 19:52:46 +0000 nfsclient: Fix ReadDS/WriteDS/CommitDS nfsstats RPC counts for a NFSv3 DS During a recent virtual NFSv4 testing event, a bug in the FreeBSD client was detected when doing I/O DS operations on a Flexible File Layout pNFS server. For an NFSv3 DS, the Read/Write/Commit nfsstats were incremented instead of the ReadDS/WriteDS/CommitDS counts. This patch fixes this. Only the RPC counts reported by nfsstat(1) were affected by this bug, the I/O operations were performed correctly. MFC after: 2 weeks (cherry picked from commit c04199affeacbd9e9dda3aaf5ca0b1b180031e78) --- sys/fs/nfs/nfsport.h | 1 + sys/fs/nfsclient/nfs_clrpcops.c | 12 +++++++++++- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/sys/fs/nfs/nfsport.h b/sys/fs/nfs/nfsport.h index 8d9f5ac42225..177fcad5443d 100644 --- a/sys/fs/nfs/nfsport.h +++ b/sys/fs/nfs/nfsport.h @@ -885,6 +885,7 @@ bool ncl_pager_setsize(struct vnode *vp, u_quad_t *nsizep); * "out by one" without disastrous consequences. */ #define NFSINCRGLOBAL(a) ((a)++) +#define NFSDECRGLOBAL(a) ((a)--) /* * Assorted funky stuff to make things work under Darwin8. diff --git a/sys/fs/nfsclient/nfs_clrpcops.c b/sys/fs/nfsclient/nfs_clrpcops.c index cab5ec4005ba..6143edb93895 100644 --- a/sys/fs/nfsclient/nfs_clrpcops.c +++ b/sys/fs/nfsclient/nfs_clrpcops.c @@ -63,6 +63,7 @@ SYSCTL_INT(_vfs_nfs, OID_AUTO, dssameconn, CTLFLAG_RW, /* * Global variables */ +extern struct nfsstatsv1 nfsstatsv1; extern int nfs_numnfscbd; extern struct timeval nfsboottime; extern u_int32_t newnfs_false, newnfs_true; @@ -6177,6 +6178,8 @@ nfsrpc_readds(vnode_t vp, struct uio *uiop, nfsv4stateid_t *stateidp, int *eofp, } else { nfscl_reqstart(nd, NFSPROC_READ, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_READ]); + NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_READDS]); NFSCL_DEBUG(4, "nfsrpc_readds: vers3\n"); } NFSM_BUILD(tl, uint32_t *, NFSX_UNSIGNED * 3); @@ -6252,6 +6255,8 @@ nfsrpc_writeds(vnode_t vp, struct uio *uiop, int *iomode, int *must_commit, } else { nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITE]); + NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITEDS]); NFSCL_DEBUG(4, "nfsrpc_writeds: vers3\n"); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 3 * NFSX_UNSIGNED); } @@ -6378,6 +6383,8 @@ nfsrpc_writedsmir(vnode_t vp, int *iomode, int *must_commit, } else { nfscl_reqstart(nd, NFSPROC_WRITE, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITE]); + NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_WRITEDS]); NFSCL_DEBUG(4, "nfsrpc_writedsmir: vers3\n"); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + 3 * NFSX_UNSIGNED); } @@ -6600,9 +6607,12 @@ nfsrpc_commitds(vnode_t vp, uint64_t offset, int cnt, struct nfsclds *dsp, nfscl_reqstart(nd, NFSPROC_COMMITDS, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); vers = NFS_VER4; - } else + } else { nfscl_reqstart(nd, NFSPROC_COMMIT, nmp, fhp->nfh_fh, fhp->nfh_len, NULL, &dsp->nfsclds_sess, vers, minorvers); + NFSDECRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_COMMIT]); + NFSINCRGLOBAL(nfsstatsv1.rpccnt[NFSPROC_COMMITDS]); + } NFSCL_DEBUG(4, "nfsrpc_commitds: vers=%d minvers=%d\n", vers, minorvers); NFSM_BUILD(tl, uint32_t *, NFSX_HYPER + NFSX_UNSIGNED);