- Remove redundant vput() before vgone().

- Avoid unnecessary mutex_exit() in smbfs_node_alloc().
- Set NGONE bit to from-name vnode to invalidate the smbnode cache.
This commit is contained in:
nakayama 2012-11-29 11:58:49 +00:00
parent 5c33580cf9
commit 33e8b488e1
2 changed files with 12 additions and 8 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_node.c,v 1.48 2012/11/28 13:34:24 nakayama Exp $ */
/* $NetBSD: smbfs_node.c,v 1.49 2012/11/29 11:58:49 nakayama Exp $ */
/*
* Copyright (c) 2000-2001 Boris Popov
@ -35,7 +35,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.48 2012/11/28 13:34:24 nakayama Exp $");
__KERNEL_RCSID(0, "$NetBSD: smbfs_node.c,v 1.49 2012/11/29 11:58:49 nakayama Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -150,15 +150,16 @@ retry:
*/
if ((vp->v_type == VDIR && (np->n_dosattr & SMB_FA_DIR) == 0) ||
(vp->v_type == VREG && (np->n_dosattr & SMB_FA_DIR) != 0)) {
vput(vp);
VOP_UNLOCK(vp);
vgone(vp);
break;
goto allocnew;
}
*vpp = vp;
return (0);
}
mutex_exit(&smp->sm_hashlock);
allocnew:
/*
* If we don't have node attributes, then it is an explicit lookup
* for an existing vnode.

View File

@ -1,4 +1,4 @@
/* $NetBSD: smbfs_vnops.c,v 1.83 2012/11/28 13:34:24 nakayama Exp $ */
/* $NetBSD: smbfs_vnops.c,v 1.84 2012/11/29 11:58:49 nakayama Exp $ */
/*-
* Copyright (c) 2003 The NetBSD Foundation, Inc.
@ -64,7 +64,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: smbfs_vnops.c,v 1.83 2012/11/28 13:34:24 nakayama Exp $");
__KERNEL_RCSID(0, "$NetBSD: smbfs_vnops.c,v 1.84 2012/11/29 11:58:49 nakayama Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -725,6 +725,7 @@ smbfs_rename(void *v)
}
error = smbfs_smb_rename(VTOSMB(fvp), VTOSMB(tdvp),
tcnp->cn_nameptr, tcnp->cn_namelen, &scred);
VTOSMB(fvp)->n_flag |= NGONE;
VN_KNOTE(fdvp, NOTE_WRITE);
VN_KNOTE(fvp, NOTE_RENAME);
}
@ -1270,9 +1271,11 @@ smbfs_lookup(void *v)
cache_purge(newvp);
if (newvp != dvp) {
vput(newvp);
if (killit)
if (killit) {
VOP_UNLOCK(newvp);
vgone(newvp);
} else
vput(newvp);
} else
vrele(newvp);
*vpp = NULLVP;