Set SAVENAME for rmdir and remove.

Addresses an easy part of PR kern/38188
This commit is contained in:
pooka 2009-09-19 11:44:19 +00:00
parent 2c50cb71cb
commit 8f328cc813

View File

@ -1,4 +1,4 @@
/* $NetBSD: puffs_vnops.c,v 1.132 2009/09/12 18:17:55 tsutsui Exp $ */
/* $NetBSD: puffs_vnops.c,v 1.133 2009/09/19 11:44:19 pooka Exp $ */
/*
* Copyright (c) 2005, 2006, 2007 Antti Kantee. All Rights Reserved.
@ -30,7 +30,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.132 2009/09/12 18:17:55 tsutsui Exp $");
__KERNEL_RCSID(0, "$NetBSD: puffs_vnops.c,v 1.133 2009/09/19 11:44:19 pooka Exp $");
#include <sys/param.h>
#include <sys/buf.h>
@ -581,6 +581,13 @@ puffs_vnop_lookup(void *v)
cnp->cn_consume = MIN(lookup_msg->pvnr_cn.pkcn_consume,
strlen(cnp->cn_nameptr) - cnp->cn_namelen);
/*
* We need the name in remove and rmdir (well, rename too, but
* SAVESTART takes care of that)
*/
if (cnp->cn_nameiop == DELETE)
cnp->cn_flags |= SAVENAME;
out:
if (cnp->cn_flags & ISDOTDOT)
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY);
@ -1439,6 +1446,8 @@ puffs_vnop_remove(void *v)
RELEPN_AND_VP(vp, pn);
error = checkerr(pmp, error, __func__);
if (error || (cnp->cn_flags & SAVESTART) == 0)
PNBUF_PUT(cnp->cn_pnbuf);
return error;
}
@ -1544,6 +1553,9 @@ puffs_vnop_rmdir(void *v)
RELEPN_AND_VP(dvp, dpn);
RELEPN_AND_VP(vp, pn);
if (error || (cnp->cn_flags & SAVESTART) == 0)
PNBUF_PUT(cnp->cn_pnbuf);
return error;
}