From owner-svn-src-projects@FreeBSD.ORG Sun Feb 5 03:23:27 2012 Return-Path: Delivered-To: svn-src-projects@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 0A790106566B; Sun, 5 Feb 2012 03:23:27 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:4f8:fff6::2c]) by mx1.freebsd.org (Postfix) with ESMTP id E20728FC17; Sun, 5 Feb 2012 03:23:26 +0000 (UTC) Received: from svn.freebsd.org (localhost [127.0.0.1]) by svn.freebsd.org (8.14.4/8.14.4) with ESMTP id q153NQ2i064295; Sun, 5 Feb 2012 03:23:26 GMT (envelope-from rmacklem@svn.freebsd.org) Received: (from rmacklem@localhost) by svn.freebsd.org (8.14.4/8.14.4/Submit) id q153NQtu064291; Sun, 5 Feb 2012 03:23:26 GMT (envelope-from rmacklem@svn.freebsd.org) Message-Id: <201202050323.q153NQtu064291@svn.freebsd.org> From: Rick Macklem Date: Sun, 5 Feb 2012 03:23:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-projects@freebsd.org X-SVN-Group: projects MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Cc: Subject: svn commit: r231005 - in projects/nfsv4.1-client/sys/fs: nfs nfsclient X-BeenThere: svn-src-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "SVN commit messages for the src " projects" tree" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 05 Feb 2012 03:23:27 -0000 Author: rmacklem Date: Sun Feb 5 03:23:26 2012 New Revision: 231005 URL: http://svn.freebsd.org/changeset/base/231005 Log: Add an argument to nfscl_getstateid() to indicate it if it is being called to get a stateid for an I/O operation to be done on a DS. This is necessary, since the rules for what kind of stateid that can be used is different for a DS than against an MDS/non-MDS NFSv4 server. 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_clstate.c Modified: projects/nfsv4.1-client/sys/fs/nfs/nfs_var.h ============================================================================== --- projects/nfsv4.1-client/sys/fs/nfs/nfs_var.h Sun Feb 5 01:57:31 2012 (r231004) +++ projects/nfsv4.1-client/sys/fs/nfs/nfs_var.h Sun Feb 5 03:23:26 2012 (r231005) @@ -460,7 +460,7 @@ int nfsrpc_reclaimcomplete(struct nfsmou int nfscl_open(vnode_t, u_int8_t *, int, u_int32_t, int, struct ucred *, NFSPROC_T *, struct nfsclowner **, struct nfsclopen **, int *, int *, int); -int nfscl_getstateid(vnode_t, u_int8_t *, int, u_int32_t, struct ucred *, +int nfscl_getstateid(vnode_t, u_int8_t *, int, u_int32_t, int, struct ucred *, NFSPROC_T *, nfsv4stateid_t *, void **); void nfscl_ownerrelease(struct nfsclowner *, int, int, int); void nfscl_openrelease(struct nfsclopen *, int, int); Modified: projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clrpcops.c ============================================================================== --- projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clrpcops.c Sun Feb 5 01:57:31 2012 (r231004) +++ projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clrpcops.c Sun Feb 5 03:23:26 2012 (r231005) @@ -1026,7 +1026,7 @@ nfsrpc_setattr(vnode_t vp, struct vattr if (NFSHASNFSV4(nmp)) { nfhp = VTONFS(vp)->n_fhp; error = nfscl_getstateid(vp, nfhp->nfh_fh, - nfhp->nfh_len, mode, cred, p, &stateid, &lckp); + nfhp->nfh_len, mode, 0, cred, p, &stateid, &lckp); if (error && vnode_vtype(vp) == VREG && (mode == NFSV4OPEN_ACCESSWRITE || nfstest_openallsetattr)) { @@ -1043,7 +1043,7 @@ nfsrpc_setattr(vnode_t vp, struct vattr if (!openerr) (void) nfscl_getstateid(vp, nfhp->nfh_fh, nfhp->nfh_len, - mode, cred, p, &stateid, &lckp); + mode, 0, cred, p, &stateid, &lckp); } } if (vap != NULL) @@ -1296,7 +1296,8 @@ nfsrpc_read(vnode_t vp, struct uio *uiop lckp = NULL; if (NFSHASNFSV4(nmp)) (void)nfscl_getstateid(vp, nfhp->nfh_fh, nfhp->nfh_len, - NFSV4OPEN_ACCESSREAD, newcred, p, &stateid, &lckp); + NFSV4OPEN_ACCESSREAD, 0, newcred, p, &stateid, + &lckp); error = nfsrpc_readrpc(vp, uiop, newcred, &stateid, p, nap, attrflagp, stuff); if (error == NFSERR_STALESTATEID || error == NFSERR_BADSESSION) @@ -1450,7 +1451,8 @@ nfsrpc_write(vnode_t vp, struct uio *uio nostateid = 0; if (NFSHASNFSV4(nmp)) { (void)nfscl_getstateid(vp, nfhp->nfh_fh, nfhp->nfh_len, - NFSV4OPEN_ACCESSWRITE, newcred, p, &stateid, &lckp); + NFSV4OPEN_ACCESSWRITE, 0, newcred, p, &stateid, + &lckp); if (stateid.other[0] == 0 && stateid.other[1] == 0 && stateid.other[2] == 0) { nostateid = 1; Modified: projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clstate.c ============================================================================== --- projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clstate.c Sun Feb 5 01:57:31 2012 (r231004) +++ projects/nfsv4.1-client/sys/fs/nfsclient/nfs_clstate.c Sun Feb 5 03:23:26 2012 (r231005) @@ -461,7 +461,7 @@ nfscl_finddeleg(struct nfsclclient *clp, */ APPLESTATIC int nfscl_getstateid(vnode_t vp, u_int8_t *nfhp, int fhlen, u_int32_t mode, - struct ucred *cred, NFSPROC_T *p, nfsv4stateid_t *stateidp, + int fords, struct ucred *cred, NFSPROC_T *p, nfsv4stateid_t *stateidp, void **lckpp) { struct nfsclclient *clp; @@ -476,11 +476,14 @@ nfscl_getstateid(vnode_t vp, u_int8_t *n *lckpp = NULL; /* * Initially, just set the special stateid of all zeros. + * (Don't do this for a DS, since the special stateid can't be used.) */ - stateidp->seqid = 0; - stateidp->other[0] = 0; - stateidp->other[1] = 0; - stateidp->other[2] = 0; + if (fords == 0) { + stateidp->seqid = 0; + stateidp->other[0] = 0; + stateidp->other[1] = 0; + stateidp->other[2] = 0; + } if (vnode_vtype(vp) != VREG) return (EISDIR); np = VTONFS(vp); @@ -536,7 +539,8 @@ nfscl_getstateid(vnode_t vp, u_int8_t *n lp = NULL; error = nfscl_getopen(&clp->nfsc_owner, nfhp, fhlen, own, own, mode, &lp, &op); - if (error == 0 && lp != NULL) { + if (error == 0 && lp != NULL && fords == 0) { + /* Don't return a lock stateid for a DS. */ stateidp->seqid = lp->nfsl_stateid.seqid; stateidp->other[0] =