From 13fc7775363cd359ce60924cae590cea40546ddb Mon Sep 17 00:00:00 2001 From: dholland Date: Sun, 2 Jan 2011 05:09:30 +0000 Subject: [PATCH] Remove the special refcount behavior (adding an extra reference to the parent dir) associated with SAVESTART in relookup(). Check all call sites to make sure that SAVESTART wasn't set while calling relookup(); if it was, adjust the refcount behavior. Remove related references to SAVESTART. The only code that was reaching the extra ref was msdosfs_rename, where the refcount behavior was already fairly broken and/or gross; repair it. Add a dummy 4th argument to relookup to make sure code that hasn't been inspected won't compile. (This will go away next time the relookup semantics change, which they will.) --- sys/fs/msdosfs/msdosfs_vnops.c | 38 +++++++++------------------------- sys/fs/udf/udf_vnops.c | 7 +++---- sys/fs/union/union_subr.c | 8 +++---- sys/fs/union/union_vnops.c | 6 +++--- sys/fs/unionfs/unionfs_subr.c | 8 +++---- sys/kern/vfs_lookup.c | 10 ++++----- sys/kern/vfs_syscalls.c | 13 +++--------- sys/nfs/nfs_serv.c | 10 +++------ sys/sys/namei.src | 4 ++-- sys/ufs/ext2fs/ext2fs_vnops.c | 15 +++++++------- sys/ufs/lfs/lfs_vnops.c | 8 +++---- sys/ufs/ufs/ufs_vnops.c | 15 +++++++------- sys/ufs/ufs/ufs_wapbl.c | 15 +++++++------- 13 files changed, 61 insertions(+), 96 deletions(-) diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c index ffe796dd4f9f..58f9bac7712e 100644 --- a/sys/fs/msdosfs/msdosfs_vnops.c +++ b/sys/fs/msdosfs/msdosfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: msdosfs_vnops.c,v 1.70 2010/11/30 10:43:03 dholland Exp $ */ +/* $NetBSD: msdosfs_vnops.c,v 1.71 2011/01/02 05:09:30 dholland Exp $ */ /*- * Copyright (C) 1994, 1995, 1997 Wolfgang Solfrank. @@ -48,7 +48,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.70 2010/11/30 10:43:03 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: msdosfs_vnops.c,v 1.71 2011/01/02 05:09:30 dholland Exp $"); #include #include @@ -829,7 +829,6 @@ msdosfs_rename(void *v) struct msdosfsmount *pmp; struct direntry *dotdotp; struct buf *bp; - int fdvp_dorele = 0; pmp = VFSTOMSDOSFS(fdvp->v_mount); @@ -922,16 +921,6 @@ abortit: if (VTODE(fdvp)->de_StartCluster != VTODE(tdvp)->de_StartCluster) newparent = 1; - /* - * XXX: We can do this here because rename uses SAVEFART and - * therefore fdvp has at least two references (one doesn't - * belong to us, though, and that's evil). We'll get - * another "extra" reference when we do relookup(), so we - * need to compensate. We should *NOT* be doing this, but - * it works, so whatever. - */ - vrele(fdvp); - if (doingdirectory && newparent) { if (error) /* write access check above */ goto tdvpbad; @@ -939,22 +928,19 @@ abortit: vput(tvp); tvp = NULL; /* - * doscheckpath() vput()'s dp, - * so we have to do a relookup afterwards + * doscheckpath() vput()'s tdvp (dp == VTODE(tdvp)), + * so we have to get an extra ref to it first, and + * because it's been unlocked we need to do a relookup + * afterwards in case tvp has changed. */ + vref(tdvp); if ((error = doscheckpath(ip, dp)) != 0) goto out; - if ((tcnp->cn_flags & SAVESTART) == 0) - panic("msdosfs_rename: lost to startdir"); vn_lock(tdvp, LK_EXCLUSIVE | LK_RETRY); - if ((error = relookup(tdvp, &tvp, tcnp)) != 0) { + if ((error = relookup(tdvp, &tvp, tcnp, 0)) != 0) { VOP_UNLOCK(tdvp); goto out; } - /* - * XXX: SAVESTART causes us to get a reference, but - * that's released already above in doscheckpath() - */ dp = VTODE(tdvp); xp = tvp ? VTODE(tvp) : NULL; } @@ -1004,11 +990,9 @@ abortit: */ fcnp->cn_flags &= ~MODMASK; fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; - if ((fcnp->cn_flags & SAVESTART) == 0) - panic("msdosfs_rename: lost from startdir"); VOP_UNLOCK(tdvp); vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY); - if ((error = relookup(fdvp, &fvp, fcnp))) { + if ((error = relookup(fdvp, &fvp, fcnp, 0))) { VOP_UNLOCK(fdvp); vrele(ap->a_fvp); vrele(tdvp); @@ -1027,7 +1011,6 @@ abortit: fstrans_done(fdvp->v_mount); return 0; } - fdvp_dorele = 1; VOP_UNLOCK(fdvp); xp = VTODE(fvp); zp = VTODE(fdvp); @@ -1133,8 +1116,7 @@ bad: vrele(tdvp); out: ip->de_flag &= ~DE_RENAME; - if (fdvp_dorele) - vrele(fdvp); + vrele(fdvp); vrele(fvp); fstrans_done(fdvp->v_mount); return (error); diff --git a/sys/fs/udf/udf_vnops.c b/sys/fs/udf/udf_vnops.c index f5290bab158e..2c10bd2376ee 100644 --- a/sys/fs/udf/udf_vnops.c +++ b/sys/fs/udf/udf_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: udf_vnops.c,v 1.61 2010/11/30 10:43:04 dholland Exp $ */ +/* $NetBSD: udf_vnops.c,v 1.62 2011/01/02 05:09:30 dholland Exp $ */ /* * Copyright (c) 2006, 2008 Reinoud Zandijk @@ -32,7 +32,7 @@ #include #ifndef lint -__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.61 2010/11/30 10:43:04 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: udf_vnops.c,v 1.62 2011/01/02 05:09:30 dholland Exp $"); #endif /* not lint */ @@ -2042,8 +2042,7 @@ udf_rename(void *v) * re-lookup tvp since the parent has been unlocked, so could * have changed/removed in the meantime. */ - tcnp->cn_flags &= ~SAVESTART; - error = relookup(tdvp, &tvp, tcnp); + error = relookup(tdvp, &tvp, tcnp, 0); if (error) { vput(tdvp); goto out; diff --git a/sys/fs/union/union_subr.c b/sys/fs/union/union_subr.c index d70580502904..9e9d8619983d 100644 --- a/sys/fs/union/union_subr.c +++ b/sys/fs/union/union_subr.c @@ -1,4 +1,4 @@ -/* $NetBSD: union_subr.c,v 1.41 2010/11/30 10:43:04 dholland Exp $ */ +/* $NetBSD: union_subr.c,v 1.42 2011/01/02 05:09:31 dholland Exp $ */ /* * Copyright (c) 1994 @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.41 2010/11/30 10:43:04 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: union_subr.c,v 1.42 2011/01/02 05:09:31 dholland Exp $"); #include #include @@ -815,7 +815,7 @@ union_relookup( cn->cn_hash = cnp->cn_hash; cn->cn_consume = cnp->cn_consume; - error = relookup(dvp, vpp, cn); + error = relookup(dvp, vpp, cn, 0); if (error) { PNBUF_PUT(pnbuf); *pnbuf_ret = NULL; @@ -972,7 +972,7 @@ union_vn_create(struct vnode **vpp, struct union_node *un, struct lwp *l) cn.cn_consume = 0; vn_lock(un->un_dirvp, LK_EXCLUSIVE | LK_RETRY); - error = relookup(un->un_dirvp, &vp, &cn); + error = relookup(un->un_dirvp, &vp, &cn, 0); if (error) { PNBUF_PUT(pnbuf); VOP_UNLOCK(un->un_dirvp); diff --git a/sys/fs/union/union_vnops.c b/sys/fs/union/union_vnops.c index 20f68fbbf62c..2e4daa2cd7c7 100644 --- a/sys/fs/union/union_vnops.c +++ b/sys/fs/union/union_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: union_vnops.c,v 1.38 2010/07/02 07:56:46 hannken Exp $ */ +/* $NetBSD: union_vnops.c,v 1.39 2011/01/02 05:09:31 dholland Exp $ */ /* * Copyright (c) 1992, 1993, 1994, 1995 @@ -72,7 +72,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.38 2010/07/02 07:56:46 hannken Exp $"); +__KERNEL_RCSID(0, "$NetBSD: union_vnops.c,v 1.39 2011/01/02 05:09:31 dholland Exp $"); #include #include @@ -1228,7 +1228,7 @@ union_link(void *v) vp = NULLVP; if (dun->un_uppervp == NULLVP) panic("union: null upperdvp?"); - error = relookup(ap->a_dvp, &vp, ap->a_cnp); + error = relookup(ap->a_dvp, &vp, ap->a_cnp, 0); if (error) { VOP_UNLOCK(ap->a_vp); return EROFS; /* ? */ diff --git a/sys/fs/unionfs/unionfs_subr.c b/sys/fs/unionfs/unionfs_subr.c index 096bfb59a9ab..17edb4680bcf 100644 --- a/sys/fs/unionfs/unionfs_subr.c +++ b/sys/fs/unionfs/unionfs_subr.c @@ -317,14 +317,12 @@ unionfs_relookup(struct vnode *dvp, struct vnode **vpp, cn->cn_consume = cnp->cn_consume; if (nameiop == DELETE) - cn->cn_flags |= (cnp->cn_flags & (DOWHITEOUT | SAVESTART)); - else if (RENAME == nameiop) - cn->cn_flags |= (cnp->cn_flags & SAVESTART); + cn->cn_flags |= (cnp->cn_flags & DOWHITEOUT); vref(dvp); VOP_UNLOCK(dvp); - if ((error = relookup(dvp, vpp, cn))) { + if ((error = relookup(dvp, vpp, cn, 0))) { PNBUF_PUT(pnbuf); *pnbuf_ret = NULL; vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY); @@ -631,7 +629,7 @@ unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, cn.cn_consume = 0; vref(udvp); - if ((error = relookup(udvp, &vp, &cn)) != 0) + if ((error = relookup(udvp, &vp, &cn, 0)) != 0) goto unionfs_vn_create_on_upper_free_out2; vrele(udvp); diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c index 7fd1bc6ed6bc..4c7e9ee762b1 100644 --- a/sys/kern/vfs_lookup.c +++ b/sys/kern/vfs_lookup.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_lookup.c,v 1.129 2011/01/02 05:04:58 dholland Exp $ */ +/* $NetBSD: vfs_lookup.c,v 1.130 2011/01/02 05:09:31 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -37,7 +37,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.129 2011/01/02 05:04:58 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_lookup.c,v 1.130 2011/01/02 05:09:31 dholland Exp $"); #include "opt_magiclinks.h" @@ -1463,7 +1463,7 @@ lookup_for_nfsd_index(struct nameidata *ndp, struct vnode *startdir) * *vpp is locked on exit unless it's NULL. */ int -relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) +relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp, int dummy) { int rdonly; /* lookup read-only flag bit */ int error = 0; @@ -1472,6 +1472,8 @@ relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) const char *cp; /* DEBUG: check name ptr/len */ #endif /* DEBUG */ + (void)dummy; + /* * Setup: break out flag bits into variables. */ @@ -1544,8 +1546,6 @@ relookup(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) } goto bad; } - if (cnp->cn_flags & SAVESTART) - vref(dvp); return (0); bad: diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index d37d767943e9..c96f78d9a9e7 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.411 2011/01/02 05:01:20 dholland Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.412 2011/01/02 05:09:31 dholland Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.411 2011/01/02 05:01:20 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.412 2011/01/02 05:09:31 dholland Exp $"); #ifdef _KERNEL_OPT #include "opt_fileassoc.h" @@ -3438,7 +3438,6 @@ do_sys_rename(const char *from, const char *to, enum uio_seg seg, int retain) struct mount *fs; struct lwp *l = curlwp; struct proc *p; - uint32_t saveflag; int error; error = pathbuf_maybe_copyin(from, seg, &frompb); @@ -3482,9 +3481,6 @@ do_sys_rename(const char *from, const char *to, enum uio_seg seg, int retain) * order and do the lookups in the right places, but that's a * major rototill. * - * Preserve the SAVESTART in cn_flags, because who knows what - * might happen if we don't. - * * Note: this logic (as well as this whole function) is cloned * in nfs_serv.c. Proceed accordingly. */ @@ -3500,11 +3496,8 @@ do_sys_rename(const char *from, const char *to, enum uio_seg seg, int retain) vrele(fromnd.ni_dvp); goto out1; } - saveflag = fromnd.ni_cnd.cn_flags & SAVESTART; - fromnd.ni_cnd.cn_flags &= ~SAVESTART; vn_lock(fromnd.ni_dvp, LK_EXCLUSIVE | LK_RETRY); - error = relookup(fromnd.ni_dvp, &fromnd.ni_vp, &fromnd.ni_cnd); - fromnd.ni_cnd.cn_flags |= saveflag; + error = relookup(fromnd.ni_dvp, &fromnd.ni_vp, &fromnd.ni_cnd, 0); if (error) { VOP_UNLOCK(fromnd.ni_dvp); VFS_RENAMELOCK_EXIT(fs); diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index eda661012261..67e48117430e 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_serv.c,v 1.153 2011/01/02 05:01:21 dholland Exp $ */ +/* $NetBSD: nfs_serv.c,v 1.154 2011/01/02 05:09:31 dholland Exp $ */ /* * Copyright (c) 1989, 1993 @@ -55,7 +55,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.153 2011/01/02 05:01:21 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.154 2011/01/02 05:09:31 dholland Exp $"); #include #include @@ -1898,7 +1898,6 @@ nfsrv_rename(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct lwp *l nfsrvfh_t fnsfh, tnsfh; u_quad_t frev; uid_t saved_uid; - uint32_t saveflag; #ifndef nolint fvp = (struct vnode *)0; @@ -1956,11 +1955,8 @@ nfsrv_rename(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct lwp *l vrele(fromnd.ni_dvp); goto out1; } - saveflag = fromnd.ni_cnd.cn_flags & SAVESTART; - fromnd.ni_cnd.cn_flags &= ~SAVESTART; vn_lock(fromnd.ni_dvp, LK_EXCLUSIVE | LK_RETRY); - error = relookup(fromnd.ni_dvp, &fromnd.ni_vp, &fromnd.ni_cnd); - fromnd.ni_cnd.cn_flags |= saveflag; + error = relookup(fromnd.ni_dvp, &fromnd.ni_vp, &fromnd.ni_cnd, 0); if (error) { VOP_UNLOCK(fromnd.ni_dvp); VFS_RENAMELOCK_EXIT(localfs); diff --git a/sys/sys/namei.src b/sys/sys/namei.src index 95adf5a7e778..135b4d541a96 100644 --- a/sys/sys/namei.src +++ b/sys/sys/namei.src @@ -1,4 +1,4 @@ -/* $NetBSD: namei.src,v 1.19 2011/01/02 05:04:58 dholland Exp $ */ +/* $NetBSD: namei.src,v 1.20 2011/01/02 05:09:30 dholland Exp $ */ /* * Copyright (c) 1985, 1989, 1991, 1993 @@ -257,7 +257,7 @@ int namei(struct nameidata *); uint32_t namei_hash(const char *, const char **); int lookup_for_nfsd(struct nameidata *, struct vnode *, int neverfollow); int lookup_for_nfsd_index(struct nameidata *, struct vnode *); -int relookup(struct vnode *, struct vnode **, struct componentname *); +int relookup(struct vnode *, struct vnode **, struct componentname *, int); void cache_purge1(struct vnode *, const struct componentname *, int); #define PURGE_PARENTS 1 #define PURGE_CHILDREN 2 diff --git a/sys/ufs/ext2fs/ext2fs_vnops.c b/sys/ufs/ext2fs/ext2fs_vnops.c index 8021c1063600..d83c26269c23 100644 --- a/sys/ufs/ext2fs/ext2fs_vnops.c +++ b/sys/ufs/ext2fs/ext2fs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ext2fs_vnops.c,v 1.96 2010/11/30 10:43:06 dholland Exp $ */ +/* $NetBSD: ext2fs_vnops.c,v 1.97 2011/01/02 05:09:32 dholland Exp $ */ /* * Copyright (c) 1982, 1986, 1989, 1993 @@ -65,7 +65,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.96 2010/11/30 10:43:06 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ext2fs_vnops.c,v 1.97 2011/01/02 05:09:32 dholland Exp $"); #include #include @@ -700,11 +700,11 @@ abortit: /* Delete source. */ vrele(fvp); - fcnp->cn_flags &= ~(MODMASK | SAVESTART); + fcnp->cn_flags &= ~(MODMASK); fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; fcnp->cn_nameiop = DELETE; vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY); - if ((error = relookup(fdvp, &fvp, fcnp))) { + if ((error = relookup(fdvp, &fvp, fcnp, 0))) { vput(fdvp); return (error); } @@ -799,9 +799,8 @@ abortit: vrele(tdvp); goto out; } - tcnp->cn_flags &= ~SAVESTART; vn_lock(tdvp, LK_EXCLUSIVE | LK_RETRY); - if ((error = relookup(tdvp, &tvp, tcnp)) != 0) { + if ((error = relookup(tdvp, &tvp, tcnp, 0)) != 0) { vput(tdvp); goto out; } @@ -931,10 +930,10 @@ abortit: /* * 3) Unlink the source. */ - fcnp->cn_flags &= ~(MODMASK | SAVESTART); + fcnp->cn_flags &= ~(MODMASK); fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY); - if ((error = relookup(fdvp, &fvp, fcnp))) { + if ((error = relookup(fdvp, &fvp, fcnp, 0))) { vput(fdvp); vrele(ap->a_fvp); return (error); diff --git a/sys/ufs/lfs/lfs_vnops.c b/sys/ufs/lfs/lfs_vnops.c index 05ee299a6d91..e43cb5f36914 100644 --- a/sys/ufs/lfs/lfs_vnops.c +++ b/sys/ufs/lfs/lfs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: lfs_vnops.c,v 1.232 2010/12/18 00:01:46 eeh Exp $ */ +/* $NetBSD: lfs_vnops.c,v 1.233 2011/01/02 05:09:32 dholland Exp $ */ /*- * Copyright (c) 1999, 2000, 2001, 2002, 2003 The NetBSD Foundation, Inc. @@ -60,7 +60,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.232 2010/12/18 00:01:46 eeh Exp $"); +__KERNEL_RCSID(0, "$NetBSD: lfs_vnops.c,v 1.233 2011/01/02 05:09:32 dholland Exp $"); #ifdef _KERNEL_OPT #include "opt_compat_netbsd.h" @@ -852,11 +852,11 @@ lfs_rename(void *v) /* Delete source. */ vrele(fvp); - fcnp->cn_flags &= ~(MODMASK | SAVESTART); + fcnp->cn_flags &= ~(MODMASK); fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; fcnp->cn_nameiop = DELETE; vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY); - if ((error = relookup(fdvp, &fvp, fcnp))) { + if ((error = relookup(fdvp, &fvp, fcnp, 0))) { vput(fdvp); return (error); } diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c index 69eeba128535..f7049f2c8924 100644 --- a/sys/ufs/ufs/ufs_vnops.c +++ b/sys/ufs/ufs/ufs_vnops.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_vnops.c,v 1.185 2010/11/30 10:43:06 dholland Exp $ */ +/* $NetBSD: ufs_vnops.c,v 1.186 2011/01/02 05:09:32 dholland Exp $ */ /*- * Copyright (c) 2008 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.185 2010/11/30 10:43:06 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_vnops.c,v 1.186 2011/01/02 05:09:32 dholland Exp $"); #if defined(_KERNEL_OPT) #include "opt_ffs.h" @@ -1024,11 +1024,11 @@ ufs_rename(void *v) /* Delete source. */ vrele(fvp); - fcnp->cn_flags &= ~(MODMASK | SAVESTART); + fcnp->cn_flags &= ~(MODMASK); fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; fcnp->cn_nameiop = DELETE; vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY); - if ((error = relookup(fdvp, &fvp, fcnp))) { + if ((error = relookup(fdvp, &fvp, fcnp, 0))) { vput(fdvp); return (error); } @@ -1118,9 +1118,8 @@ ufs_rename(void *v) vrele(tdvp); goto out; } - tcnp->cn_flags &= ~SAVESTART; vn_lock(tdvp, LK_EXCLUSIVE | LK_RETRY); - error = relookup(tdvp, &tvp, tcnp); + error = relookup(tdvp, &tvp, tcnp, 0); if (error != 0) { vput(tdvp); goto out; @@ -1253,10 +1252,10 @@ ufs_rename(void *v) /* * 3) Unlink the source. */ - fcnp->cn_flags &= ~(MODMASK | SAVESTART); + fcnp->cn_flags &= ~(MODMASK); fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY); - if ((error = relookup(fdvp, &fvp, fcnp))) { + if ((error = relookup(fdvp, &fvp, fcnp, 0))) { vput(fdvp); vrele(ap->a_fvp); goto out2; diff --git a/sys/ufs/ufs/ufs_wapbl.c b/sys/ufs/ufs/ufs_wapbl.c index d96f177b5d69..c033444a226f 100644 --- a/sys/ufs/ufs/ufs_wapbl.c +++ b/sys/ufs/ufs/ufs_wapbl.c @@ -1,4 +1,4 @@ -/* $NetBSD: ufs_wapbl.c,v 1.11 2010/11/30 10:43:06 dholland Exp $ */ +/* $NetBSD: ufs_wapbl.c,v 1.12 2011/01/02 05:09:32 dholland Exp $ */ /*- * Copyright (c) 2003,2006,2008 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: ufs_wapbl.c,v 1.11 2010/11/30 10:43:06 dholland Exp $"); +__KERNEL_RCSID(0, "$NetBSD: ufs_wapbl.c,v 1.12 2011/01/02 05:09:32 dholland Exp $"); #include #include @@ -219,11 +219,11 @@ wapbl_ufs_rename(void *v) /* Delete source. */ vrele(fvp); - fcnp->cn_flags &= ~(MODMASK | SAVESTART); + fcnp->cn_flags &= ~(MODMASK); fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; fcnp->cn_nameiop = DELETE; vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY); - if ((error = relookup(fdvp, &fvp, fcnp))) { + if ((error = relookup(fdvp, &fvp, fcnp, 0))) { vput(fdvp); return (error); } @@ -301,10 +301,9 @@ wapbl_ufs_rename(void *v) tdp = NULL; goto out; } - tcnp->cn_flags &= ~SAVESTART; tdp = NULL; vn_lock(tdvp, LK_EXCLUSIVE | LK_RETRY); - error = relookup(tdvp, &tvp, tcnp); + error = relookup(tdvp, &tvp, tcnp, 0); if (error != 0) { vput(tdvp); goto out; @@ -330,7 +329,7 @@ wapbl_ufs_rename(void *v) * This was moved up to before the journal lock to * avoid potential deadlock */ - fcnp->cn_flags &= ~(MODMASK | SAVESTART); + fcnp->cn_flags &= ~(MODMASK); fcnp->cn_flags |= LOCKPARENT | LOCKLEAF; if (newparent) { /* Check for the rename("foo/foo", "foo") case. */ @@ -339,7 +338,7 @@ wapbl_ufs_rename(void *v) goto out; } vn_lock(fdvp, LK_EXCLUSIVE | LK_RETRY); - if ((error = relookup(fdvp, &fvp, fcnp))) { + if ((error = relookup(fdvp, &fvp, fcnp, 0))) { vput(fdvp); vrele(ap->a_fvp); goto out2;