Author: rmacklem
Date: Sat Apr 30 01:29:18 2011
New Revision: 221238
URL: http://svn.freebsd.org/changeset/base/221238

Log:
  MFC: r220732
  Add a lktype flags argument to nfscl_nget() and ncl_nget() in the
  experimental NFS client so that its nfs_lookup() function can use
  cn_lkflags in a manner analagous to the regular NFS client.

Modified:
  stable/8/sys/fs/nfs/nfs_var.h
  stable/8/sys/fs/nfsclient/nfs_clnode.c
  stable/8/sys/fs/nfsclient/nfs_clport.c
  stable/8/sys/fs/nfsclient/nfs_clrpcops.c
  stable/8/sys/fs/nfsclient/nfs_clvfsops.c
  stable/8/sys/fs/nfsclient/nfs_clvnops.c
  stable/8/sys/fs/nfsclient/nfsnode.h
Directory Properties:
  stable/8/sys/   (props changed)
  stable/8/sys/amd64/include/xen/   (props changed)
  stable/8/sys/cddl/contrib/opensolaris/   (props changed)
  stable/8/sys/contrib/dev/acpica/   (props changed)
  stable/8/sys/contrib/pf/   (props changed)

Modified: stable/8/sys/fs/nfs/nfs_var.h
==============================================================================
--- stable/8/sys/fs/nfs/nfs_var.h       Sat Apr 30 01:16:19 2011        
(r221237)
+++ stable/8/sys/fs/nfs/nfs_var.h       Sat Apr 30 01:29:18 2011        
(r221238)
@@ -487,7 +487,7 @@ void nfscl_cleanup(NFSPROC_T *);
 
 /* nfs_clport.c */
 int nfscl_nget(mount_t, vnode_t, struct nfsfh *,
-    struct componentname *, NFSPROC_T *, struct nfsnode **, void *);
+    struct componentname *, NFSPROC_T *, struct nfsnode **, void *, int);
 NFSPROC_T *nfscl_getparent(NFSPROC_T *);
 void nfscl_start_renewthread(struct nfsclclient *);
 void nfscl_loadsbinfo(struct nfsmount *, struct nfsstatfs *, void *);

Modified: stable/8/sys/fs/nfsclient/nfs_clnode.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clnode.c      Sat Apr 30 01:16:19 2011        
(r221237)
+++ stable/8/sys/fs/nfsclient/nfs_clnode.c      Sat Apr 30 01:29:18 2011        
(r221238)
@@ -86,7 +86,8 @@ ncl_nhuninit(void)
  * nfsnode structure is returned.
  */
 int
-ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize, struct nfsnode **npp)
+ncl_nget(struct mount *mntp, u_int8_t *fhp, int fhsize, struct nfsnode **npp,
+    int lkflags)
 {
        struct thread *td = curthread;  /* XXX */
        struct nfsnode *np;
@@ -106,7 +107,7 @@ ncl_nget(struct mount *mntp, u_int8_t *f
            M_NFSFH, M_WAITOK);
        bcopy(fhp, &nfhp->nfh_fh[0], fhsize);
        nfhp->nfh_len = fhsize;
-       error = vfs_hash_get(mntp, hash, LK_EXCLUSIVE,
+       error = vfs_hash_get(mntp, hash, lkflags,
            td, &nvp, newnfs_vncmpf, nfhp);
        FREE(nfhp, M_NFSFH);
        if (error)
@@ -168,7 +169,7 @@ ncl_nget(struct mount *mntp, u_int8_t *f
                uma_zfree(newnfsnode_zone, np);
                return (error);
        }
-       error = vfs_hash_insert(vp, hash, LK_EXCLUSIVE, 
+       error = vfs_hash_insert(vp, hash, lkflags, 
            td, &nvp, newnfs_vncmpf, np->n_fhp);
        if (error)
                return (error);

Modified: stable/8/sys/fs/nfsclient/nfs_clport.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clport.c      Sat Apr 30 01:16:19 2011        
(r221237)
+++ stable/8/sys/fs/nfsclient/nfs_clport.c      Sat Apr 30 01:29:18 2011        
(r221238)
@@ -85,7 +85,7 @@ newnfs_vncmpf(struct vnode *vp, void *ar
 int
 nfscl_nget(struct mount *mntp, struct vnode *dvp, struct nfsfh *nfhp,
     struct componentname *cnp, struct thread *td, struct nfsnode **npp,
-    void *stuff)
+    void *stuff, int lkflags)
 {
        struct nfsnode *np, *dnp;
        struct vnode *vp, *nvp;
@@ -100,7 +100,7 @@ nfscl_nget(struct mount *mntp, struct vn
 
        hash = fnv_32_buf(nfhp->nfh_fh, nfhp->nfh_len, FNV1_32_INIT);
 
-       error = vfs_hash_get(mntp, hash, LK_EXCLUSIVE,
+       error = vfs_hash_get(mntp, hash, lkflags,
            td, &nvp, newnfs_vncmpf, nfhp);
        if (error == 0 && nvp != NULL) {
                /*
@@ -244,7 +244,7 @@ nfscl_nget(struct mount *mntp, struct vn
                uma_zfree(newnfsnode_zone, np);
                return (error);
        }
-       error = vfs_hash_insert(vp, hash, LK_EXCLUSIVE, 
+       error = vfs_hash_insert(vp, hash, lkflags, 
            td, &nvp, newnfs_vncmpf, nfhp);
        if (error)
                return (error);

Modified: stable/8/sys/fs/nfsclient/nfs_clrpcops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clrpcops.c    Sat Apr 30 01:16:19 2011        
(r221237)
+++ stable/8/sys/fs/nfsclient/nfs_clrpcops.c    Sat Apr 30 01:29:18 2011        
(r221238)
@@ -3271,7 +3271,7 @@ nfsrpc_readdirplus(vnode_t vp, struct ui
                                    np = dnp;
                                } else {
                                    error = nfscl_nget(vnode_mount(vp), vp,
-                                     nfhp, cnp, p, &np, NULL);
+                                     nfhp, cnp, p, &np, NULL, LK_EXCLUSIVE);
                                    if (!error) {
                                        newvp = NFSTOV(np);
                                        unlocknewvp = 1;

Modified: stable/8/sys/fs/nfsclient/nfs_clvfsops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clvfsops.c    Sat Apr 30 01:16:19 2011        
(r221237)
+++ stable/8/sys/fs/nfsclient/nfs_clvfsops.c    Sat Apr 30 01:29:18 2011        
(r221238)
@@ -271,7 +271,7 @@ nfs_statfs(struct mount *mp, struct stat
        error = vfs_busy(mp, MBF_NOWAIT);
        if (error)
                return (error);
-       error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np);
+       error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np, LK_EXCLUSIVE);
        if (error) {
                vfs_unbusy(mp);
                return (error);
@@ -1219,7 +1219,8 @@ mountnfs(struct nfs_args *argp, struct m
                 * by nfs_statfs() before any I/O occurs.
                 */
                mp->mnt_stat.f_iosize = NFS_DIRBLKSIZ;
-               error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np);
+               error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np,
+                   LK_EXCLUSIVE);
                if (error)
                        goto bad;
                *vpp = NFSTOV(np);
@@ -1334,7 +1335,7 @@ nfs_root(struct mount *mp, int flags, st
        int error;
 
        nmp = VFSTONFS(mp);
-       error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np);
+       error = ncl_nget(mp, nmp->nm_fh, nmp->nm_fhsize, &np, flags);
        if (error)
                return error;
        vp = NFSTOV(np);

Modified: stable/8/sys/fs/nfsclient/nfs_clvnops.c
==============================================================================
--- stable/8/sys/fs/nfsclient/nfs_clvnops.c     Sat Apr 30 01:16:19 2011        
(r221237)
+++ stable/8/sys/fs/nfsclient/nfs_clvnops.c     Sat Apr 30 01:29:18 2011        
(r221238)
@@ -1156,7 +1156,8 @@ nfs_lookup(struct vop_lookup_args *ap)
                        FREE((caddr_t)nfhp, M_NFSFH);
                        return (EISDIR);
                }
-               error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL);
+               error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
+                   LK_EXCLUSIVE);
                if (error)
                        return (error);
                newvp = NFSTOV(np);
@@ -1185,7 +1186,8 @@ nfs_lookup(struct vop_lookup_args *ap)
                                return (error);
                }
                VOP_UNLOCK(dvp, 0);
-               error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL);
+               error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
+                   cnp->cn_lkflags);
                if (error == 0)
                        newvp = NFSTOV(np);
                vfs_unbusy(mp);
