Source-Changes-HG archive

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

[src/trunk]: src/sys/fs/puffs Since VOP_GETATTR() does not require a locked v...



details:   https://anonhg.NetBSD.org/src/rev/9978905b1b4a
branches:  trunk
changeset: 750791:9978905b1b4a
user:      pooka <pooka%NetBSD.org@localhost>
date:      Thu Jan 14 14:44:13 2010 +0000

description:
Since VOP_GETATTR() does not require a locked vnode, resolve and
reference the puffs_node before sending the request to the file
server.  This diminishes the window where the inode can be reclaimed
and be invalidated before it is accessed (but does not completely
eliminate the race, as that is a caller problem which we cannot
fix here).

diffstat:

 sys/fs/puffs/puffs_vnops.c |  9 +++++----
 1 files changed, 5 insertions(+), 4 deletions(-)

diffs (46 lines):

diff -r 573bb31a1070 -r 9978905b1b4a sys/fs/puffs/puffs_vnops.c
--- a/sys/fs/puffs/puffs_vnops.c        Thu Jan 14 13:47:41 2010 +0000
+++ b/sys/fs/puffs/puffs_vnops.c        Thu Jan 14 14:44:13 2010 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: puffs_vnops.c,v 1.141 2009/12/04 20:26:35 pooka Exp $  */
+/*     $NetBSD: puffs_vnops.c,v 1.142 2010/01/14 14:44:13 pooka Exp $  */
 
 /*
  * Copyright (c) 2005, 2006, 2007  Antti Kantee.  All Rights Reserved.
@@ -30,7 +30,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.141 2009/12/04 20:26:35 pooka Exp $");
+__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.142 2010/01/14 14:44:13 pooka Exp $");
 
 #include <sys/param.h>
 #include <sys/buf.h>
@@ -830,9 +830,10 @@
        struct mount *mp = vp->v_mount;
        struct puffs_mount *pmp = MPTOPUFFSMP(mp);
        struct vattr *vap, *rvap;
-       struct puffs_node *pn;
+       struct puffs_node *pn = VPTOPP(vp);
        int error = 0;
 
+       REFPN(pn);
        vap = ap->a_vap;
 
        PUFFS_MSG_ALLOC(vn, getattr);
@@ -863,7 +864,6 @@
        (void) memcpy(vap, rvap, sizeof(struct vattr));
        vap->va_fsid = mp->mnt_stat.f_fsidx.__fsid_val[0];
 
-       pn = VPTOPP(vp);
        if (pn->pn_stat & PNODE_METACACHE_ATIME)
                vap->va_atime = pn->pn_mc_atime;
        if (pn->pn_stat & PNODE_METACACHE_CTIME)
@@ -881,6 +881,7 @@
        }
 
  out:
+       puffs_releasenode(pn);
        PUFFS_MSG_RELEASE(getattr);
        return error;
 }



Home | Main Index | Thread Index | Old Index