diff options
author | phk <phk@FreeBSD.org> | 2005-02-22 15:06:30 +0000 |
---|---|---|
committer | phk <phk@FreeBSD.org> | 2005-02-22 15:06:30 +0000 |
commit | ef9c88d1506f8edc31f314cc3a142fb14af594e5 (patch) | |
tree | f3ff566b979625e2dc748fbda39a305c42f91452 /sys/fs/smbfs/smbfs_vnops.c | |
parent | 266c8910e6e289a9b9850247e3302423cab994ad (diff) | |
download | FreeBSD-src-ef9c88d1506f8edc31f314cc3a142fb14af594e5.zip FreeBSD-src-ef9c88d1506f8edc31f314cc3a142fb14af594e5.tar.gz |
vp->v_id is a private field for the vfs namecache and it is a big mistake
that NFS ever started using it and an even bigger that it got copied&pasted
to nwfs and smbfs.
Replace with use of vhold()/vdrop().
Diffstat (limited to 'sys/fs/smbfs/smbfs_vnops.c')
-rw-r--r-- | sys/fs/smbfs/smbfs_vnops.c | 49 |
1 files changed, 24 insertions, 25 deletions
diff --git a/sys/fs/smbfs/smbfs_vnops.c b/sys/fs/smbfs/smbfs_vnops.c index b75abd7..6125b89 100644 --- a/sys/fs/smbfs/smbfs_vnops.c +++ b/sys/fs/smbfs/smbfs_vnops.c @@ -1138,11 +1138,10 @@ smbfs_lookup(ap) return error; if (error) { /* name was found */ struct vattr vattr; - int vpid; + vhold(*vpp); vp = *vpp; mp_fixme("Unlocked v_id access."); - vpid = vp->v_id; if (dvp == vp) { /* lookup on current */ vref(vp); error = 0; @@ -1165,36 +1164,36 @@ smbfs_lookup(ap) } if (!error) { killit = 0; - if (vpid == vp->v_id) { - error = VOP_GETATTR(vp, &vattr, cnp->cn_cred, td); - /* - * If the file type on the server is inconsistent - * with what it was when we created the vnode, - * kill the bogus vnode now and fall through to - * the code below to create a new one with the - * right type. - */ - if (error == 0 && - ((vp->v_type == VDIR && - (VTOSMB(vp)->n_dosattr & SMB_FA_DIR) == 0) || - (vp->v_type == VREG && - (VTOSMB(vp)->n_dosattr & SMB_FA_DIR) != 0))) - killit = 1; - else if (error == 0 - /* && vattr.va_ctime.tv_sec == VTOSMB(vp)->n_ctime*/) { - if (nameiop != LOOKUP && islastcn) - cnp->cn_flags |= SAVENAME; - SMBVDEBUG("use cached vnode\n"); - return (0); - } - cache_purge(vp); + error = VOP_GETATTR(vp, &vattr, cnp->cn_cred, td); + /* + * If the file type on the server is inconsistent + * with what it was when we created the vnode, + * kill the bogus vnode now and fall through to + * the code below to create a new one with the + * right type. + */ + if (error == 0 && + ((vp->v_type == VDIR && + (VTOSMB(vp)->n_dosattr & SMB_FA_DIR) == 0) || + (vp->v_type == VREG && + (VTOSMB(vp)->n_dosattr & SMB_FA_DIR) != 0))) + killit = 1; + else if (error == 0 + /* && vattr.va_ctime.tv_sec == VTOSMB(vp)->n_ctime*/) { + if (nameiop != LOOKUP && islastcn) + cnp->cn_flags |= SAVENAME; + SMBVDEBUG("use cached vnode\n"); + vdrop(vp); + return (0); } + cache_purge(vp); vput(vp); if (killit) vgone(vp); if (lockparent && dvp != vp && islastcn) VOP_UNLOCK(dvp, 0, td); } + vdrop(vp); error = vn_lock(dvp, LK_EXCLUSIVE, td); *vpp = NULLVP; if (error) { |