svn commit: r236241 - in projects/nfsv4.1-client/sys/fs: nfs
nfsclient
Rick Macklem
rmacklem at FreeBSD.org
Tue May 29 15:50:45 UTC 2012
Author: rmacklem
Date: Tue May 29 15:50:44 2012
New Revision: 236241
URL: http://svn.freebsd.org/changeset/base/236241
Log:
Modify the NFSv4 client to prepare it for implementation of
Commit through DS for pNFS. This consists of moving the compare/copy
of the commit verifier down into the function that does the
Commit RPC through the MDS.
Modified:
projects/nfsv4.1-client/sys/fs/nfs/nfs_var.h
projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clrpcops.c
projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clvnops.c
Modified: projects/nfsv4.1-client/sys/fs/nfs/nfs_var.h
==============================================================================
--- projects/nfsv4.1-client/sys/fs/nfs/nfs_var.h Tue May 29 15:41:20 2012 (r236240)
+++ projects/nfsv4.1-client/sys/fs/nfs/nfs_var.h Tue May 29 15:50:44 2012 (r236241)
@@ -411,7 +411,7 @@ int nfsrpc_readdir(vnode_t, struct uio *
int nfsrpc_readdirplus(vnode_t, struct uio *, nfsuint64 *,
struct ucred *, NFSPROC_T *, struct nfsvattr *, int *, int *, void *);
int nfsrpc_commit(vnode_t, u_quad_t, int, struct ucred *,
- NFSPROC_T *, u_char *, struct nfsvattr *, int *, void *);
+ NFSPROC_T *, struct nfsvattr *, int *, void *);
int nfsrpc_advlock(vnode_t, off_t, int, struct flock *, int,
struct ucred *, NFSPROC_T *, void *, int);
int nfsrpc_lockt(struct nfsrv_descript *, vnode_t,
Modified: projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clrpcops.c Tue May 29 15:41:20 2012 (r236240)
+++ projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clrpcops.c Tue May 29 15:50:44 2012 (r236241)
@@ -3550,13 +3550,13 @@ nfsmout:
*/
APPLESTATIC int
nfsrpc_commit(vnode_t vp, u_quad_t offset, int cnt, struct ucred *cred,
- NFSPROC_T *p, u_char *verfp, struct nfsvattr *nap, int *attrflagp,
- void *stuff)
+ NFSPROC_T *p, struct nfsvattr *nap, int *attrflagp, void *stuff)
{
u_int32_t *tl;
struct nfsrv_descript nfsd, *nd = &nfsd;
nfsattrbit_t attrbits;
int error;
+ struct nfsmount *nmp = VFSTONFS(vnode_mount(vp));
*attrflagp = 0;
NFSCL_REQSTART(nd, NFSPROC_COMMIT, vp);
@@ -3579,7 +3579,12 @@ nfsrpc_commit(vnode_t vp, u_quad_t offse
error = nfscl_wcc_data(nd, vp, nap, attrflagp, NULL, stuff);
if (!error && !nd->nd_repstat) {
NFSM_DISSECT(tl, u_int32_t *, NFSX_VERF);
- NFSBCOPY((caddr_t)tl, verfp, NFSX_VERF);
+ NFSLOCKMNT(nmp);
+ if (NFSBCMP(nmp->nm_verf, tl, NFSX_VERF)) {
+ NFSBCOPY(tl, nmp->nm_verf, NFSX_VERF);
+ nd->nd_repstat = NFSERR_STALEWRITEVERF;
+ }
+ NFSUNLOCKMNT(nmp);
if (nd->nd_flag & ND_NFSV4)
error = nfscl_postop_attr(nd, nap, attrflagp, stuff);
}
Modified: projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clvnops.c Tue May 29 15:41:20 2012 (r236240)
+++ projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clvnops.c Tue May 29 15:50:44 2012 (r236241)
@@ -2539,7 +2539,6 @@ ncl_commit(struct vnode *vp, u_quad_t of
struct nfsvattr nfsva;
struct nfsmount *nmp = VFSTONFS(vp->v_mount);
int error, attrflag;
- u_char verf[NFSX_VERF];
mtx_lock(&nmp->nm_mtx);
if ((nmp->nm_state & NFSSTA_HASWRITEVERF) == 0) {
@@ -2547,21 +2546,13 @@ ncl_commit(struct vnode *vp, u_quad_t of
return (0);
}
mtx_unlock(&nmp->nm_mtx);
- error = nfsrpc_commit(vp, offset, cnt, cred, td, verf, &nfsva,
+ error = nfsrpc_commit(vp, offset, cnt, cred, td, &nfsva,
&attrflag, NULL);
- if (!error) {
- mtx_lock(&nmp->nm_mtx);
- if (NFSBCMP((caddr_t)nmp->nm_verf, verf, NFSX_VERF)) {
- NFSBCOPY(verf, (caddr_t)nmp->nm_verf, NFSX_VERF);
- error = NFSERR_STALEWRITEVERF;
- }
- mtx_unlock(&nmp->nm_mtx);
- if (!error && attrflag)
- (void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL,
- 0, 1);
- } else if (NFS_ISV4(vp)) {
+ if (attrflag != 0)
+ (void) nfscl_loadattrcache(&vp, &nfsva, NULL, NULL,
+ 0, 1);
+ if (error != 0 && NFS_ISV4(vp))
error = nfscl_maperr(td, error, (uid_t)0, (gid_t)0);
- }
return (error);
}
More information about the svn-src-projects
mailing list