mirror of
https://github.com/opnsense/src.git
synced 2026-06-08 16:22:46 -04:00
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
This commit is contained in:
parent
13686dffbb
commit
c04199affe
2 changed files with 12 additions and 1 deletions
|
|
@ -1006,6 +1006,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.
|
||||
|
|
|
|||
|
|
@ -65,6 +65,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;
|
||||
|
|
@ -6320,6 +6321,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);
|
||||
|
|
@ -6395,6 +6398,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);
|
||||
}
|
||||
|
|
@ -6522,6 +6527,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);
|
||||
}
|
||||
|
|
@ -6737,9 +6744,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);
|
||||
|
|
|
|||
Loading…
Reference in a new issue