tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: PUFFS and existing file that get ENOENT



YAMAMOTO Takashi <yamt%mwd.biglobe.ne.jp@localhost> wrote:

> it should retry from puffs_cookie2pnode in that case.

Here is a patch that works around the problem (I initially had printf to
check it did go through the ENOENT case and it does). I am about to
commit that and pullup to netbsd-5, except if there are comments.

Index: sys/fs/puffs/puffs_node.c
===================================================================
RCS file: /cvsroot/src/sys/fs/puffs/puffs_node.c,v
retrieving revision 1.13.10.3
diff -U 4 -r1.13.10.3 puffs_node.c
--- sys/fs/puffs/puffs_node.c   2 Nov 2011 20:11:12 -0000
1.13.10.3
+++ sys/fs/puffs/puffs_node.c   18 Jan 2012 03:03:25 -0000
@@ -320,10 +320,18 @@
        vp = pmp->pmp_root;
        if (vp) {
                mutex_enter(&vp->v_interlock);
                mutex_exit(&pmp->pmp_lock);
-               if (vget(vp, LK_INTERLOCK) == 0)
+               switch (vget(vp, LK_INTERLOCK)) {
+               case ENOENT:
+                       goto retry;
+                       break;
+               case 0:
                        return 0;
+                       break;
+               default:
+                       break;
+               }
        } else
                mutex_exit(&pmp->pmp_lock);
 
        /*
@@ -386,8 +394,9 @@
                *vpp = pmp->pmp_root;
                return 0;
        }
 
+retry_vget:
        mutex_enter(&pmp->pmp_lock);
        pnode = puffs_cookie2pnode(pmp, ck);
        if (pnode == NULL) {
                if (willcreate) {
@@ -405,10 +414,18 @@
 
        vgetflags = LK_INTERLOCK;
        if (lock)
                vgetflags |= LK_EXCLUSIVE | LK_RETRY;
-       if ((rv = vget(vp, vgetflags)))
+       switch (rv = vget(vp, vgetflags)) {
+       case ENOENT:
+               goto retry_vget;
+               break;
+       case 0:
+               break;
+       default:
                return rv;
+               break;
+       }
 
        *vpp = vp;
        return 0;
 }

-- 
Emmanuel Dreyfus
http://hcpnet.free.fr/pubz
manu%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index