diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c index 1a96ca3d4dd7..f6cda347320b 100644 --- a/sys/kern/vfs_syscalls.c +++ b/sys/kern/vfs_syscalls.c @@ -1,4 +1,4 @@ -/* $NetBSD: vfs_syscalls.c,v 1.400 2009/12/19 20:28:27 martin Exp $ */ +/* $NetBSD: vfs_syscalls.c,v 1.401 2009/12/23 01:09:24 pooka Exp $ */ /*- * Copyright (c) 2008, 2009 The NetBSD Foundation, Inc. @@ -66,7 +66,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.400 2009/12/19 20:28:27 martin Exp $"); +__KERNEL_RCSID(0, "$NetBSD: vfs_syscalls.c,v 1.401 2009/12/23 01:09:24 pooka Exp $"); #ifdef _KERNEL_OPT #include "opt_fileassoc.h" @@ -3264,7 +3264,7 @@ do_sys_rename(const char *from, const char *to, enum uio_seg seg, int retain) uint32_t saveflag; int error; - NDINIT(&fromnd, DELETE, LOCKPARENT | SAVESTART | TRYEMULROOT, + NDINIT(&fromnd, DELETE, LOCKPARENT | SAVESTART | TRYEMULROOT | INRENAME, seg, from); if ((error = namei(&fromnd)) != 0) return (error); @@ -3329,7 +3329,7 @@ do_sys_rename(const char *from, const char *to, enum uio_seg seg, int retain) NDINIT(&tond, RENAME, LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART | TRYEMULROOT - | (fvp->v_type == VDIR ? CREATEDIR : 0), + | INRENAME | (fvp->v_type == VDIR ? CREATEDIR : 0), seg, to); if ((error = namei(&tond)) != 0) { VFS_RENAMELOCK_EXIT(fs); diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c index 033fb63aa645..2c12a9fa1418 100644 --- a/sys/nfs/nfs_serv.c +++ b/sys/nfs/nfs_serv.c @@ -1,4 +1,4 @@ -/* $NetBSD: nfs_serv.c,v 1.148 2009/11/07 07:27:49 cegger Exp $ */ +/* $NetBSD: nfs_serv.c,v 1.149 2009/12/23 01:09:25 pooka Exp $ */ /* * Copyright (c) 1989, 1993 @@ -55,7 +55,7 @@ */ #include -__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.148 2009/11/07 07:27:49 cegger Exp $"); +__KERNEL_RCSID(0, "$NetBSD: nfs_serv.c,v 1.149 2009/12/23 01:09:25 pooka Exp $"); #include #include @@ -1863,7 +1863,7 @@ nfsrv_rename(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct lwp *l saved_uid = kauth_cred_geteuid(cred); fromnd.ni_cnd.cn_cred = cred; fromnd.ni_cnd.cn_nameiop = DELETE; - fromnd.ni_cnd.cn_flags = LOCKPARENT | SAVESTART; + fromnd.ni_cnd.cn_flags = LOCKPARENT | SAVESTART | INRENAME; error = nfs_namei(&fromnd, &fnsfh, len, slp, nam, &md, &dpos, &fdirp, lwp, (nfsd->nd_flag & ND_KERBAUTH), false); if (fdirp && v3) { @@ -1934,7 +1934,8 @@ nfsrv_rename(struct nfsrv_descript *nfsd, struct nfssvc_sock *slp, struct lwp *l kauth_cred_seteuid(cred, saved_uid); tond.ni_cnd.cn_cred = cred; tond.ni_cnd.cn_nameiop = RENAME; - tond.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | NOCACHE | SAVESTART; + tond.ni_cnd.cn_flags = LOCKPARENT | LOCKLEAF | NOCACHE | + SAVESTART | INRENAME; error = nfs_namei(&tond, &tnsfh, len2, slp, nam, &md, &dpos, &tdirp, lwp, (nfsd->nd_flag & ND_KERBAUTH), false); if (tdirp && v3) { diff --git a/sys/sys/namei.src b/sys/sys/namei.src index 4d02dce0e928..823be7fa8ca0 100644 --- a/sys/sys/namei.src +++ b/sys/sys/namei.src @@ -1,4 +1,4 @@ -/* $NetBSD: namei.src,v 1.13 2009/09/27 17:23:54 dholland Exp $ */ +/* $NetBSD: namei.src,v 1.14 2009/12/23 01:09:24 pooka Exp $ */ /* * Copyright (c) 1985, 1989, 1991, 1993 @@ -139,7 +139,8 @@ NAMEIFL ISWHITEOUT 0x0020000 /* found whiteout */ NAMEIFL DOWHITEOUT 0x0040000 /* do whiteouts */ NAMEIFL REQUIREDIR 0x0080000 /* must be a directory */ NAMEIFL CREATEDIR 0x0200000 /* trailing slashes are ok */ -NAMEIFL PARAMASK 0x02fff00 /* mask of parameter descriptors */ +NAMEIFL INRENAME 0x0400000 /* operation is a part of ``rename'' */ +NAMEIFL PARAMASK 0x06fff00 /* mask of parameter descriptors */ /* * Initialization of an nameidata structure.