@@ -1213,7 +1215,8 @@ nfs_lookup(struct vop_lookup_args *ap)
                        (void) nfscl_loadattrcache(&newvp, &nfsva, NULL, NULL,
                            0, 1);
        } else {
-               error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL);
+               error = nfscl_nget(mp, dvp, nfhp, cnp, td, &np, NULL,
+                   cnp->cn_lkflags);
                if (error)
                        return (error);
                newvp = NFSTOV(np);
@@ -1395,7 +1398,7 @@ nfs_mknodrpc(struct vnode *dvp, struct v
                            NULL);
                if (nfhp)
                        error = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp,
-                           cnp->cn_thread, &np, NULL);
+                           cnp->cn_thread, &np, NULL, LK_EXCLUSIVE);
        }
        if (dattrflag)
                (void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
@@ -1497,7 +1500,7 @@ again:
                            NULL);
                if (nfhp != NULL)
                        error = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp,
-                           cnp->cn_thread, &np, NULL);
+                           cnp->cn_thread, &np, NULL, LK_EXCLUSIVE);
        }
        if (dattrflag)
                (void) nfscl_loadattrcache(&dvp, &dnfsva, NULL, NULL, 0, 1);
@@ -1920,7 +1923,7 @@ nfs_symlink(struct vop_symlink_args *ap)
            &nfsva, &nfhp, &attrflag, &dattrflag, NULL);
        if (nfhp) {
                ret = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp, cnp->cn_thread,
-                   &np, NULL);
+                   &np, NULL, LK_EXCLUSIVE);
                if (!ret)
                        newvp = NFSTOV(np);
                else if (!error)
@@ -2003,7 +2006,7 @@ nfs_mkdir(struct vop_mkdir_args *ap)
                dnp->n_attrstamp = 0;
        if (nfhp) {
                ret = nfscl_nget(dvp->v_mount, dvp, nfhp, cnp, cnp->cn_thread,
-                   &np, NULL);
+                   &np, NULL, LK_EXCLUSIVE);
                if (!ret) {
                        newvp = NFSTOV(np);
                        if (attrflag)
@@ -2378,7 +2381,7 @@ printf("replace=%s\n",nnn);
                    cn.cn_nameptr = name;
                    cn.cn_namelen = len;
                    error = nfscl_nget(dvp->v_mount, dvp, nfhp, &cn, td,
-                       &np, NULL);
+                       &np, NULL, LK_EXCLUSIVE);
                    if (error)
                        return (error);
                    newvp = NFSTOV(np);

Modified: stable/8/sys/fs/nfsclient/nfsnode.h
==============================================================================
--- stable/8/sys/fs/nfsclient/nfsnode.h Sat Apr 30 01:16:19 2011        
(r221237)
+++ stable/8/sys/fs/nfsclient/nfsnode.h Sat Apr 30 01:29:18 2011        
(r221238)
@@ -186,7 +186,7 @@ int ncl_reclaim(struct vop_reclaim_args 
 
 /* other stuff */
 int    ncl_removeit(struct sillyrename *, struct vnode *);
-int    ncl_nget(struct mount *, u_int8_t *, int, struct nfsnode **);
+int    ncl_nget(struct mount *, u_int8_t *, int, struct nfsnode **, int);
 nfsuint64 *ncl_getcookie(struct nfsnode *, off_t, int);
 void   ncl_invaldir(struct vnode *);
 int    ncl_upgrade_vnlock(struct vnode *);
_______________________________________________
svn-src-all@freebsd.org mailing list
http://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to