tech-kern archive

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

vcache_get() usage



Hi

Introduction of vcache in PUFFS introduced a few bugs. The later is
fixed by the patch below: when we look for a cookie that has been
reclaimed, puffs_cookie2vnode() uses vcache_get() and gets a new VNON
vnode, which should obviouly not be used for that cookie. vrele() is
called to discard the new vnode, which causes a VOP_INACTIVE().
puffs_vnop_inactive() the sends a request with a stale cookie to the
filesystem.

The patch below tests for VNON in puffs_vnop_inactive(), but the code
wold be much cleaner if we could tell vcache_get() we do not want a new
vnode. Is there a way to do that?

Index: puffs_vnops.c
===================================================================
RCS file: /cvsroot/src/sys/fs/puffs/puffs_vnops.c,v
retrieving revision 1.196
diff -U4 -r1.196 puffs_vnops.c
--- puffs_vnops.c       31 Oct 2014 13:52:41 -0000      1.196
+++ puffs_vnops.c       3 Nov 2014 17:44:40 -0000
@@ -1329,8 +1329,20 @@
        struct puffs_mount *pmp = MPTOPUFFSMP(vp->v_mount);
        struct puffs_node *pnode;
        bool recycle = false;

+       /*
+        * When puffs_cookie2vnode() misses an entry, vcache_get()
+        * creates a new node (puffs_vfsop_loadvnode being called to
+        * initialize the PUFFS part), then it discovers it is VNON,
+        * and tries to vrele() it. This leads us there, while the
+        * cookie was stall and the node likely already reclaimed.
+        */
+       if (vp->v_type == VNON) {
+               VOP_UNLOCK(vp);
+               return 0;
+       }
+
        pnode = vp->v_data;
        mutex_enter(&pnode->pn_sizemtx);

        if (doinact(pmp, pnode->pn_stat & PNODE_DOINACT)) {



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


Home | Main Index | Thread Index | Old Index