PERFORCE change 194958 for review

Ilya Putsikau ilya at FreeBSD.org
Sun Jun 19 09:36:41 UTC 2011


http://p4web.freebsd.org/@@194958?ac=10

Change 194958 by ilya at ilya_triton2011 on 2011/06/19 09:36:00

	Remove parent vnode reference from fuse node
	Set parent_nid in fuse_vnode_get

Affected files ...

.. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_node.c#4 edit
.. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_node.h#6 edit
.. //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vnops.c#17 edit

Differences ...

==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_node.c#4 (text+ko) ====

@@ -160,6 +160,11 @@
         return err;
     }
 
+    if (dvp != NULL && vnode_vtype(*vpp) == VDIR) {
+	    MPASS((cnp->cn_flags & ISDOTDOT) == 0);
+	    MPASS(!(cnp->cn_namelen == 1 && cnp->cn_nameptr[0] == '.'));
+	    VTOFUD(*vpp)->parent_nid = VTOI(dvp);
+    }
     if (cnp != NULL) {
         cache_enter(dvp, *vpp, cnp);
     }

==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_node.h#6 (text+ko) ====

@@ -41,9 +41,6 @@
      */
     struct sx  truncatelock;
 
-    struct vnode *c_vp;
-    /* XXXIP reference is very likely to be stale, it's not updated in rename() */
-    struct vnode *parent;
     off_t      filesize; 
     off_t      newfilesize;
 

==== //depot/projects/soc2011/ilya_fuse/fuse_module/fuse_vnops.c#17 (text+ko) ====

@@ -601,11 +601,10 @@
     int err                   = 0;
     int lookup_err            = 0;
     struct vnode *vp          = NULL;
-    struct vnode *pdp         = NULL;
     struct fuse_attr *fattr   = NULL;
     struct fuse_dispatcher fdi;
     enum fuse_opcode op;
-    uint64_t nid, parent_nid;
+    uint64_t nid;
     struct fuse_access_param facp;
     uint64_t size = 0;
 
@@ -638,15 +637,15 @@
     }
 
     if (flags & ISDOTDOT) {
-        pdp = VTOFUD(dvp)->parent;
-        nid = VTOI(pdp);
-        parent_nid = VTOFUD(dvp)->parent_nid;
+        nid = VTOFUD(dvp)->parent_nid;
+        if (nid == 0) {
+            return ENOENT;
+        }
         fdisp_init(&fdi, 0);
         op = FUSE_GETATTR;
         goto calldaemon;
     } else if (cnp->cn_namelen == 1 && *(cnp->cn_nameptr) == '.') {
         nid = VTOI(dvp);
-        parent_nid = VTOFUD(dvp)->parent_nid;
         fdisp_init(&fdi, 0);
         op = FUSE_GETATTR;
         goto calldaemon;
@@ -670,7 +669,6 @@
     }
 
     nid = VTOI(dvp);
-    parent_nid = VTOI(dvp);
     fdisp_init(&fdi, cnp->cn_namelen + 1);
     op = FUSE_LOOKUP;
 
@@ -867,8 +865,20 @@
         }
 
         if (flags & ISDOTDOT) {
-            vref(pdp);
-            *vpp = pdp;
+            int ltype;
+
+            ltype = VOP_ISLOCKED(dvp);
+            VOP_UNLOCK(dvp, 0);
+            err = fuse_vnode_get(vnode_mount(dvp),
+                                 nid,
+                                 NULL,
+                                 &vp,
+                                 cnp,
+                                 IFTOVT(fattr->mode),
+                                 0);
+            vn_lock(dvp, ltype | LK_RETRY);
+            vref(vp);
+            *vpp = vp;
         } else if (nid == VTOI(dvp)) {
             vref(dvp);
             *vpp = dvp;
@@ -884,7 +894,7 @@
                 goto out;
             }
             if (vnode_vtype(vp) == VDIR) {
-                VTOFUD(vp)->parent = dvp;
+                VTOFUD(vp)->parent_nid = VTOI(dvp);
                 //SETPARENT(vp, dvp);
             }
             *vpp = vp;


More information about the p4-projects mailing list