diff options
author | bde <bde@FreeBSD.org> | 1996-03-29 12:30:30 +0000 |
---|---|---|
committer | bde <bde@FreeBSD.org> | 1996-03-29 12:30:30 +0000 |
commit | a0131ad117d3896d0855eff1a2bca37c799d82c5 (patch) | |
tree | 596a5e0056f405be954900bed58a8c7ad36864d2 /sys/ufs | |
parent | 6043e951134d0500c4b3103446493f255d2b309d (diff) | |
download | FreeBSD-src-a0131ad117d3896d0855eff1a2bca37c799d82c5.zip FreeBSD-src-a0131ad117d3896d0855eff1a2bca37c799d82c5.tar.gz |
Fixed reference counting related to relookup(). relookup() must
be called with the directory referenced, and this reference will
be dropped iff relookup() fails, so the value returned must not be
ignored.
Reviewed by: davidg
Diffstat (limited to 'sys/ufs')
-rw-r--r-- | sys/ufs/ufs/ufs_vnops.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 4b60aaa..e1c26fd 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -36,7 +36,7 @@ * SUCH DAMAGE. * * @(#)ufs_vnops.c 8.10 (Berkeley) 4/1/94 - * $Id: ufs_vnops.c,v 1.36 1996/01/05 18:31:58 wollman Exp $ + * $Id: ufs_vnops.c,v 1.37 1996/01/19 03:59:28 dyson Exp $ */ #include "opt_quota.h" @@ -865,7 +865,10 @@ abortit: if ((fcnp->cn_flags & SAVESTART) == 0) panic("ufs_rename: lost from startdir"); fcnp->cn_nameiop = DELETE; - (void) relookup(fdvp, &fvp, fcnp); + VREF(fdvp); + error = relookup(fdvp, &fvp, fcnp); + if (error == 0) + vrele(fdvp); return (VOP_REMOVE(fdvp, fvp, fcnp)); } error = VOP_LOCK(fvp); @@ -951,9 +954,11 @@ abortit: goto out; if ((tcnp->cn_flags & SAVESTART) == 0) panic("ufs_rename: lost to startdir"); + VREF(tdvp); error = relookup(tdvp, &tvp, tcnp); if (error) goto out; + vrele(tdvp); dp = VTOI(tdvp); xp = NULL; if (tvp) @@ -1100,7 +1105,10 @@ abortit: fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; if ((fcnp->cn_flags & SAVESTART) == 0) panic("ufs_rename: lost from startdir"); - (void) relookup(fdvp, &fvp, fcnp); + VREF(fdvp); + error = relookup(fdvp, &fvp, fcnp); + if (error == 0) + vrele(fdvp); if (fvp != NULL) { xp = VTOI(fvp); dp = VTOI(fdvp); |