summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authoreivind <eivind@FreeBSD.org>1999-12-15 23:02:35 +0000
committereivind <eivind@FreeBSD.org>1999-12-15 23:02:35 +0000
commit87724eb67358c0993676ad3dfe9091e192a653f4 (patch)
treec4e987197c199433e822f5a66858564ad5ccd4dd
parent529bc073c0dba1aaccc98818ee299b79a111afab (diff)
downloadFreeBSD-src-87724eb67358c0993676ad3dfe9091e192a653f4.zip
FreeBSD-src-87724eb67358c0993676ad3dfe9091e192a653f4.tar.gz
Introduce NDFREE (and remove VOP_ABORTOP)
-rw-r--r--sys/coda/coda_vfsops.c5
-rw-r--r--sys/coda/coda_vnops.c54
-rw-r--r--sys/compat/linux/linux_misc.c6
-rw-r--r--sys/compat/linux/linux_stats.c5
-rw-r--r--sys/compat/linux/linux_util.c10
-rw-r--r--sys/compat/svr4/svr4_misc.c2
-rw-r--r--sys/compat/svr4/svr4_sysvec.c3
-rw-r--r--sys/dev/ccd/ccd.c19
-rw-r--r--sys/dev/vinum/vinumio.c4
-rw-r--r--sys/dev/vn/vn.c1
-rw-r--r--sys/fs/cd9660/cd9660_vfsops.c3
-rw-r--r--sys/fs/cd9660/cd9660_vnops.c18
-rw-r--r--sys/fs/coda/coda_vfsops.c5
-rw-r--r--sys/fs/coda/coda_vnops.c54
-rw-r--r--sys/fs/fifofs/fifo_vnops.c1
-rw-r--r--sys/fs/hpfs/hpfs_vnops.c19
-rw-r--r--sys/fs/msdosfs/msdosfs_vfsops.c2
-rw-r--r--sys/fs/msdosfs/msdosfs_vnops.c26
-rw-r--r--sys/fs/ntfs/ntfs_vfsops.c3
-rw-r--r--sys/fs/nullfs/null_vfsops.c2
-rw-r--r--sys/fs/nwfs/nwfs_vnops.c34
-rw-r--r--sys/fs/procfs/procfs_vnops.c21
-rw-r--r--sys/fs/umapfs/umap_vfsops.c2
-rw-r--r--sys/fs/unionfs/union_subr.c33
-rw-r--r--sys/fs/unionfs/union_vfsops.c2
-rw-r--r--sys/fs/unionfs/union_vnops.c39
-rw-r--r--sys/geom/geom_ccd.c19
-rw-r--r--sys/gnu/ext2fs/ext2_vfsops.c3
-rw-r--r--sys/gnu/ext2fs/ext2_vnops.c23
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vfsops.c3
-rw-r--r--sys/gnu/fs/ext2fs/ext2_vnops.c23
-rw-r--r--sys/i386/ibcs2/ibcs2_stat.c5
-rw-r--r--sys/i386/ibcs2/ibcs2_util.c9
-rw-r--r--sys/i386/ibcs2/ibcs2_xenix.c3
-rw-r--r--sys/i386/ibcs2/imgact_coff.c2
-rw-r--r--sys/i386/linux/linux_misc.c6
-rw-r--r--sys/i386/linux/linux_stats.c5
-rw-r--r--sys/i386/linux/linux_util.c10
-rw-r--r--sys/isofs/cd9660/cd9660_vfsops.c3
-rw-r--r--sys/isofs/cd9660/cd9660_vnops.c18
-rw-r--r--sys/kern/imgact_elf.c3
-rw-r--r--sys/kern/kern_acct.c3
-rw-r--r--sys/kern/kern_exec.c6
-rw-r--r--sys/kern/kern_ktrace.c3
-rw-r--r--sys/kern/kern_linker.c3
-rw-r--r--sys/kern/kern_sig.c3
-rw-r--r--sys/kern/link_aout.c3
-rw-r--r--sys/kern/link_elf.c4
-rw-r--r--sys/kern/link_elf_obj.c4
-rw-r--r--sys/kern/uipc_usrreq.c4
-rw-r--r--sys/kern/vfs_default.c1
-rw-r--r--sys/kern/vfs_extattr.c82
-rw-r--r--sys/kern/vfs_lookup.c7
-rw-r--r--sys/kern/vfs_syscalls.c82
-rw-r--r--sys/kern/vfs_vnops.c13
-rw-r--r--sys/kern/vnode_if.src8
-rw-r--r--sys/miscfs/devfs/devfs_vnops.c22
-rw-r--r--sys/miscfs/fifofs/fifo_vnops.c1
-rw-r--r--sys/miscfs/nullfs/null_vfsops.c2
-rw-r--r--sys/miscfs/procfs/procfs_vnops.c21
-rw-r--r--sys/miscfs/umapfs/umap_vfsops.c2
-rw-r--r--sys/miscfs/union/union_subr.c33
-rw-r--r--sys/miscfs/union/union_vfsops.c2
-rw-r--r--sys/miscfs/union/union_vnops.c39
-rw-r--r--sys/msdosfs/msdosfs_vfsops.c2
-rw-r--r--sys/msdosfs/msdosfs_vnops.c26
-rw-r--r--sys/nfs/nfs_node.c17
-rw-r--r--sys/nfs/nfs_serv.c146
-rw-r--r--sys/nfs/nfs_syscalls.c2
-rw-r--r--sys/nfs/nfs_vnops.c22
-rw-r--r--sys/nfs/nfsnode.h1
-rw-r--r--sys/nfsclient/nfs_nfsiod.c2
-rw-r--r--sys/nfsclient/nfs_node.c17
-rw-r--r--sys/nfsclient/nfs_vnops.c22
-rw-r--r--sys/nfsclient/nfsnode.h1
-rw-r--r--sys/nfsserver/nfs_serv.c146
-rw-r--r--sys/nfsserver/nfs_syscalls.c2
-rw-r--r--sys/ntfs/ntfs_vfsops.c3
-rw-r--r--sys/nwfs/nwfs_vnops.c34
-rw-r--r--sys/svr4/svr4_misc.c2
-rw-r--r--sys/svr4/svr4_sysvec.c3
-rw-r--r--sys/sys/namei.h61
-rw-r--r--sys/ufs/ffs/ffs_vfsops.c2
-rw-r--r--sys/ufs/ufs/ufs_quota.c2
-rw-r--r--sys/ufs/ufs/ufs_vnops.c44
-rw-r--r--sys/vm/vm_swap.c2
86 files changed, 459 insertions, 956 deletions
diff --git a/sys/coda/coda_vfsops.c b/sys/coda/coda_vfsops.c
index 615289c..04cf95b 100644
--- a/sys/coda/coda_vfsops.c
+++ b/sys/coda/coda_vfsops.c
@@ -56,6 +56,8 @@
#include <sys/mount.h>
#include <sys/select.h>
+#include <vm/vm_zone.h>
+
#include <coda/coda.h>
#include <coda/cnode.h>
#include <coda/coda_vfsops.h>
@@ -134,7 +136,6 @@ coda_mount(vfsp, path, data, ndp, p)
}
/* Validate mount device. Similar to getmdev(). */
-
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, data, p);
error = namei(ndp);
dvp = ndp->ni_vp;
@@ -146,10 +147,12 @@ coda_mount(vfsp, path, data, ndp, p)
if (dvp->v_type != VCHR) {
MARK_INT_FAIL(CODA_MOUNT_STATS);
vrele(dvp);
+ NDFREE(ndp, NDF_ONLY_PNBUF);
return(ENXIO);
}
dev = dvp->v_rdev;
vrele(dvp);
+ NDFREE(ndp, NDF_ONLY_PNBUF);
/*
* See if the device table matches our expectations.
diff --git a/sys/coda/coda_vnops.c b/sys/coda/coda_vnops.c
index 1ef09bc..761ebcc 100644
--- a/sys/coda/coda_vnops.c
+++ b/sys/coda/coda_vnops.c
@@ -131,7 +131,6 @@ struct vnodeopv_entry_desc coda_vnodeop_entries[] = {
{ &vop_symlink_desc, coda_symlink }, /* symlink */
{ &vop_readdir_desc, coda_readdir }, /* readdir */
{ &vop_readlink_desc, coda_readlink }, /* readlink */
- { &vop_abortop_desc, coda_abortop }, /* abortop */
{ &vop_inactive_desc, coda_inactive }, /* inactive */
{ &vop_reclaim_desc, coda_reclaim }, /* reclaim */
{ &vop_lock_desc, coda_lock }, /* lock */
@@ -563,6 +562,7 @@ coda_ioctl(v)
*/
if (tvp->v_op != coda_vnodeop_p) {
vrele(tvp);
+ NDFREE(&ndp, NDF_ONLY_PNBUF);
MARK_INT_FAIL(CODA_IOCTL_STATS);
CODADEBUG(CODA_IOCTL,
myprintf(("coda_ioctl error: %s not a coda object\n",
@@ -571,7 +571,7 @@ coda_ioctl(v)
}
if (iap->vi.in_size > VC_MAXDATASIZE) {
- vrele(tvp);
+ NDFREE(&ndp, 0);
return(EINVAL);
}
error = venus_ioctl(vtomi(tvp), &((VTOC(tvp))->c_fid), com, flag, data, cred, p);
@@ -582,6 +582,7 @@ coda_ioctl(v)
CODADEBUG(CODA_IOCTL, myprintf(("Ioctl returns %d \n", error)); )
vrele(tvp);
+ NDFREE(&ndp, NDF_ONLY_PNBUF);
return(error);
}
@@ -745,29 +746,6 @@ coda_access(v)
return(error);
}
-/*
- * CODA abort op, called after namei() when a CREATE/DELETE isn't actually
- * done. If a buffer has been saved in anticipation of a coda_create or
- * a coda_remove, delete it.
- */
-/* ARGSUSED */
-int
-coda_abortop(v)
- void *v;
-{
-/* true args */
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap = v;
-/* upcall decl */
-/* locals */
-
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- return (0);
-}
-
int
coda_readlink(v)
void *v;
@@ -1208,14 +1186,6 @@ coda_create(v)
}
#endif
}
- /* Have to free the previously saved name */
- /*
- * This condition is stolen from ufs_makeinode. I have no idea
- * why it's here, but what the hey...
- */
- if ((cnp->cn_flags & SAVESTART) == 0) {
- zfree(namei_zone, cnp->cn_pnbuf);
- }
return(error);
}
@@ -1276,9 +1246,6 @@ coda_remove(v)
CODADEBUG(CODA_REMOVE, myprintf(("in remove result %d\n",error)); )
- if ((cnp->cn_flags & SAVESTART) == 0) {
- zfree(namei_zone, cnp->cn_pnbuf);
- }
return(error);
}
@@ -1332,10 +1299,6 @@ coda_link(v)
CODADEBUG(CODA_LINK, myprintf(("in link result %d\n",error)); )
- /* Drop the name buffer if we don't need to SAVESTART */
- if ((cnp->cn_flags & SAVESTART) == 0) {
- zfree(namei_zone, cnp->cn_pnbuf);
- }
return(error);
}
@@ -1502,14 +1465,6 @@ coda_mkdir(v)
CODADEBUG(CODA_MKDIR, myprintf(("mkdir error %d\n",error));)
}
- /* Have to free the previously saved name */
- /*
- * ufs_mkdir doesn't check for SAVESTART before freeing the
- * pathname buffer, but ufs_create does. For the moment, I'll
- * follow their lead, but this seems like it is probably
- * incorrect.
- */
- zfree(namei_zone, cnp->cn_pnbuf);
return(error);
}
@@ -1559,9 +1514,6 @@ coda_rmdir(v)
CODADEBUG(CODA_RMDIR, myprintf(("in rmdir result %d\n", error)); )
- if ((cnp->cn_flags & SAVESTART) == 0) {
- zfree(namei_zone, cnp->cn_pnbuf);
- }
return(error);
}
diff --git a/sys/compat/linux/linux_misc.c b/sys/compat/linux/linux_misc.c
index 36f1165..1835c9c 100644
--- a/sys/compat/linux/linux_misc.c
+++ b/sys/compat/linux/linux_misc.c
@@ -54,6 +54,7 @@
#include <vm/vm_kern.h>
#include <vm/vm_map.h>
#include <vm/vm_extern.h>
+#include <vm/vm_zone.h>
#include <machine/frame.h>
#include <machine/psl.h>
@@ -194,10 +195,15 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args)
goto cleanup;
vp = ni.ni_vp;
+ /*
+ * XXX This looks like a bogus check - a LOCKLEAF namei should not succeed
+ * without returning a vnode.
+ */
if (vp == NULL) {
error = ENOEXEC; /* ?? */
goto cleanup;
}
+ NDFREE(&ni, NDF_ONLY_PNBUF);
/*
* From here on down, we have a locked vnode that must be unlocked.
diff --git a/sys/compat/linux/linux_stats.c b/sys/compat/linux/linux_stats.c
index 14c8090..be40f15 100644
--- a/sys/compat/linux/linux_stats.c
+++ b/sys/compat/linux/linux_stats.c
@@ -44,6 +44,8 @@
#include <i386/linux/linux_proto.h>
#include <i386/linux/linux_util.h>
+#include <vm/vm_zone.h>
+
struct linux_newstat {
u_short stat_dev;
u_short __pad1;
@@ -118,6 +120,7 @@ linux_newstat(struct proc *p, struct linux_newstat_args *args)
error = namei(&nd);
if (error)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = vn_stat(nd.ni_vp, &buf, p);
vput(nd.ni_vp);
@@ -154,6 +157,7 @@ linux_newlstat(p, uap)
error = namei(&nd);
if (error)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
error = vn_stat(vp, &sb, p);
@@ -224,6 +228,7 @@ linux_statfs(struct proc *p, struct linux_statfs_args *args)
error = namei(ndp);
if (error)
return error;
+ NDFREE(ndp, NDF_ONLY_PNBUF);
mp = ndp->ni_vp->v_mount;
bsd_statfs = &mp->mnt_stat;
vrele(ndp->ni_vp);
diff --git a/sys/compat/linux/linux_util.c b/sys/compat/linux/linux_util.c
index 7c87174..0864ae7 100644
--- a/sys/compat/linux/linux_util.c
+++ b/sys/compat/linux/linux_util.c
@@ -39,6 +39,8 @@
#include <i386/linux/linux_util.h>
+#include <vm/vm_zone.h>
+
const char linux_emul_path[] = "/compat/linux";
/*
@@ -135,6 +137,7 @@ linux_emul_find(p, sgp, prefix, path, pbuf, cflag)
if ((error = namei(&ndroot)) != 0) {
/* Cannot happen! */
free(buf, M_TEMP);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(nd.ni_vp);
return error;
}
@@ -164,13 +167,18 @@ linux_emul_find(p, sgp, prefix, path, pbuf, cflag)
free(buf, M_TEMP);
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(nd.ni_vp);
- if (!cflag)
+ if (!cflag) {
+ NDFREE(&ndroot, NDF_ONLY_PNBUF);
vrele(ndroot.ni_vp);
+ }
return error;
bad:
+ NDFREE(&ndroot, NDF_ONLY_PNBUF);
vrele(ndroot.ni_vp);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(nd.ni_vp);
free(buf, M_TEMP);
return error;
diff --git a/sys/compat/svr4/svr4_misc.c b/sys/compat/svr4/svr4_misc.c
index 2abacee..6399049 100644
--- a/sys/compat/svr4/svr4_misc.c
+++ b/sys/compat/svr4/svr4_misc.c
@@ -1650,7 +1650,7 @@ svr4_sys_resolvepath(p, uap)
*retval = strlen(nd.ni_cnd.cn_pnbuf) < SCARG(uap, bufsiz) ?
strlen(nd.ni_cnd.cn_pnbuf) + 1 : SCARG(uap, bufsiz);
bad:
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_vp);
- zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
return error;
}
diff --git a/sys/compat/svr4/svr4_sysvec.c b/sys/compat/svr4/svr4_sysvec.c
index f88b7d1..fbd4212 100644
--- a/sys/compat/svr4/svr4_sysvec.c
+++ b/sys/compat/svr4/svr4_sysvec.c
@@ -296,6 +296,7 @@ svr4_emul_find(p, sgp, prefix, path, pbuf, cflag)
free(buf, M_TEMP);
return error;
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
*cp = '/';
}
@@ -306,6 +307,7 @@ svr4_emul_find(p, sgp, prefix, path, pbuf, cflag)
free(buf, M_TEMP);
return error;
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
/*
* We now compare the vnode of the svr4_root to the one
@@ -324,6 +326,7 @@ svr4_emul_find(p, sgp, prefix, path, pbuf, cflag)
vrele(nd.ni_vp);
return error;
}
+ NDFREE(&ndroot, NDF_ONLY_PNBUF);
if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0) {
goto done;
diff --git a/sys/dev/ccd/ccd.c b/sys/dev/ccd/ccd.c
index 7f14c78..b70f8c2 100644
--- a/sys/dev/ccd/ccd.c
+++ b/sys/dev/ccd/ccd.c
@@ -109,6 +109,8 @@
#include <sys/ccdvar.h>
+#include <vm/vm_zone.h>
+
#if defined(CCDDEBUG) && !defined(DEBUG)
#define DEBUG
#endif
@@ -1598,15 +1600,13 @@ ccdlookup(path, p, vpp)
vp = nd.ni_vp;
if (vp->v_usecount > 1) {
- VOP_UNLOCK(vp, 0, p);
- (void)vn_close(vp, FREAD|FWRITE, p->p_ucred, p);
- return (EBUSY);
+ error = EBUSY;
+ goto bad;
}
if (!vn_isdisk(vp)) {
- VOP_UNLOCK(vp, 0, p);
- (void)vn_close(vp, FREAD|FWRITE, p->p_ucred, p);
- return (ENOTBLK);
+ error = ENOTBLK;
+ goto bad;
}
#ifdef DEBUG
@@ -1615,8 +1615,15 @@ ccdlookup(path, p, vpp)
#endif
VOP_UNLOCK(vp, 0, p);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
*vpp = vp;
return (0);
+bad:
+ VOP_UNLOCK(vp, 0, p);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
+ /* vn_close does vrele() for vp */
+ (void)vn_close(vp, FREAD|FWRITE, p->p_ucred, p);
+ return (error);
}
/*
diff --git a/sys/dev/vinum/vinumio.c b/sys/dev/vinum/vinumio.c
index aec7696..e9f7a54 100644
--- a/sys/dev/vinum/vinumio.c
+++ b/sys/dev/vinum/vinumio.c
@@ -40,6 +40,8 @@
#include <dev/vinum/vinumhdr.h>
#include <dev/vinum/request.h>
+#include <vm/vm_zone.h>
+
static char *sappend(char *txt, char *s);
static int drivecmp(const void *va, const void *vb);
@@ -77,6 +79,7 @@ open_drive(struct drive *drive, struct proc *p, int verbose)
drive->vp->v_usecount);
}
if (!vn_isdisk(drive->vp)) { /* only consider block devices */
+ NDFREE(&nd, NDF_ONLY_PNBUF);
VOP_UNLOCK(drive->vp, 0, drive->p);
close_drive(drive);
drive->lasterror = ENOTBLK;
@@ -88,6 +91,7 @@ open_drive(struct drive *drive, struct proc *p, int verbose)
}
drive->vp->v_numoutput = 0;
VOP_UNLOCK(drive->vp, 0, drive->p);
+ NDFREE(&nd, NDF_NO_VP_RELE);
return 0;
}
diff --git a/sys/dev/vn/vn.c b/sys/dev/vn/vn.c
index 0c16450..0d8e9e3 100644
--- a/sys/dev/vn/vn.c
+++ b/sys/dev/vn/vn.c
@@ -534,6 +534,7 @@ vniocattach_file(vn, vio, dev, flag, p)
if (error)
return (error);
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_vp->v_type != VREG ||
(error = VOP_GETATTR(nd.ni_vp, &vattr, p->p_ucred, p))) {
VOP_UNLOCK(nd.ni_vp, 0, p);
diff --git a/sys/fs/cd9660/cd9660_vfsops.c b/sys/fs/cd9660/cd9660_vfsops.c
index 8702879..3ecdb06 100644
--- a/sys/fs/cd9660/cd9660_vfsops.c
+++ b/sys/fs/cd9660/cd9660_vfsops.c
@@ -54,6 +54,8 @@
#include <sys/stat.h>
#include <sys/syslog.h>
+#include <vm/vm_zone.h>
+
#include <isofs/cd9660/iso.h>
#include <isofs/cd9660/iso_rrip.h>
#include <isofs/cd9660/cd9660_node.h>
@@ -209,6 +211,7 @@ cd9660_mount(mp, path, data, ndp, p)
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p);
if ((error = namei(ndp)))
return (error);
+ NDFREE(ndp, NDF_ONLY_PNBUF);
devvp = ndp->ni_vp;
if (!vn_isdisk(devvp)) {
diff --git a/sys/fs/cd9660/cd9660_vnops.c b/sys/fs/cd9660/cd9660_vnops.c
index 2f93731..65ad938 100644
--- a/sys/fs/cd9660/cd9660_vnops.c
+++ b/sys/fs/cd9660/cd9660_vnops.c
@@ -73,7 +73,6 @@ static int iso_uiodir __P((struct isoreaddir *idp, struct dirent *dp,
static int iso_shipdir __P((struct isoreaddir *idp));
static int cd9660_readdir __P((struct vop_readdir_args *));
static int cd9660_readlink __P((struct vop_readlink_args *ap));
-static int cd9660_abortop __P((struct vop_abortop_args *));
static int cd9660_strategy __P((struct vop_strategy_args *));
static int cd9660_print __P((struct vop_print_args *));
static int cd9660_getpages __P((struct vop_getpages_args *));
@@ -737,22 +736,6 @@ cd9660_readlink(ap)
}
/*
- * Ufs abort op, called after namei() when a CREATE/DELETE isn't actually
- * done. If a buffer has been saved in anticipation of a CREATE, delete it.
- */
-static int
-cd9660_abortop(ap)
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap;
-{
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- return (0);
-}
-
-/*
* Calculate the logical to physical mapping if not done already,
* then call the device strategy routine.
*/
@@ -880,7 +863,6 @@ cd9660_putpages(ap)
vop_t **cd9660_vnodeop_p;
static struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_abortop_desc, (vop_t *) cd9660_abortop },
{ &vop_access_desc, (vop_t *) cd9660_access },
{ &vop_bmap_desc, (vop_t *) cd9660_bmap },
{ &vop_cachedlookup_desc, (vop_t *) cd9660_lookup },
diff --git a/sys/fs/coda/coda_vfsops.c b/sys/fs/coda/coda_vfsops.c
index 615289c..04cf95b 100644
--- a/sys/fs/coda/coda_vfsops.c
+++ b/sys/fs/coda/coda_vfsops.c
@@ -56,6 +56,8 @@
#include <sys/mount.h>
#include <sys/select.h>
+#include <vm/vm_zone.h>
+
#include <coda/coda.h>
#include <coda/cnode.h>
#include <coda/coda_vfsops.h>
@@ -134,7 +136,6 @@ coda_mount(vfsp, path, data, ndp, p)
}
/* Validate mount device. Similar to getmdev(). */
-
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, data, p);
error = namei(ndp);
dvp = ndp->ni_vp;
@@ -146,10 +147,12 @@ coda_mount(vfsp, path, data, ndp, p)
if (dvp->v_type != VCHR) {
MARK_INT_FAIL(CODA_MOUNT_STATS);
vrele(dvp);
+ NDFREE(ndp, NDF_ONLY_PNBUF);
return(ENXIO);
}
dev = dvp->v_rdev;
vrele(dvp);
+ NDFREE(ndp, NDF_ONLY_PNBUF);
/*
* See if the device table matches our expectations.
diff --git a/sys/fs/coda/coda_vnops.c b/sys/fs/coda/coda_vnops.c
index 1ef09bc..761ebcc 100644
--- a/sys/fs/coda/coda_vnops.c
+++ b/sys/fs/coda/coda_vnops.c
@@ -131,7 +131,6 @@ struct vnodeopv_entry_desc coda_vnodeop_entries[] = {
{ &vop_symlink_desc, coda_symlink }, /* symlink */
{ &vop_readdir_desc, coda_readdir }, /* readdir */
{ &vop_readlink_desc, coda_readlink }, /* readlink */
- { &vop_abortop_desc, coda_abortop }, /* abortop */
{ &vop_inactive_desc, coda_inactive }, /* inactive */
{ &vop_reclaim_desc, coda_reclaim }, /* reclaim */
{ &vop_lock_desc, coda_lock }, /* lock */
@@ -563,6 +562,7 @@ coda_ioctl(v)
*/
if (tvp->v_op != coda_vnodeop_p) {
vrele(tvp);
+ NDFREE(&ndp, NDF_ONLY_PNBUF);
MARK_INT_FAIL(CODA_IOCTL_STATS);
CODADEBUG(CODA_IOCTL,
myprintf(("coda_ioctl error: %s not a coda object\n",
@@ -571,7 +571,7 @@ coda_ioctl(v)
}
if (iap->vi.in_size > VC_MAXDATASIZE) {
- vrele(tvp);
+ NDFREE(&ndp, 0);
return(EINVAL);
}
error = venus_ioctl(vtomi(tvp), &((VTOC(tvp))->c_fid), com, flag, data, cred, p);
@@ -582,6 +582,7 @@ coda_ioctl(v)
CODADEBUG(CODA_IOCTL, myprintf(("Ioctl returns %d \n", error)); )
vrele(tvp);
+ NDFREE(&ndp, NDF_ONLY_PNBUF);
return(error);
}
@@ -745,29 +746,6 @@ coda_access(v)
return(error);
}
-/*
- * CODA abort op, called after namei() when a CREATE/DELETE isn't actually
- * done. If a buffer has been saved in anticipation of a coda_create or
- * a coda_remove, delete it.
- */
-/* ARGSUSED */
-int
-coda_abortop(v)
- void *v;
-{
-/* true args */
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap = v;
-/* upcall decl */
-/* locals */
-
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- return (0);
-}
-
int
coda_readlink(v)
void *v;
@@ -1208,14 +1186,6 @@ coda_create(v)
}
#endif
}
- /* Have to free the previously saved name */
- /*
- * This condition is stolen from ufs_makeinode. I have no idea
- * why it's here, but what the hey...
- */
- if ((cnp->cn_flags & SAVESTART) == 0) {
- zfree(namei_zone, cnp->cn_pnbuf);
- }
return(error);
}
@@ -1276,9 +1246,6 @@ coda_remove(v)
CODADEBUG(CODA_REMOVE, myprintf(("in remove result %d\n",error)); )
- if ((cnp->cn_flags & SAVESTART) == 0) {
- zfree(namei_zone, cnp->cn_pnbuf);
- }
return(error);
}
@@ -1332,10 +1299,6 @@ coda_link(v)
CODADEBUG(CODA_LINK, myprintf(("in link result %d\n",error)); )
- /* Drop the name buffer if we don't need to SAVESTART */
- if ((cnp->cn_flags & SAVESTART) == 0) {
- zfree(namei_zone, cnp->cn_pnbuf);
- }
return(error);
}
@@ -1502,14 +1465,6 @@ coda_mkdir(v)
CODADEBUG(CODA_MKDIR, myprintf(("mkdir error %d\n",error));)
}
- /* Have to free the previously saved name */
- /*
- * ufs_mkdir doesn't check for SAVESTART before freeing the
- * pathname buffer, but ufs_create does. For the moment, I'll
- * follow their lead, but this seems like it is probably
- * incorrect.
- */
- zfree(namei_zone, cnp->cn_pnbuf);
return(error);
}
@@ -1559,9 +1514,6 @@ coda_rmdir(v)
CODADEBUG(CODA_RMDIR, myprintf(("in rmdir result %d\n", error)); )
- if ((cnp->cn_flags & SAVESTART) == 0) {
- zfree(namei_zone, cnp->cn_pnbuf);
- }
return(error);
}
diff --git a/sys/fs/fifofs/fifo_vnops.c b/sys/fs/fifofs/fifo_vnops.c
index 4a8199a..b64f957 100644
--- a/sys/fs/fifofs/fifo_vnops.c
+++ b/sys/fs/fifofs/fifo_vnops.c
@@ -79,7 +79,6 @@ static int fifo_advlock __P((struct vop_advlock_args *));
vop_t **fifo_vnodeop_p;
static struct vnodeopv_entry_desc fifo_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_abortop_desc, (vop_t *) fifo_badop },
{ &vop_access_desc, (vop_t *) vop_ebadf },
{ &vop_advlock_desc, (vop_t *) fifo_advlock },
{ &vop_bmap_desc, (vop_t *) fifo_bmap },
diff --git a/sys/fs/hpfs/hpfs_vnops.c b/sys/fs/hpfs/hpfs_vnops.c
index acc2949..e8cb76a 100644
--- a/sys/fs/hpfs/hpfs_vnops.c
+++ b/sys/fs/hpfs/hpfs_vnops.c
@@ -1318,28 +1318,9 @@ hpfs_create(ap)
error = hpfs_makefnode (ap->a_dvp, ap->a_vpp, ap->a_cnp, ap->a_vap);
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
-
return (error);
}
-static int
-hpfs_abortop(ap)
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap;
-{
- dprintf(("hpfs_abortop(0x%x, %s, %ld): \n", VTOHP(ap->a_dvp)->h_no,
- ap->a_cnp->cn_nameptr, ap->a_cnp->cn_namelen));
-
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
-
- return (0);
-}
-
/*
* Return POSIX pathconf information applicable to NTFS filesystem
*/
diff --git a/sys/fs/msdosfs/msdosfs_vfsops.c b/sys/fs/msdosfs/msdosfs_vfsops.c
index 5005de3..3fd65ec 100644
--- a/sys/fs/msdosfs/msdosfs_vfsops.c
+++ b/sys/fs/msdosfs/msdosfs_vfsops.c
@@ -60,6 +60,7 @@
#include <sys/fcntl.h>
#include <sys/malloc.h>
#include <sys/stat.h> /* defines ALLPERMS */
+#include <vm/vm_zone.h>
#include <msdosfs/bpb.h>
#include <msdosfs/bootsect.h>
@@ -288,6 +289,7 @@ msdosfs_mount(mp, path, data, ndp, p)
if (error)
return (error);
devvp = ndp->ni_vp;
+ NDFREE(ndp, NDF_ONLY_PNBUF);
if (!vn_isdisk(devvp)) {
vrele(devvp);
diff --git a/sys/fs/msdosfs/msdosfs_vnops.c b/sys/fs/msdosfs/msdosfs_vnops.c
index 05139a7..3ef8e74 100644
--- a/sys/fs/msdosfs/msdosfs_vnops.c
+++ b/sys/fs/msdosfs/msdosfs_vnops.c
@@ -93,7 +93,6 @@ static int msdosfs_mkdir __P((struct vop_mkdir_args *));
static int msdosfs_rmdir __P((struct vop_rmdir_args *));
static int msdosfs_symlink __P((struct vop_symlink_args *));
static int msdosfs_readdir __P((struct vop_readdir_args *));
-static int msdosfs_abortop __P((struct vop_abortop_args *));
static int msdosfs_bmap __P((struct vop_bmap_args *));
static int msdosfs_strategy __P((struct vop_strategy_args *));
static int msdosfs_print __P((struct vop_print_args *));
@@ -185,13 +184,10 @@ msdosfs_create(ap)
error = createde(&ndirent, pdep, &dep, cnp);
if (error)
goto bad;
- if ((cnp->cn_flags & SAVESTART) == 0)
- zfree(namei_zone, cnp->cn_pnbuf);
*ap->a_vpp = DETOV(dep);
return (0);
bad:
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -215,7 +211,6 @@ msdosfs_mknod(ap)
break;
default:
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
return (EINVAL);
}
/* NOTREACHED */
@@ -906,7 +901,6 @@ msdosfs_link(ap)
struct componentname *a_cnp;
} */ *ap;
{
- VOP_ABORTOP(ap->a_tdvp, ap->a_cnp);
return (EOPNOTSUPP);
}
@@ -1015,14 +1009,12 @@ msdosfs_rename(ap)
(tvp && (fvp->v_mount != tvp->v_mount))) {
error = EXDEV;
abortit:
- VOP_ABORTOP(tdvp, tcnp);
if (tdvp == tvp)
vrele(tdvp);
else
vput(tdvp);
if (tvp)
vput(tvp);
- VOP_ABORTOP(fdvp, fcnp);
vrele(fdvp);
vrele(fvp);
return (error);
@@ -1420,15 +1412,12 @@ msdosfs_mkdir(ap)
error = createde(&ndirent, pdep, &dep, cnp);
if (error)
goto bad;
- if ((cnp->cn_flags & SAVESTART) == 0)
- zfree(namei_zone, cnp->cn_pnbuf);
*ap->a_vpp = DETOV(dep);
return (0);
bad:
clusterfree(pmp, newcluster, NULL);
bad2:
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -1504,8 +1493,6 @@ msdosfs_symlink(ap)
char *a_target;
} */ *ap;
{
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- /* VOP_ABORTOP(ap->a_dvp, ap->a_cnp); ??? */
return (EOPNOTSUPP);
}
@@ -1776,18 +1763,6 @@ out:
return (error);
}
-static int
-msdosfs_abortop(ap)
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap;
-{
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- return (0);
-}
-
/*
* vp - address of vnode file the file
* bn - which cluster we are interested in mapping to a filesystem block number.
@@ -1950,7 +1925,6 @@ msdosfs_putpages(ap)
vop_t **msdosfs_vnodeop_p;
static struct vnodeopv_entry_desc msdosfs_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_abortop_desc, (vop_t *) msdosfs_abortop },
{ &vop_access_desc, (vop_t *) msdosfs_access },
{ &vop_bmap_desc, (vop_t *) msdosfs_bmap },
{ &vop_cachedlookup_desc, (vop_t *) msdosfs_lookup },
diff --git a/sys/fs/ntfs/ntfs_vfsops.c b/sys/fs/ntfs/ntfs_vfsops.c
index 9ad0775..6bc0555 100644
--- a/sys/fs/ntfs/ntfs_vfsops.c
+++ b/sys/fs/ntfs/ntfs_vfsops.c
@@ -53,6 +53,7 @@
#include <vm/vm_page.h>
#include <vm/vm_object.h>
#include <vm/vm_extern.h>
+#include <vm/vm_zone.h>
#if defined(__NetBSD__)
#include <miscfs/specfs/specdev.h>
@@ -316,7 +317,7 @@ ntfs_mount (
/* can't get devvp!*/
goto error_1;
}
-
+ NDFREE(ndp, NDF_ONLY_PNBUF);
devvp = ndp->ni_vp;
#if defined(__FreeBSD__)
diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c
index e48a516..1bdc083 100644
--- a/sys/fs/nullfs/null_vfsops.c
+++ b/sys/fs/nullfs/null_vfsops.c
@@ -53,6 +53,7 @@
#include <sys/mount.h>
#include <sys/namei.h>
#include <miscfs/nullfs/null.h>
+#include <vm/vm_zone.h>
static MALLOC_DEFINE(M_NULLFSMNT, "NULLFS mount", "NULLFS mount structure");
@@ -137,6 +138,7 @@ nullfs_mount(mp, path, data, ndp, p)
if (error)
return (error);
+ NDFREE(ndp, NDF_ONLY_PNBUF);
/*
* Sanity check on lower vnode
diff --git a/sys/fs/nwfs/nwfs_vnops.c b/sys/fs/nwfs/nwfs_vnops.c
index 29d7a82..22df1b3 100644
--- a/sys/fs/nwfs/nwfs_vnops.c
+++ b/sys/fs/nwfs/nwfs_vnops.c
@@ -77,7 +77,6 @@ static int nwfs_mkdir __P((struct vop_mkdir_args *));
static int nwfs_rmdir __P((struct vop_rmdir_args *));
static int nwfs_symlink __P((struct vop_symlink_args *));
static int nwfs_readdir __P((struct vop_readdir_args *));
-static int nwfs_abortop __P((struct vop_abortop_args *));
static int nwfs_bmap __P((struct vop_bmap_args *));
static int nwfs_strategy __P((struct vop_strategy_args *));
static int nwfs_print __P((struct vop_print_args *));
@@ -87,7 +86,6 @@ static int nwfs_pathconf __P((struct vop_pathconf_args *ap));
vop_t **nwfs_vnodeop_p;
static struct vnodeopv_entry_desc nwfs_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_abortop_desc, (vop_t *) nwfs_abortop },
{ &vop_access_desc, (vop_t *) nwfs_access },
{ &vop_bmap_desc, (vop_t *) nwfs_bmap },
{ &vop_open_desc, (vop_t *) nwfs_open },
@@ -453,7 +451,6 @@ nwfs_create(ap)
if (vap->va_type == VSOCK)
return (EOPNOTSUPP);
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc))) {
- VOP_ABORTOP(dvp, cnp);
return (error);
}
fmode = AR_READ | AR_WRITE;
@@ -476,7 +473,6 @@ nwfs_create(ap)
if (cnp->cn_flags & MAKEENTRY)
cache_enter(dvp, vp, cnp);
}
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -510,7 +506,6 @@ nwfs_remove(ap)
cnp->cn_namelen,cnp->cn_nameptr,cnp->cn_proc,cnp->cn_cred);
if (error == 0x899c) error = EACCES;
}
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -604,9 +599,7 @@ out:
/*
* nwfs hard link create call
- * Netware filesystems don't know what links are. But since we already called
- * nwfs_lookup() with create and lockparent, the parent is locked so we
- * have to free it before we return the error.
+ * Netware filesystems don't know what links are.
*/
static int
nwfs_link(ap)
@@ -616,8 +609,6 @@ nwfs_link(ap)
struct componentname *a_cnp;
} */ *ap;
{
-/* VOP_ABORTOP(ap->a_tdvp, ap->a_cnp);*/
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
return EOPNOTSUPP;
}
@@ -635,8 +626,6 @@ nwfs_symlink(ap)
char *a_target;
} */ *ap;
{
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- /* VOP_ABORTOP(ap->a_dvp, ap->a_cnp); ??? */
return (EOPNOTSUPP);
}
@@ -672,11 +661,9 @@ nwfs_mkdir(ap)
char *name=cnp->cn_nameptr;
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc))) {
- VOP_ABORTOP(dvp, cnp);
return (error);
}
if ((name[0] == '.') && ((len == 1) || ((len == 2) && (name[1] == '.')))) {
- VOP_ABORTOP(dvp, cnp);
return EEXIST;
}
if (ncp_open_create_file_or_subdir(VTONWFS(dvp),dvp, cnp->cn_namelen,
@@ -696,7 +683,6 @@ nwfs_mkdir(ap)
*ap->a_vpp = newvp;
}
}
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -724,7 +710,6 @@ nwfs_rmdir(ap)
error = ncp_DeleteNSEntry(nmp, dnp->n_fid.f_id,
cnp->cn_namelen, cnp->cn_nameptr,cnp->cn_proc,cnp->cn_cred);
if (error == NWE_DIR_NOT_EMPTY) error = ENOTEMPTY;
- zfree(namei_zone, cnp->cn_pnbuf);
dnp->n_flag |= NMODIFIED;
nwfs_attr_cacheremove(dvp);
cache_purge(dvp);
@@ -864,23 +849,6 @@ nwfs_bmap(ap)
*ap->a_runb = 0;
return (0);
}
-/*
- * nwfs abort op, called after namei() when a CREATE/DELETE isn't actually
- * done. Currently nothing to do.
- */
-/* ARGSUSED */
-int
-nwfs_abortop(ap)
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap;
-{
-
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- return (0);
-}
int
nwfs_nget(struct mount *mp, ncpfid fid, struct nw_entry_info *fap,
diff --git a/sys/fs/procfs/procfs_vnops.c b/sys/fs/procfs/procfs_vnops.c
index 17075db..d7de7ce 100644
--- a/sys/fs/procfs/procfs_vnops.c
+++ b/sys/fs/procfs/procfs_vnops.c
@@ -60,7 +60,6 @@
#include <miscfs/procfs/procfs.h>
#include <sys/pioctl.h>
-static int procfs_abortop __P((struct vop_abortop_args *));
static int procfs_access __P((struct vop_access_args *));
static int procfs_badop __P((void));
static int procfs_bmap __P((struct vop_bmap_args *));
@@ -391,25 +390,6 @@ procfs_print(ap)
}
/*
- * _abortop is called when operations such as
- * rename and create fail. this entry is responsible
- * for undoing any side-effects caused by the lookup.
- * this will always include freeing the pathname buffer.
- */
-static int
-procfs_abortop(ap)
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap;
-{
-
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- return (0);
-}
-
-/*
* generic entry point for unsupported operations
*/
static int
@@ -997,7 +977,6 @@ atopid(b, len)
vop_t **procfs_vnodeop_p;
static struct vnodeopv_entry_desc procfs_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_abortop_desc, (vop_t *) procfs_abortop },
{ &vop_access_desc, (vop_t *) procfs_access },
{ &vop_advlock_desc, (vop_t *) procfs_badop },
{ &vop_bmap_desc, (vop_t *) procfs_bmap },
diff --git a/sys/fs/umapfs/umap_vfsops.c b/sys/fs/umapfs/umap_vfsops.c
index afa44f0..48894fe 100644
--- a/sys/fs/umapfs/umap_vfsops.c
+++ b/sys/fs/umapfs/umap_vfsops.c
@@ -52,6 +52,7 @@
#include <sys/namei.h>
#include <sys/malloc.h>
#include <miscfs/umapfs/umap.h>
+#include <vm/vm_zone.h>
static MALLOC_DEFINE(M_UMAPFSMNT, "UMAP mount", "UMAP mount structure");
@@ -129,6 +130,7 @@ umapfs_mount(mp, path, data, ndp, p)
error = namei(ndp);
if (error)
return (error);
+ NDFREE(ndp, NDF_ONLY_PNBUF);
/*
* Sanity check on lower vnode
diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c
index d7caf10..6b88bef 100644
--- a/sys/fs/unionfs/union_subr.c
+++ b/sys/fs/unionfs/union_subr.c
@@ -846,8 +846,6 @@ union_relookup(um, dvp, vpp, cnp, cn, path, pathlen)
* by namei, some of the work done by lookup and some of
* the work done by VOP_LOOKUP when given a CREATE flag.
* Conclusion: Horrible.
- *
- * The pathname buffer will be FREEed by VOP_MKDIR.
*/
cn->cn_namelen = pathlen;
cn->cn_pnbuf = zalloc(namei_zone);
@@ -874,8 +872,6 @@ union_relookup(um, dvp, vpp, cnp, cn, path, pathlen)
*/
if ((error = relookup(dvp, vpp, cn)) != 0) {
- zfree(namei_zone, cn->cn_pnbuf);
- cn->cn_pnbuf = NULL;
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, cnp->cn_proc);
return(error);
}
@@ -921,7 +917,10 @@ union_mkshadow(um, dvp, cnp, vpp)
return (error);
if (*vpp) {
- VOP_ABORTOP(dvp, &cn);
+ if (cn.cn_flags & HASBUF) {
+ zfree(namei_zone, cn.cn_pnbuf);
+ cn.cn_flags &= ~HASBUF;
+ }
if (dvp == *vpp)
vrele(*vpp);
else
@@ -946,6 +945,10 @@ union_mkshadow(um, dvp, cnp, vpp)
VOP_LEASE(dvp, p, cn.cn_cred, LEASE_WRITE);
error = VOP_MKDIR(dvp, vpp, &cn, &va);
+ if (cn.cn_flags & HASBUF) {
+ zfree(namei_zone, cn.cn_pnbuf);
+ cn.cn_flags &= ~HASBUF;
+ }
/*vput(dvp);*/
return (error);
}
@@ -976,7 +979,10 @@ union_mkwhiteout(um, dvp, cnp, path)
return (error);
if (wvp) {
- VOP_ABORTOP(dvp, &cn);
+ if (cn.cn_flags & HASBUF) {
+ zfree(namei_zone, cn.cn_pnbuf);
+ cn.cn_flags &= ~HASBUF;
+ }
if (wvp == dvp)
vrele(wvp);
else
@@ -988,8 +994,10 @@ union_mkwhiteout(um, dvp, cnp, path)
VOP_LEASE(dvp, p, p->p_ucred, LEASE_WRITE);
error = VOP_WHITEOUT(dvp, &cn, CREATE);
- if (error)
- VOP_ABORTOP(dvp, &cn);
+ if (cn.cn_flags & HASBUF) {
+ zfree(namei_zone, cn.cn_pnbuf);
+ cn.cn_flags &= ~HASBUF;
+ }
return (error);
}
@@ -1059,7 +1067,10 @@ union_vn_create(vpp, un, p)
*/
if (vp) {
vput(un->un_dirvp);
- VOP_ABORTOP(un->un_dirvp, &cn);
+ if (cn.cn_flags & HASBUF) {
+ zfree(namei_zone, cn.cn_pnbuf);
+ cn.cn_flags &= ~HASBUF;
+ }
if (vp == un->un_dirvp)
vrele(vp);
else
@@ -1082,6 +1093,10 @@ union_vn_create(vpp, un, p)
vap->va_mode = cmode;
VOP_LEASE(un->un_dirvp, p, cred, LEASE_WRITE);
error = VOP_CREATE(un->un_dirvp, &vp, &cn, vap);
+ if (cn.cn_flags & HASBUF) {
+ zfree(namei_zone, cn.cn_pnbuf);
+ cn.cn_flags &= ~HASBUF;
+ }
vput(un->un_dirvp);
if (error)
return (error);
diff --git a/sys/fs/unionfs/union_vfsops.c b/sys/fs/unionfs/union_vfsops.c
index ccd9a13..f5782fa 100644
--- a/sys/fs/unionfs/union_vfsops.c
+++ b/sys/fs/unionfs/union_vfsops.c
@@ -52,6 +52,7 @@
#include <sys/malloc.h>
#include <sys/filedesc.h>
#include <miscfs/union/union.h>
+#include <vm/vm_zone.h>
static MALLOC_DEFINE(M_UNIONFSMNT, "UNION mount", "UNION mount structure");
@@ -144,6 +145,7 @@ union_mount(mp, path, data, ndp, p)
if (error)
goto bad;
+ NDFREE(ndp, NDF_ONLY_PNBUF);
upperrootvp = ndp->ni_vp;
vrele(ndp->ni_dvp);
ndp->ni_dvp = NULL;
diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c
index 5ab1036..03d41a0 100644
--- a/sys/fs/unionfs/union_vnops.c
+++ b/sys/fs/unionfs/union_vnops.c
@@ -67,7 +67,6 @@ SYSCTL_INT(_vfs, OID_AUTO, uniondebug, CTLFLAG_RW, &uniondebug, 0, "");
SYSCTL_INT(_vfs, OID_AUTO, uniondebug, CTLFLAG_RD, &uniondebug, 0, "");
#endif
-static int union_abortop __P((struct vop_abortop_args *ap));
static int union_access __P((struct vop_access_args *ap));
static int union_advlock __P((struct vop_advlock_args *ap));
static int union_bmap __P((struct vop_bmap_args *ap));
@@ -1682,43 +1681,6 @@ union_readlink(ap)
}
/*
- * union_abortop:
- *
- * dvp is locked on entry and left locked on return
- *
- */
-
-static int
-union_abortop(ap)
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap;
-{
- struct componentname *cnp = ap->a_cnp;
- struct proc *p = cnp->cn_proc;
- struct union_node *un = VTOUNION(ap->a_dvp);
- int islocked = VOP_ISLOCKED(ap->a_dvp, NULL);
- struct vnode *vp;
- int error;
-
- if (islocked) {
- vp = union_lock_other(un, p);
- } else {
- vp = OTHERVP(ap->a_dvp);
- }
- KASSERT(vp != NULL, ("union_abortop: backing vnode missing!"));
-
- ap->a_dvp = vp;
- error = VCALL(vp, VOFFSET(vop_abortop), ap);
-
- if (islocked)
- union_unlock_other(vp, p);
-
- return (error);
-}
-
-/*
* union_inactive:
*
* Called with the vnode locked. We are expected to unlock the vnode.
@@ -1974,7 +1936,6 @@ union_strategy(ap)
vop_t **union_vnodeop_p;
static struct vnodeopv_entry_desc union_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_abortop_desc, (vop_t *) union_abortop },
{ &vop_access_desc, (vop_t *) union_access },
{ &vop_advlock_desc, (vop_t *) union_advlock },
{ &vop_bmap_desc, (vop_t *) union_bmap },
diff --git a/sys/geom/geom_ccd.c b/sys/geom/geom_ccd.c
index 7f14c78..b70f8c2 100644
--- a/sys/geom/geom_ccd.c
+++ b/sys/geom/geom_ccd.c
@@ -109,6 +109,8 @@
#include <sys/ccdvar.h>
+#include <vm/vm_zone.h>
+
#if defined(CCDDEBUG) && !defined(DEBUG)
#define DEBUG
#endif
@@ -1598,15 +1600,13 @@ ccdlookup(path, p, vpp)
vp = nd.ni_vp;
if (vp->v_usecount > 1) {
- VOP_UNLOCK(vp, 0, p);
- (void)vn_close(vp, FREAD|FWRITE, p->p_ucred, p);
- return (EBUSY);
+ error = EBUSY;
+ goto bad;
}
if (!vn_isdisk(vp)) {
- VOP_UNLOCK(vp, 0, p);
- (void)vn_close(vp, FREAD|FWRITE, p->p_ucred, p);
- return (ENOTBLK);
+ error = ENOTBLK;
+ goto bad;
}
#ifdef DEBUG
@@ -1615,8 +1615,15 @@ ccdlookup(path, p, vpp)
#endif
VOP_UNLOCK(vp, 0, p);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
*vpp = vp;
return (0);
+bad:
+ VOP_UNLOCK(vp, 0, p);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
+ /* vn_close does vrele() for vp */
+ (void)vn_close(vp, FREAD|FWRITE, p->p_ucred, p);
+ return (error);
}
/*
diff --git a/sys/gnu/ext2fs/ext2_vfsops.c b/sys/gnu/ext2fs/ext2_vfsops.c
index 30b5d45..b85dbcc 100644
--- a/sys/gnu/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/ext2fs/ext2_vfsops.c
@@ -61,6 +61,8 @@
#include <ufs/ufs/inode.h>
#include <ufs/ufs/ufs_extern.h>
+#include <vm/vm_zone.h>
+
#include <gnu/ext2fs/fs.h>
#include <gnu/ext2fs/ext2_extern.h>
#include <gnu/ext2fs/ext2_fs.h>
@@ -259,6 +261,7 @@ ext2_mount(mp, path, data, ndp, p)
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p);
if ((error = namei(ndp)) != 0)
return (error);
+ NDFREE(ndp, NDF_ONLY_PNBUF);
devvp = ndp->ni_vp;
if (!vn_isdisk(devvp)) {
diff --git a/sys/gnu/ext2fs/ext2_vnops.c b/sys/gnu/ext2fs/ext2_vnops.c
index c1fcc83..d7b84ad 100644
--- a/sys/gnu/ext2fs/ext2_vnops.c
+++ b/sys/gnu/ext2fs/ext2_vnops.c
@@ -329,22 +329,18 @@ ext2_link(ap)
panic("ufs_link: no name");
#endif
if (tdvp->v_mount != vp->v_mount) {
- VOP_ABORTOP(tdvp, cnp);
error = EXDEV;
goto out2;
}
if (tdvp != vp && (error = vn_lock(vp, LK_EXCLUSIVE, p))) {
- VOP_ABORTOP(tdvp, cnp);
goto out2;
}
ip = VTOI(vp);
if ((nlink_t)ip->i_nlink >= LINK_MAX) {
- VOP_ABORTOP(tdvp, cnp);
error = EMLINK;
goto out1;
}
if (ip->i_flags & (IMMUTABLE | APPEND)) {
- VOP_ABORTOP(tdvp, cnp);
error = EPERM;
goto out1;
}
@@ -357,7 +353,6 @@ ext2_link(ap)
ip->i_nlink--;
ip->i_flag |= IN_CHANGE;
}
- zfree(namei_zone, cnp->cn_pnbuf);
out1:
if (tdvp != vp)
VOP_UNLOCK(vp, 0, p);
@@ -405,14 +400,12 @@ ext2_rename(ap)
(tvp && (fvp->v_mount != tvp->v_mount))) {
error = EXDEV;
abortit:
- VOP_ABORTOP(tdvp, tcnp); /* XXX, why not in NFS? */
if (tdvp == tvp)
vrele(tdvp);
else
vput(tdvp);
if (tvp)
vput(tvp);
- VOP_ABORTOP(fdvp, fcnp); /* XXX, why not in NFS? */
vrele(fdvp);
vrele(fvp);
return (error);
@@ -446,7 +439,6 @@ abortit:
}
/* Release destination completely. */
- VOP_ABORTOP(tdvp, tcnp);
vput(tdvp);
vput(tvp);
@@ -460,8 +452,6 @@ abortit:
vrele(fvp);
fcnp->cn_flags &= ~MODMASK;
fcnp->cn_flags |= LOCKPARENT | LOCKLEAF;
- if ((fcnp->cn_flags & SAVESTART) == 0)
- panic("ufs_rename: lost from startdir");
fcnp->cn_nameiop = DELETE;
VREF(fdvp);
error = relookup(fdvp, &fvp, fcnp);
@@ -558,8 +548,6 @@ abortit:
error = ext2_checkpath(ip, dp, tcnp->cn_cred);
if (error)
goto out;
- if ((tcnp->cn_flags & SAVESTART) == 0)
- panic("ufs_rename: lost to startdir");
VREF(tdvp);
error = relookup(tdvp, &tvp, tcnp);
if (error)
@@ -687,8 +675,6 @@ abortit:
*/
fcnp->cn_flags &= ~MODMASK;
fcnp->cn_flags |= LOCKPARENT | LOCKLEAF;
- if ((fcnp->cn_flags & SAVESTART) == 0)
- panic("ufs_rename: lost from startdir");
VREF(fdvp);
error = relookup(fdvp, &fvp, fcnp);
if (error == 0)
@@ -873,7 +859,6 @@ ext2_mkdir(ap)
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, ucp, 0))) {
- zfree(namei_zone, cnp->cn_pnbuf);
UFS_VFREE(tvp, ip->i_number, dmode);
vput(tvp);
return (error);
@@ -885,7 +870,6 @@ ext2_mkdir(ap)
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, cnp->cn_cred, 0))) {
- zfree(namei_zone, cnp->cn_pnbuf);
UFS_VFREE(tvp, ip->i_number, dmode);
vput(tvp);
return (error);
@@ -956,7 +940,6 @@ bad:
} else
*ap->a_vpp = tvp;
out:
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
#undef DIRBLKSIZ
#define DIRBLKSIZ DEV_BSIZE
@@ -1093,7 +1076,6 @@ ext2_makeinode(mode, dvp, vpp, cnp)
error = UFS_VALLOC(dvp, mode, cnp->cn_cred, &tvp);
if (error) {
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
ip = VTOI(tvp);
@@ -1138,7 +1120,6 @@ ext2_makeinode(mode, dvp, vpp, cnp)
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, ucp, 0))) {
- zfree(namei_zone, cnp->cn_pnbuf);
UFS_VFREE(tvp, ip->i_number, mode);
vput(tvp);
return (error);
@@ -1150,7 +1131,6 @@ ext2_makeinode(mode, dvp, vpp, cnp)
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, cnp->cn_cred, 0))) {
- zfree(namei_zone, cnp->cn_pnbuf);
UFS_VFREE(tvp, ip->i_number, mode);
vput(tvp);
return (error);
@@ -1178,8 +1158,6 @@ ext2_makeinode(mode, dvp, vpp, cnp)
if (error)
goto bad;
- if ((cnp->cn_flags & SAVESTART) == 0)
- zfree(namei_zone, cnp->cn_pnbuf);
*vpp = tvp;
return (0);
@@ -1188,7 +1166,6 @@ bad:
* Write error occurred trying to update the inode
* or the directory so must deallocate the inode.
*/
- zfree(namei_zone, cnp->cn_pnbuf);
ip->i_nlink = 0;
ip->i_flag |= IN_CHANGE;
vput(tvp);
diff --git a/sys/gnu/fs/ext2fs/ext2_vfsops.c b/sys/gnu/fs/ext2fs/ext2_vfsops.c
index 30b5d45..b85dbcc 100644
--- a/sys/gnu/fs/ext2fs/ext2_vfsops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vfsops.c
@@ -61,6 +61,8 @@
#include <ufs/ufs/inode.h>
#include <ufs/ufs/ufs_extern.h>
+#include <vm/vm_zone.h>
+
#include <gnu/ext2fs/fs.h>
#include <gnu/ext2fs/ext2_extern.h>
#include <gnu/ext2fs/ext2_fs.h>
@@ -259,6 +261,7 @@ ext2_mount(mp, path, data, ndp, p)
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p);
if ((error = namei(ndp)) != 0)
return (error);
+ NDFREE(ndp, NDF_ONLY_PNBUF);
devvp = ndp->ni_vp;
if (!vn_isdisk(devvp)) {
diff --git a/sys/gnu/fs/ext2fs/ext2_vnops.c b/sys/gnu/fs/ext2fs/ext2_vnops.c
index c1fcc83..d7b84ad 100644
--- a/sys/gnu/fs/ext2fs/ext2_vnops.c
+++ b/sys/gnu/fs/ext2fs/ext2_vnops.c
@@ -329,22 +329,18 @@ ext2_link(ap)
panic("ufs_link: no name");
#endif
if (tdvp->v_mount != vp->v_mount) {
- VOP_ABORTOP(tdvp, cnp);
error = EXDEV;
goto out2;
}
if (tdvp != vp && (error = vn_lock(vp, LK_EXCLUSIVE, p))) {
- VOP_ABORTOP(tdvp, cnp);
goto out2;
}
ip = VTOI(vp);
if ((nlink_t)ip->i_nlink >= LINK_MAX) {
- VOP_ABORTOP(tdvp, cnp);
error = EMLINK;
goto out1;
}
if (ip->i_flags & (IMMUTABLE | APPEND)) {
- VOP_ABORTOP(tdvp, cnp);
error = EPERM;
goto out1;
}
@@ -357,7 +353,6 @@ ext2_link(ap)
ip->i_nlink--;
ip->i_flag |= IN_CHANGE;
}
- zfree(namei_zone, cnp->cn_pnbuf);
out1:
if (tdvp != vp)
VOP_UNLOCK(vp, 0, p);
@@ -405,14 +400,12 @@ ext2_rename(ap)
(tvp && (fvp->v_mount != tvp->v_mount))) {
error = EXDEV;
abortit:
- VOP_ABORTOP(tdvp, tcnp); /* XXX, why not in NFS? */
if (tdvp == tvp)
vrele(tdvp);
else
vput(tdvp);
if (tvp)
vput(tvp);
- VOP_ABORTOP(fdvp, fcnp); /* XXX, why not in NFS? */
vrele(fdvp);
vrele(fvp);
return (error);
@@ -446,7 +439,6 @@ abortit:
}
/* Release destination completely. */
- VOP_ABORTOP(tdvp, tcnp);
vput(tdvp);
vput(tvp);
@@ -460,8 +452,6 @@ abortit:
vrele(fvp);
fcnp->cn_flags &= ~MODMASK;
fcnp->cn_flags |= LOCKPARENT | LOCKLEAF;
- if ((fcnp->cn_flags & SAVESTART) == 0)
- panic("ufs_rename: lost from startdir");
fcnp->cn_nameiop = DELETE;
VREF(fdvp);
error = relookup(fdvp, &fvp, fcnp);
@@ -558,8 +548,6 @@ abortit:
error = ext2_checkpath(ip, dp, tcnp->cn_cred);
if (error)
goto out;
- if ((tcnp->cn_flags & SAVESTART) == 0)
- panic("ufs_rename: lost to startdir");
VREF(tdvp);
error = relookup(tdvp, &tvp, tcnp);
if (error)
@@ -687,8 +675,6 @@ abortit:
*/
fcnp->cn_flags &= ~MODMASK;
fcnp->cn_flags |= LOCKPARENT | LOCKLEAF;
- if ((fcnp->cn_flags & SAVESTART) == 0)
- panic("ufs_rename: lost from startdir");
VREF(fdvp);
error = relookup(fdvp, &fvp, fcnp);
if (error == 0)
@@ -873,7 +859,6 @@ ext2_mkdir(ap)
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, ucp, 0))) {
- zfree(namei_zone, cnp->cn_pnbuf);
UFS_VFREE(tvp, ip->i_number, dmode);
vput(tvp);
return (error);
@@ -885,7 +870,6 @@ ext2_mkdir(ap)
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, cnp->cn_cred, 0))) {
- zfree(namei_zone, cnp->cn_pnbuf);
UFS_VFREE(tvp, ip->i_number, dmode);
vput(tvp);
return (error);
@@ -956,7 +940,6 @@ bad:
} else
*ap->a_vpp = tvp;
out:
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
#undef DIRBLKSIZ
#define DIRBLKSIZ DEV_BSIZE
@@ -1093,7 +1076,6 @@ ext2_makeinode(mode, dvp, vpp, cnp)
error = UFS_VALLOC(dvp, mode, cnp->cn_cred, &tvp);
if (error) {
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
ip = VTOI(tvp);
@@ -1138,7 +1120,6 @@ ext2_makeinode(mode, dvp, vpp, cnp)
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, ucp, 0))) {
- zfree(namei_zone, cnp->cn_pnbuf);
UFS_VFREE(tvp, ip->i_number, mode);
vput(tvp);
return (error);
@@ -1150,7 +1131,6 @@ ext2_makeinode(mode, dvp, vpp, cnp)
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, cnp->cn_cred, 0))) {
- zfree(namei_zone, cnp->cn_pnbuf);
UFS_VFREE(tvp, ip->i_number, mode);
vput(tvp);
return (error);
@@ -1178,8 +1158,6 @@ ext2_makeinode(mode, dvp, vpp, cnp)
if (error)
goto bad;
- if ((cnp->cn_flags & SAVESTART) == 0)
- zfree(namei_zone, cnp->cn_pnbuf);
*vpp = tvp;
return (0);
@@ -1188,7 +1166,6 @@ bad:
* Write error occurred trying to update the inode
* or the directory so must deallocate the inode.
*/
- zfree(namei_zone, cnp->cn_pnbuf);
ip->i_nlink = 0;
ip->i_flag |= IN_CHANGE;
vput(tvp);
diff --git a/sys/i386/ibcs2/ibcs2_stat.c b/sys/i386/ibcs2/ibcs2_stat.c
index 36990c3..863e6e0 100644
--- a/sys/i386/ibcs2/ibcs2_stat.c
+++ b/sys/i386/ibcs2/ibcs2_stat.c
@@ -24,6 +24,8 @@
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ *
+ * $FreeBSD$
*/
#include <sys/param.h>
@@ -45,6 +47,8 @@
#include <i386/ibcs2/ibcs2_util.h>
#include <i386/ibcs2/ibcs2_utsname.h>
+#include <vm/vm_zone.h>
+
static void bsd_stat2ibcs_stat __P((struct stat *, struct ibcs2_stat *));
static int cvt_statfs __P((struct statfs *, caddr_t, int));
@@ -106,6 +110,7 @@ ibcs2_statfs(p, uap)
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
mp = nd.ni_vp->v_mount;
sp = &mp->mnt_stat;
vrele(nd.ni_vp);
diff --git a/sys/i386/ibcs2/ibcs2_util.c b/sys/i386/ibcs2/ibcs2_util.c
index 2ae6f2d..e90b3d9 100644
--- a/sys/i386/ibcs2/ibcs2_util.c
+++ b/sys/i386/ibcs2/ibcs2_util.c
@@ -27,6 +27,7 @@
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* from: svr4_util.c,v 1.5 1995/01/22 23:44:50 christos Exp
+ * $FreeBSD$
*/
#include <sys/param.h>
@@ -37,6 +38,8 @@
#include <i386/ibcs2/ibcs2_util.h>
+#include <vm/vm_zone.h>
+
const char ibcs2_emul_path[] = "/compat/ibcs2";
/*
@@ -133,6 +136,7 @@ ibcs2_emul_find(p, sgp, prefix, path, pbuf, cflag)
if ((error = namei(&ndroot)) != 0) {
/* Cannot happen! */
free(buf, M_TEMP);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(nd.ni_vp);
return error;
}
@@ -164,8 +168,11 @@ ibcs2_emul_find(p, sgp, prefix, path, pbuf, cflag)
done:
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(nd.ni_vp);
- if (!cflag)
+ if (!cflag) {
+ NDFREE(&ndroot, NDF_ONLY_PNBUF);
vrele(ndroot.ni_vp);
+ }
return error;
}
diff --git a/sys/i386/ibcs2/ibcs2_xenix.c b/sys/i386/ibcs2/ibcs2_xenix.c
index 67af2fc..bf77113 100644
--- a/sys/i386/ibcs2/ibcs2_xenix.c
+++ b/sys/i386/ibcs2/ibcs2_xenix.c
@@ -49,6 +49,8 @@
#include <i386/ibcs2/ibcs2_xenix.h>
#include <i386/ibcs2/ibcs2_xenix_syscall.h>
+#include <vm/vm_zone.h>
+
extern struct sysent xenix_sysent[];
int
@@ -218,6 +220,7 @@ xenix_eaccess(struct proc *p, struct xenix_eaccess_args *uap)
if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0)
error = VOP_ACCESS(vp, flags, cred, p);
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(vp);
return error;
}
diff --git a/sys/i386/ibcs2/imgact_coff.c b/sys/i386/ibcs2/imgact_coff.c
index 526ff66..1ada323 100644
--- a/sys/i386/ibcs2/imgact_coff.c
+++ b/sys/i386/ibcs2/imgact_coff.c
@@ -279,8 +279,8 @@ coff_load_file(struct proc *p, char *name)
fail:
VOP_UNLOCK(vp, 0, p);
unlocked_fail:
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(nd.ni_vp);
- zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
return error;
}
diff --git a/sys/i386/linux/linux_misc.c b/sys/i386/linux/linux_misc.c
index 36f1165..1835c9c 100644
--- a/sys/i386/linux/linux_misc.c
+++ b/sys/i386/linux/linux_misc.c
@@ -54,6 +54,7 @@
#include <vm/vm_kern.h>
#include <vm/vm_map.h>
#include <vm/vm_extern.h>
+#include <vm/vm_zone.h>
#include <machine/frame.h>
#include <machine/psl.h>
@@ -194,10 +195,15 @@ linux_uselib(struct proc *p, struct linux_uselib_args *args)
goto cleanup;
vp = ni.ni_vp;
+ /*
+ * XXX This looks like a bogus check - a LOCKLEAF namei should not succeed
+ * without returning a vnode.
+ */
if (vp == NULL) {
error = ENOEXEC; /* ?? */
goto cleanup;
}
+ NDFREE(&ni, NDF_ONLY_PNBUF);
/*
* From here on down, we have a locked vnode that must be unlocked.
diff --git a/sys/i386/linux/linux_stats.c b/sys/i386/linux/linux_stats.c
index 14c8090..be40f15 100644
--- a/sys/i386/linux/linux_stats.c
+++ b/sys/i386/linux/linux_stats.c
@@ -44,6 +44,8 @@
#include <i386/linux/linux_proto.h>
#include <i386/linux/linux_util.h>
+#include <vm/vm_zone.h>
+
struct linux_newstat {
u_short stat_dev;
u_short __pad1;
@@ -118,6 +120,7 @@ linux_newstat(struct proc *p, struct linux_newstat_args *args)
error = namei(&nd);
if (error)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = vn_stat(nd.ni_vp, &buf, p);
vput(nd.ni_vp);
@@ -154,6 +157,7 @@ linux_newlstat(p, uap)
error = namei(&nd);
if (error)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
error = vn_stat(vp, &sb, p);
@@ -224,6 +228,7 @@ linux_statfs(struct proc *p, struct linux_statfs_args *args)
error = namei(ndp);
if (error)
return error;
+ NDFREE(ndp, NDF_ONLY_PNBUF);
mp = ndp->ni_vp->v_mount;
bsd_statfs = &mp->mnt_stat;
vrele(ndp->ni_vp);
diff --git a/sys/i386/linux/linux_util.c b/sys/i386/linux/linux_util.c
index 7c87174..0864ae7 100644
--- a/sys/i386/linux/linux_util.c
+++ b/sys/i386/linux/linux_util.c
@@ -39,6 +39,8 @@
#include <i386/linux/linux_util.h>
+#include <vm/vm_zone.h>
+
const char linux_emul_path[] = "/compat/linux";
/*
@@ -135,6 +137,7 @@ linux_emul_find(p, sgp, prefix, path, pbuf, cflag)
if ((error = namei(&ndroot)) != 0) {
/* Cannot happen! */
free(buf, M_TEMP);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(nd.ni_vp);
return error;
}
@@ -164,13 +167,18 @@ linux_emul_find(p, sgp, prefix, path, pbuf, cflag)
free(buf, M_TEMP);
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(nd.ni_vp);
- if (!cflag)
+ if (!cflag) {
+ NDFREE(&ndroot, NDF_ONLY_PNBUF);
vrele(ndroot.ni_vp);
+ }
return error;
bad:
+ NDFREE(&ndroot, NDF_ONLY_PNBUF);
vrele(ndroot.ni_vp);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(nd.ni_vp);
free(buf, M_TEMP);
return error;
diff --git a/sys/isofs/cd9660/cd9660_vfsops.c b/sys/isofs/cd9660/cd9660_vfsops.c
index 8702879..3ecdb06 100644
--- a/sys/isofs/cd9660/cd9660_vfsops.c
+++ b/sys/isofs/cd9660/cd9660_vfsops.c
@@ -54,6 +54,8 @@
#include <sys/stat.h>
#include <sys/syslog.h>
+#include <vm/vm_zone.h>
+
#include <isofs/cd9660/iso.h>
#include <isofs/cd9660/iso_rrip.h>
#include <isofs/cd9660/cd9660_node.h>
@@ -209,6 +211,7 @@ cd9660_mount(mp, path, data, ndp, p)
NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, args.fspec, p);
if ((error = namei(ndp)))
return (error);
+ NDFREE(ndp, NDF_ONLY_PNBUF);
devvp = ndp->ni_vp;
if (!vn_isdisk(devvp)) {
diff --git a/sys/isofs/cd9660/cd9660_vnops.c b/sys/isofs/cd9660/cd9660_vnops.c
index 2f93731..65ad938 100644
--- a/sys/isofs/cd9660/cd9660_vnops.c
+++ b/sys/isofs/cd9660/cd9660_vnops.c
@@ -73,7 +73,6 @@ static int iso_uiodir __P((struct isoreaddir *idp, struct dirent *dp,
static int iso_shipdir __P((struct isoreaddir *idp));
static int cd9660_readdir __P((struct vop_readdir_args *));
static int cd9660_readlink __P((struct vop_readlink_args *ap));
-static int cd9660_abortop __P((struct vop_abortop_args *));
static int cd9660_strategy __P((struct vop_strategy_args *));
static int cd9660_print __P((struct vop_print_args *));
static int cd9660_getpages __P((struct vop_getpages_args *));
@@ -737,22 +736,6 @@ cd9660_readlink(ap)
}
/*
- * Ufs abort op, called after namei() when a CREATE/DELETE isn't actually
- * done. If a buffer has been saved in anticipation of a CREATE, delete it.
- */
-static int
-cd9660_abortop(ap)
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap;
-{
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- return (0);
-}
-
-/*
* Calculate the logical to physical mapping if not done already,
* then call the device strategy routine.
*/
@@ -880,7 +863,6 @@ cd9660_putpages(ap)
vop_t **cd9660_vnodeop_p;
static struct vnodeopv_entry_desc cd9660_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_abortop_desc, (vop_t *) cd9660_abortop },
{ &vop_access_desc, (vop_t *) cd9660_access },
{ &vop_bmap_desc, (vop_t *) cd9660_bmap },
{ &vop_cachedlookup_desc, (vop_t *) cd9660_lookup },
diff --git a/sys/kern/imgact_elf.c b/sys/kern/imgact_elf.c
index da938c5..c541147 100644
--- a/sys/kern/imgact_elf.c
+++ b/sys/kern/imgact_elf.c
@@ -60,6 +60,7 @@
#include <vm/vm_map.h>
#include <vm/vm_object.h>
#include <vm/vm_extern.h>
+#include <vm/vm_zone.h>
#include <machine/elf.h>
#include <machine/md_var.h>
@@ -332,7 +333,7 @@ elf_load_file(struct proc *p, const char *file, u_long *addr, u_long *entry)
nd.ni_vp = NULL;
goto fail;
}
-
+ NDFREE(&nd, NDF_ONLY_PNBUF);
imgp->vp = nd.ni_vp;
/*
diff --git a/sys/kern/kern_acct.c b/sys/kern/kern_acct.c
index 3222b16..6f0cfb5 100644
--- a/sys/kern/kern_acct.c
+++ b/sys/kern/kern_acct.c
@@ -56,6 +56,8 @@
#include <sys/resourcevar.h>
#include <sys/tty.h>
+#include <vm/vm_zone.h>
+
/*
* The routines implemented in this file are described in:
* Leffler, et al.: The Design and Implementation of the 4.3BSD
@@ -133,6 +135,7 @@ acct(a1, uap)
error = vn_open(&nd, FWRITE, 0);
if (error)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
VOP_UNLOCK(nd.ni_vp, 0, p);
if (nd.ni_vp->v_type != VREG) {
vn_close(nd.ni_vp, FWRITE, p->p_ucred, p);
diff --git a/sys/kern/kern_exec.c b/sys/kern/kern_exec.c
index d78f562..60c7f55 100644
--- a/sys/kern/kern_exec.c
+++ b/sys/kern/kern_exec.c
@@ -193,9 +193,9 @@ interpret:
goto exec_fail_dealloc;
if (imgp->interpreted) {
exec_unmap_first_page(imgp);
- /* free old vnode and name buffer */
+ /* free name buffer and old vnode */
+ NDFREE(ndp, NDF_ONLY_PNBUF);
vrele(ndp->ni_vp);
- zfree(namei_zone, ndp->ni_cnd.cn_pnbuf);
/* set new name to that of the interpreter */
NDINIT(ndp, LOOKUP, LOCKLEAF | FOLLOW | SAVENAME,
UIO_SYSSPACE, imgp->interpreter_name, p);
@@ -353,8 +353,8 @@ exec_fail_dealloc:
ARG_MAX + PAGE_SIZE);
if (imgp->vp) {
+ NDFREE(ndp, NDF_ONLY_PNBUF);
vrele(imgp->vp);
- zfree(namei_zone, ndp->ni_cnd.cn_pnbuf);
}
if (error == 0)
diff --git a/sys/kern/kern_ktrace.c b/sys/kern/kern_ktrace.c
index 266ea31..8258271 100644
--- a/sys/kern/kern_ktrace.c
+++ b/sys/kern/kern_ktrace.c
@@ -49,6 +49,8 @@
#include <sys/malloc.h>
#include <sys/syslog.h>
+#include <vm/vm_zone.h>
+
#include <stddef.h>
static MALLOC_DEFINE(M_KTRACE, "KTRACE", "KTRACE");
@@ -280,6 +282,7 @@ ktrace(curp, uap)
curp->p_traceflag &= ~KTRFAC_ACTIVE;
return (error);
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
VOP_UNLOCK(vp, 0, curp);
if (vp->v_type != VREG) {
diff --git a/sys/kern/kern_linker.c b/sys/kern/kern_linker.c
index 9262e54..13a2491 100644
--- a/sys/kern/kern_linker.c
+++ b/sys/kern/kern_linker.c
@@ -44,6 +44,8 @@
#include <sys/vnode.h>
#include <sys/sysctl.h>
+#include <vm/vm_zone.h>
+
#ifdef KLD_DEBUG
int kld_debug = 0;
#endif
@@ -1017,6 +1019,7 @@ linker_search_path(const char *name)
NDINIT(&nd, LOOKUP, FOLLOW, UIO_SYSSPACE, result, p);
error = vn_open(&nd, FREAD, 0);
if (error == 0) {
+ NDFREE(&nd, NDF_ONLY_PNBUF);
type = nd.ni_vp->v_type;
VOP_UNLOCK(nd.ni_vp, 0, p);
vn_close(nd.ni_vp, FREAD, p->p_ucred, p);
diff --git a/sys/kern/kern_sig.c b/sys/kern/kern_sig.c
index cf27029..6bb03de 100644
--- a/sys/kern/kern_sig.c
+++ b/sys/kern/kern_sig.c
@@ -62,6 +62,8 @@
#include <sys/sysctl.h>
#include <sys/malloc.h>
+#include <vm/vm_zone.h>
+
#include <machine/cpu.h>
#ifdef SMP
#include <machine/smp.h>
@@ -1604,6 +1606,7 @@ coredump(p)
free(name, M_TEMP);
if (error)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
/* Don't dump to non-regular files or files with links. */
diff --git a/sys/kern/link_aout.c b/sys/kern/link_aout.c
index bc46101..605a812 100644
--- a/sys/kern/link_aout.c
+++ b/sys/kern/link_aout.c
@@ -40,6 +40,8 @@
#include <sys/vnode.h>
#include <sys/linker.h>
+#include <vm/vm_zone.h>
+
#ifndef __ELF__
#include <vm/vm.h>
#include <vm/pmap.h>
@@ -201,6 +203,7 @@ link_aout_load_file(const char* filename, linker_file_t* result)
free(pathname, M_LINKER);
if (error)
return error;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
/*
* Read the a.out header from the file.
diff --git a/sys/kern/link_elf.c b/sys/kern/link_elf.c
index ab4abf8..0fefb50 100644
--- a/sys/kern/link_elf.c
+++ b/sys/kern/link_elf.c
@@ -38,9 +38,8 @@
#include <machine/elf.h>
#include <vm/vm.h>
-#ifdef SPARSE_MAPPING
-#endif
#include <vm/vm_param.h>
+#include <vm/vm_zone.h>
#include <sys/lock.h>
#ifdef SPARSE_MAPPING
#include <vm/vm_object.h>
@@ -430,6 +429,7 @@ link_elf_load_file(const char* filename, linker_file_t* result)
free(pathname, M_LINKER);
if (error)
return error;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
/*
* Read the elf header from the file.
diff --git a/sys/kern/link_elf_obj.c b/sys/kern/link_elf_obj.c
index ab4abf8..0fefb50 100644
--- a/sys/kern/link_elf_obj.c
+++ b/sys/kern/link_elf_obj.c
@@ -38,9 +38,8 @@
#include <machine/elf.h>
#include <vm/vm.h>
-#ifdef SPARSE_MAPPING
-#endif
#include <vm/vm_param.h>
+#include <vm/vm_zone.h>
#include <sys/lock.h>
#ifdef SPARSE_MAPPING
#include <vm/vm_object.h>
@@ -430,6 +429,7 @@ link_elf_load_file(const char* filename, linker_file_t* result)
free(pathname, M_LINKER);
if (error)
return error;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
/*
* Read the elf header from the file.
diff --git a/sys/kern/uipc_usrreq.c b/sys/kern/uipc_usrreq.c
index 34222b2..4876889 100644
--- a/sys/kern/uipc_usrreq.c
+++ b/sys/kern/uipc_usrreq.c
@@ -559,7 +559,7 @@ unp_bind(unp, nam, p)
return (error);
vp = nd.ni_vp;
if (vp != NULL) {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == vp)
vrele(nd.ni_dvp);
else
@@ -572,6 +572,7 @@ unp_bind(unp, nam, p)
vattr.va_mode = (ACCESSPERMS & ~p->p_fd->fd_cmask);
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_dvp);
if (error)
return (error);
@@ -608,6 +609,7 @@ unp_connect(so, nam, p)
if (error)
return (error);
vp = nd.ni_vp;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (vp->v_type != VSOCK) {
error = ENOTSOCK;
goto bad;
diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c
index 600df41..35df911 100644
--- a/sys/kern/vfs_default.c
+++ b/sys/kern/vfs_default.c
@@ -63,7 +63,6 @@ static int vop_nostrategy __P((struct vop_strategy_args *));
vop_t **default_vnodeop_p;
static struct vnodeopv_entry_desc default_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_eopnotsupp },
- { &vop_abortop_desc, (vop_t *) vop_null },
{ &vop_advlock_desc, (vop_t *) vop_einval },
{ &vop_bwrite_desc, (vop_t *) vop_stdbwrite },
{ &vop_close_desc, (vop_t *) vop_null },
diff --git a/sys/kern/vfs_extattr.c b/sys/kern/vfs_extattr.c
index 4d5d394..1de7cf1 100644
--- a/sys/kern/vfs_extattr.c
+++ b/sys/kern/vfs_extattr.c
@@ -142,6 +142,7 @@ mount(p, uap)
SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
if (SCARG(uap, flags) & MNT_UPDATE) {
if ((vp->v_flag & VROOT) == 0) {
@@ -264,8 +265,7 @@ mount(p, uap)
/*
* Allocate and initialize the filesystem.
*/
- mp = (struct mount *)malloc((u_long)sizeof(struct mount),
- M_MOUNT, M_WAITOK);
+ mp = malloc(sizeof(struct mount), M_MOUNT, M_WAITOK);
bzero((char *)mp, (u_long)sizeof(struct mount));
lockinit(&mp->mnt_lock, PVFS, "vfslock", 0, LK_NOPAUSE);
(void)vfs_busy(mp, LK_NOWAIT, 0, p);
@@ -297,6 +297,8 @@ update:
MNT_NOATIME | MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR);
/*
* Mount the filesystem.
+ * XXX The final recipients of VFS_MOUNT just overwrite the ndp they
+ * get. No freeing of cn_pnbuf.
*/
error = VFS_MOUNT(mp, SCARG(uap, path), SCARG(uap, data), &nd, p);
if (mp->mnt_flag & MNT_UPDATE) {
@@ -421,6 +423,7 @@ unmount(p, uap)
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
mp = vp->v_mount;
/*
@@ -602,6 +605,7 @@ quotactl(p, uap)
if ((error = namei(&nd)) != 0)
return (error);
mp = nd.ni_vp->v_mount;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(nd.ni_vp);
return (VFS_QUOTACTL(mp, SCARG(uap, cmd), SCARG(uap, uid),
SCARG(uap, arg), p));
@@ -636,6 +640,7 @@ statfs(p, uap)
return (error);
mp = nd.ni_vp->v_mount;
sp = &mp->mnt_stat;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(nd.ni_vp);
error = VFS_STATFS(mp, sp, p);
if (error)
@@ -833,6 +838,7 @@ chdir(p, uap)
SCARG(uap, path), p);
if ((error = change_dir(&nd, p)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(fdp->fd_cdir);
fdp->fd_cdir = nd.ni_vp;
return (0);
@@ -908,6 +914,7 @@ chroot(p, uap)
SCARG(uap, path), p);
if ((error = change_dir(&nd, p)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(fdp->fd_rdir);
fdp->fd_rdir = nd.ni_vp;
if (!fdp->fd_jdir) {
@@ -999,6 +1006,7 @@ open(p, uap)
return (error);
}
p->p_dupfd = 0;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
fp->f_data = (caddr_t)vp;
@@ -1134,20 +1142,18 @@ mknod(p, uap)
}
if (!error) {
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
- if (whiteout) {
+ if (whiteout)
error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, CREATE);
- if (error)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- vput(nd.ni_dvp);
- } else {
+ else {
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp,
&nd.ni_cnd, &vattr);
if (error == 0)
vput(nd.ni_vp);
- vput(nd.ni_dvp);
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
+ vput(nd.ni_dvp);
} else {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == vp)
vrele(nd.ni_dvp);
else
@@ -1186,7 +1192,7 @@ mkfifo(p, uap)
if ((error = namei(&nd)) != 0)
return (error);
if (nd.ni_vp != NULL) {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
else
@@ -1201,6 +1207,7 @@ mkfifo(p, uap)
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
if (error == 0)
vput(nd.ni_vp);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_dvp);
return (error);
}
@@ -1230,6 +1237,7 @@ link(p, uap)
NDINIT(&nd, LOOKUP, FOLLOW|NOOBJ, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
if (vp->v_type == VDIR)
error = EPERM; /* POSIX */
@@ -1238,7 +1246,6 @@ link(p, uap)
error = namei(&nd);
if (!error) {
if (nd.ni_vp != NULL) {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
if (nd.ni_vp)
vrele(nd.ni_vp);
error = EEXIST;
@@ -1248,6 +1255,7 @@ link(p, uap)
VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd);
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
else
@@ -1290,7 +1298,7 @@ symlink(p, uap)
if ((error = namei(&nd)) != 0)
goto out;
if (nd.ni_vp) {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
else
@@ -1303,6 +1311,7 @@ symlink(p, uap)
vattr.va_mode = ACCESSPERMS &~ p->p_fd->fd_cmask;
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr, path);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (error == 0)
vput(nd.ni_vp);
vput(nd.ni_dvp);
@@ -1334,7 +1343,7 @@ undelete(p, uap)
return (error);
if (nd.ni_vp != NULLVP || !(nd.ni_cnd.cn_flags & ISWHITEOUT)) {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
else
@@ -1345,8 +1354,8 @@ undelete(p, uap)
}
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
- if ((error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, DELETE)) != 0)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, DELETE);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_dvp);
ASSERT_VOP_UNLOCKED(nd.ni_dvp, "undelete");
ASSERT_VOP_UNLOCKED(nd.ni_vp, "undelete");
@@ -1395,9 +1404,8 @@ unlink(p, uap)
if (!error) {
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd);
- } else {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == vp)
vrele(nd.ni_dvp);
else
@@ -1541,6 +1549,7 @@ access(p, uap)
if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0)
error = VOP_ACCESS(vp, flags, cred, p);
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(vp);
out1:
cred->cr_uid = t_uid;
@@ -1576,6 +1585,7 @@ ostat(p, uap)
SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = vn_stat(nd.ni_vp, &sb, p);
vput(nd.ni_vp);
if (error)
@@ -1615,6 +1625,7 @@ olstat(p, uap)
return (error);
vp = nd.ni_vp;
error = vn_stat(vp, &sb, p);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(vp);
if (error)
return (error);
@@ -1680,6 +1691,7 @@ stat(p, uap)
if ((error = namei(&nd)) != 0)
return (error);
error = vn_stat(nd.ni_vp, &sb, p);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_vp);
if (error)
return (error);
@@ -1716,6 +1728,7 @@ lstat(p, uap)
return (error);
vp = nd.ni_vp;
error = vn_stat(vp, &sb, p);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(vp);
if (error)
return (error);
@@ -1771,6 +1784,7 @@ nstat(p, uap)
SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = vn_stat(nd.ni_vp, &sb, p);
vput(nd.ni_vp);
if (error)
@@ -1809,6 +1823,7 @@ nlstat(p, uap)
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = vn_stat(vp, &sb, p);
vput(vp);
if (error)
@@ -1843,6 +1858,7 @@ pathconf(p, uap)
SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = VOP_PATHCONF(nd.ni_vp, SCARG(uap, name), p->p_retval);
vput(nd.ni_vp);
return (error);
@@ -1878,6 +1894,7 @@ readlink(p, uap)
SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
if (vp->v_type != VLNK)
error = EINVAL;
@@ -1950,6 +1967,7 @@ chflags(p, uap)
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = setfflags(p, nd.ni_vp, SCARG(uap, flags));
vrele(nd.ni_vp);
return error;
@@ -2023,6 +2041,7 @@ chmod(p, uap)
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = setfmode(p, nd.ni_vp, SCARG(uap, mode));
vrele(nd.ni_vp);
return error;
@@ -2052,6 +2071,7 @@ lchmod(p, uap)
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = setfmode(p, nd.ni_vp, SCARG(uap, mode));
vrele(nd.ni_vp);
return error;
@@ -2129,9 +2149,9 @@ chown(p, uap)
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = setfown(p, nd.ni_vp, SCARG(uap, uid), SCARG(uap, gid));
vrele(nd.ni_vp);
-
return (error);
}
@@ -2161,6 +2181,7 @@ lchown(p, uap)
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = setfown(p, nd.ni_vp, SCARG(uap, uid), SCARG(uap, gid));
vrele(nd.ni_vp);
return (error);
@@ -2267,6 +2288,7 @@ utimes(p, uap)
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = setutimes(p, nd.ni_vp, ts, usrtvp == NULL);
vrele(nd.ni_vp);
return (error);
@@ -2301,6 +2323,7 @@ lutimes(p, uap)
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = setutimes(p, nd.ni_vp, ts, usrtvp == NULL);
vrele(nd.ni_vp);
return (error);
@@ -2368,6 +2391,7 @@ truncate(p, uap)
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
if (vp->v_type == VDIR)
@@ -2557,7 +2581,7 @@ rename(p, uap)
/* Translate error code for rename("dir1", "dir2/."). */
if (error == EISDIR && fvp->v_type == VDIR)
error = EINVAL;
- VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
+ NDFREE(&fromnd, NDF_ONLY_PNBUF);
vrele(fromnd.ni_dvp);
vrele(fvp);
goto out1;
@@ -2596,15 +2620,17 @@ out:
}
error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd,
tond.ni_dvp, tond.ni_vp, &tond.ni_cnd);
+ NDFREE(&fromnd, NDF_ONLY_PNBUF);
+ NDFREE(&tond, NDF_ONLY_PNBUF);
} else {
- VOP_ABORTOP(tond.ni_dvp, &tond.ni_cnd);
+ NDFREE(&fromnd, NDF_ONLY_PNBUF);
+ NDFREE(&tond, NDF_ONLY_PNBUF);
if (tdvp == tvp)
vrele(tdvp);
else
vput(tdvp);
if (tvp)
vput(tvp);
- VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
vrele(fromnd.ni_dvp);
vrele(fvp);
}
@@ -2613,11 +2639,9 @@ out:
ASSERT_VOP_UNLOCKED(fromnd.ni_vp, "rename");
ASSERT_VOP_UNLOCKED(tond.ni_dvp, "rename");
ASSERT_VOP_UNLOCKED(tond.ni_vp, "rename");
- zfree(namei_zone, tond.ni_cnd.cn_pnbuf);
out1:
if (fromnd.ni_startdir)
vrele(fromnd.ni_startdir);
- zfree(namei_zone, fromnd.ni_cnd.cn_pnbuf);
if (error == -1)
return (0);
return (error);
@@ -2652,7 +2676,7 @@ mkdir(p, uap)
return (error);
vp = nd.ni_vp;
if (vp != NULL) {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == vp)
vrele(nd.ni_dvp);
else
@@ -2665,6 +2689,7 @@ mkdir(p, uap)
vattr.va_mode = (SCARG(uap, mode) & ACCESSPERMS) &~ p->p_fd->fd_cmask;
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_dvp);
if (!error)
vput(nd.ni_vp);
@@ -2714,14 +2739,13 @@ rmdir(p, uap)
*/
if (vp->v_flag & VROOT)
error = EBUSY;
-out:
- if (!error) {
+ else {
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
error = VOP_RMDIR(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd);
- } else {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
}
+out:
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == vp)
vrele(nd.ni_dvp);
else
@@ -3013,6 +3037,7 @@ revoke(p, uap)
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (vp->v_type != VCHR && vp->v_type != VBLK) {
error = EINVAL;
goto out;
@@ -3077,6 +3102,7 @@ getfh(p, uap)
error = namei(&nd);
if (error)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
bzero(&fh, sizeof(fh));
fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid;
diff --git a/sys/kern/vfs_lookup.c b/sys/kern/vfs_lookup.c
index 18e0bda..4cdec9e 100644
--- a/sys/kern/vfs_lookup.c
+++ b/sys/kern/vfs_lookup.c
@@ -372,6 +372,7 @@ dirloop:
ndp->ni_vp = dp;
if (!(cnp->cn_flags & (LOCKPARENT | LOCKLEAF)))
VOP_UNLOCK(dp, 0, p);
+ /* XXX This should probably move to the top of function. */
if (cnp->cn_flags & SAVESTART)
panic("lookup: SAVESTART");
return (0);
@@ -527,9 +528,8 @@ nextname:
cnp->cn_nameptr++;
ndp->ni_pathlen--;
}
- if (ndp->ni_dvp != ndp->ni_vp) {
- ASSERT_VOP_UNLOCKED(ndp->ni_dvp, "lookup");
- }
+ if (ndp->ni_dvp != ndp->ni_vp)
+ ASSERT_VOP_UNLOCKED(ndp->ni_dvp, "lookup");
vrele(ndp->ni_dvp);
goto dirloop;
}
@@ -629,6 +629,7 @@ relookup(dvp, vpp, cnp)
if (!(cnp->cn_flags & LOCKLEAF))
VOP_UNLOCK(dp, 0, p);
*vpp = dp;
+ /* XXX This should probably move to the top of function. */
if (cnp->cn_flags & SAVESTART)
panic("lookup: SAVESTART");
return (0);
diff --git a/sys/kern/vfs_syscalls.c b/sys/kern/vfs_syscalls.c
index 4d5d394..1de7cf1 100644
--- a/sys/kern/vfs_syscalls.c
+++ b/sys/kern/vfs_syscalls.c
@@ -142,6 +142,7 @@ mount(p, uap)
SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
if (SCARG(uap, flags) & MNT_UPDATE) {
if ((vp->v_flag & VROOT) == 0) {
@@ -264,8 +265,7 @@ mount(p, uap)
/*
* Allocate and initialize the filesystem.
*/
- mp = (struct mount *)malloc((u_long)sizeof(struct mount),
- M_MOUNT, M_WAITOK);
+ mp = malloc(sizeof(struct mount), M_MOUNT, M_WAITOK);
bzero((char *)mp, (u_long)sizeof(struct mount));
lockinit(&mp->mnt_lock, PVFS, "vfslock", 0, LK_NOPAUSE);
(void)vfs_busy(mp, LK_NOWAIT, 0, p);
@@ -297,6 +297,8 @@ update:
MNT_NOATIME | MNT_NOCLUSTERR | MNT_NOCLUSTERW | MNT_SUIDDIR);
/*
* Mount the filesystem.
+ * XXX The final recipients of VFS_MOUNT just overwrite the ndp they
+ * get. No freeing of cn_pnbuf.
*/
error = VFS_MOUNT(mp, SCARG(uap, path), SCARG(uap, data), &nd, p);
if (mp->mnt_flag & MNT_UPDATE) {
@@ -421,6 +423,7 @@ unmount(p, uap)
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
mp = vp->v_mount;
/*
@@ -602,6 +605,7 @@ quotactl(p, uap)
if ((error = namei(&nd)) != 0)
return (error);
mp = nd.ni_vp->v_mount;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(nd.ni_vp);
return (VFS_QUOTACTL(mp, SCARG(uap, cmd), SCARG(uap, uid),
SCARG(uap, arg), p));
@@ -636,6 +640,7 @@ statfs(p, uap)
return (error);
mp = nd.ni_vp->v_mount;
sp = &mp->mnt_stat;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(nd.ni_vp);
error = VFS_STATFS(mp, sp, p);
if (error)
@@ -833,6 +838,7 @@ chdir(p, uap)
SCARG(uap, path), p);
if ((error = change_dir(&nd, p)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(fdp->fd_cdir);
fdp->fd_cdir = nd.ni_vp;
return (0);
@@ -908,6 +914,7 @@ chroot(p, uap)
SCARG(uap, path), p);
if ((error = change_dir(&nd, p)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vrele(fdp->fd_rdir);
fdp->fd_rdir = nd.ni_vp;
if (!fdp->fd_jdir) {
@@ -999,6 +1006,7 @@ open(p, uap)
return (error);
}
p->p_dupfd = 0;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
fp->f_data = (caddr_t)vp;
@@ -1134,20 +1142,18 @@ mknod(p, uap)
}
if (!error) {
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
- if (whiteout) {
+ if (whiteout)
error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, CREATE);
- if (error)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- vput(nd.ni_dvp);
- } else {
+ else {
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp,
&nd.ni_cnd, &vattr);
if (error == 0)
vput(nd.ni_vp);
- vput(nd.ni_dvp);
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
+ vput(nd.ni_dvp);
} else {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == vp)
vrele(nd.ni_dvp);
else
@@ -1186,7 +1192,7 @@ mkfifo(p, uap)
if ((error = namei(&nd)) != 0)
return (error);
if (nd.ni_vp != NULL) {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
else
@@ -1201,6 +1207,7 @@ mkfifo(p, uap)
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
if (error == 0)
vput(nd.ni_vp);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_dvp);
return (error);
}
@@ -1230,6 +1237,7 @@ link(p, uap)
NDINIT(&nd, LOOKUP, FOLLOW|NOOBJ, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
if (vp->v_type == VDIR)
error = EPERM; /* POSIX */
@@ -1238,7 +1246,6 @@ link(p, uap)
error = namei(&nd);
if (!error) {
if (nd.ni_vp != NULL) {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
if (nd.ni_vp)
vrele(nd.ni_vp);
error = EEXIST;
@@ -1248,6 +1255,7 @@ link(p, uap)
VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd);
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
else
@@ -1290,7 +1298,7 @@ symlink(p, uap)
if ((error = namei(&nd)) != 0)
goto out;
if (nd.ni_vp) {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
else
@@ -1303,6 +1311,7 @@ symlink(p, uap)
vattr.va_mode = ACCESSPERMS &~ p->p_fd->fd_cmask;
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr, path);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (error == 0)
vput(nd.ni_vp);
vput(nd.ni_dvp);
@@ -1334,7 +1343,7 @@ undelete(p, uap)
return (error);
if (nd.ni_vp != NULLVP || !(nd.ni_cnd.cn_flags & ISWHITEOUT)) {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
else
@@ -1345,8 +1354,8 @@ undelete(p, uap)
}
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
- if ((error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, DELETE)) != 0)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ error = VOP_WHITEOUT(nd.ni_dvp, &nd.ni_cnd, DELETE);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_dvp);
ASSERT_VOP_UNLOCKED(nd.ni_dvp, "undelete");
ASSERT_VOP_UNLOCKED(nd.ni_vp, "undelete");
@@ -1395,9 +1404,8 @@ unlink(p, uap)
if (!error) {
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
error = VOP_REMOVE(nd.ni_dvp, vp, &nd.ni_cnd);
- } else {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == vp)
vrele(nd.ni_dvp);
else
@@ -1541,6 +1549,7 @@ access(p, uap)
if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0)
error = VOP_ACCESS(vp, flags, cred, p);
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(vp);
out1:
cred->cr_uid = t_uid;
@@ -1576,6 +1585,7 @@ ostat(p, uap)
SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = vn_stat(nd.ni_vp, &sb, p);
vput(nd.ni_vp);
if (error)
@@ -1615,6 +1625,7 @@ olstat(p, uap)
return (error);
vp = nd.ni_vp;
error = vn_stat(vp, &sb, p);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(vp);
if (error)
return (error);
@@ -1680,6 +1691,7 @@ stat(p, uap)
if ((error = namei(&nd)) != 0)
return (error);
error = vn_stat(nd.ni_vp, &sb, p);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_vp);
if (error)
return (error);
@@ -1716,6 +1728,7 @@ lstat(p, uap)
return (error);
vp = nd.ni_vp;
error = vn_stat(vp, &sb, p);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(vp);
if (error)
return (error);
@@ -1771,6 +1784,7 @@ nstat(p, uap)
SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = vn_stat(nd.ni_vp, &sb, p);
vput(nd.ni_vp);
if (error)
@@ -1809,6 +1823,7 @@ nlstat(p, uap)
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = vn_stat(vp, &sb, p);
vput(vp);
if (error)
@@ -1843,6 +1858,7 @@ pathconf(p, uap)
SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = VOP_PATHCONF(nd.ni_vp, SCARG(uap, name), p->p_retval);
vput(nd.ni_vp);
return (error);
@@ -1878,6 +1894,7 @@ readlink(p, uap)
SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
if (vp->v_type != VLNK)
error = EINVAL;
@@ -1950,6 +1967,7 @@ chflags(p, uap)
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = setfflags(p, nd.ni_vp, SCARG(uap, flags));
vrele(nd.ni_vp);
return error;
@@ -2023,6 +2041,7 @@ chmod(p, uap)
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = setfmode(p, nd.ni_vp, SCARG(uap, mode));
vrele(nd.ni_vp);
return error;
@@ -2052,6 +2071,7 @@ lchmod(p, uap)
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = setfmode(p, nd.ni_vp, SCARG(uap, mode));
vrele(nd.ni_vp);
return error;
@@ -2129,9 +2149,9 @@ chown(p, uap)
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = setfown(p, nd.ni_vp, SCARG(uap, uid), SCARG(uap, gid));
vrele(nd.ni_vp);
-
return (error);
}
@@ -2161,6 +2181,7 @@ lchown(p, uap)
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = setfown(p, nd.ni_vp, SCARG(uap, uid), SCARG(uap, gid));
vrele(nd.ni_vp);
return (error);
@@ -2267,6 +2288,7 @@ utimes(p, uap)
NDINIT(&nd, LOOKUP, FOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = setutimes(p, nd.ni_vp, ts, usrtvp == NULL);
vrele(nd.ni_vp);
return (error);
@@ -2301,6 +2323,7 @@ lutimes(p, uap)
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), p);
if ((error = namei(&nd)) != 0)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = setutimes(p, nd.ni_vp, ts, usrtvp == NULL);
vrele(nd.ni_vp);
return (error);
@@ -2368,6 +2391,7 @@ truncate(p, uap)
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
vn_lock(vp, LK_EXCLUSIVE | LK_RETRY, p);
if (vp->v_type == VDIR)
@@ -2557,7 +2581,7 @@ rename(p, uap)
/* Translate error code for rename("dir1", "dir2/."). */
if (error == EISDIR && fvp->v_type == VDIR)
error = EINVAL;
- VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
+ NDFREE(&fromnd, NDF_ONLY_PNBUF);
vrele(fromnd.ni_dvp);
vrele(fvp);
goto out1;
@@ -2596,15 +2620,17 @@ out:
}
error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd,
tond.ni_dvp, tond.ni_vp, &tond.ni_cnd);
+ NDFREE(&fromnd, NDF_ONLY_PNBUF);
+ NDFREE(&tond, NDF_ONLY_PNBUF);
} else {
- VOP_ABORTOP(tond.ni_dvp, &tond.ni_cnd);
+ NDFREE(&fromnd, NDF_ONLY_PNBUF);
+ NDFREE(&tond, NDF_ONLY_PNBUF);
if (tdvp == tvp)
vrele(tdvp);
else
vput(tdvp);
if (tvp)
vput(tvp);
- VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
vrele(fromnd.ni_dvp);
vrele(fvp);
}
@@ -2613,11 +2639,9 @@ out:
ASSERT_VOP_UNLOCKED(fromnd.ni_vp, "rename");
ASSERT_VOP_UNLOCKED(tond.ni_dvp, "rename");
ASSERT_VOP_UNLOCKED(tond.ni_vp, "rename");
- zfree(namei_zone, tond.ni_cnd.cn_pnbuf);
out1:
if (fromnd.ni_startdir)
vrele(fromnd.ni_startdir);
- zfree(namei_zone, fromnd.ni_cnd.cn_pnbuf);
if (error == -1)
return (0);
return (error);
@@ -2652,7 +2676,7 @@ mkdir(p, uap)
return (error);
vp = nd.ni_vp;
if (vp != NULL) {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == vp)
vrele(nd.ni_dvp);
else
@@ -2665,6 +2689,7 @@ mkdir(p, uap)
vattr.va_mode = (SCARG(uap, mode) & ACCESSPERMS) &~ p->p_fd->fd_cmask;
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_dvp);
if (!error)
vput(nd.ni_vp);
@@ -2714,14 +2739,13 @@ rmdir(p, uap)
*/
if (vp->v_flag & VROOT)
error = EBUSY;
-out:
- if (!error) {
+ else {
VOP_LEASE(nd.ni_dvp, p, p->p_ucred, LEASE_WRITE);
VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE);
error = VOP_RMDIR(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd);
- } else {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
}
+out:
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == vp)
vrele(nd.ni_dvp);
else
@@ -3013,6 +3037,7 @@ revoke(p, uap)
if ((error = namei(&nd)) != 0)
return (error);
vp = nd.ni_vp;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (vp->v_type != VCHR && vp->v_type != VBLK) {
error = EINVAL;
goto out;
@@ -3077,6 +3102,7 @@ getfh(p, uap)
error = namei(&nd);
if (error)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
bzero(&fh, sizeof(fh));
fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid;
diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c
index ebe3497..7013308 100644
--- a/sys/kern/vfs_vnops.c
+++ b/sys/kern/vfs_vnops.c
@@ -52,6 +52,7 @@
#include <sys/filio.h>
#include <sys/ttycom.h>
#include <sys/conf.h>
+#include <vm/vm_zone.h>
static int vn_closefile __P((struct file *fp, struct proc *p));
static int vn_ioctl __P((struct file *fp, u_long com, caddr_t data,
@@ -70,6 +71,9 @@ struct fileops vnops =
/*
* Common code for vnode open operations.
* Check permissions, and call the VOP_OPEN or VOP_CREATE routine.
+ *
+ * Note that this do NOT free nameidata for the successful case,
+ * due to the NDINIT being done elsewhere.
*/
int
vn_open(ndp, fmode, cmode)
@@ -100,15 +104,17 @@ vn_open(ndp, fmode, cmode)
VOP_LEASE(ndp->ni_dvp, p, cred, LEASE_WRITE);
error = VOP_CREATE(ndp->ni_dvp, &ndp->ni_vp,
&ndp->ni_cnd, vap);
- vput(ndp->ni_dvp);
- if (error)
+ if (error) {
+ NDFREE(ndp, NDF_ONLY_PNBUF);
+ vput(ndp->ni_dvp);
return (error);
+ }
+ vput(ndp->ni_dvp);
ASSERT_VOP_UNLOCKED(ndp->ni_dvp, "create");
ASSERT_VOP_LOCKED(ndp->ni_vp, "create");
fmode &= ~O_TRUNC;
vp = ndp->ni_vp;
} else {
- VOP_ABORTOP(ndp->ni_dvp, &ndp->ni_cnd);
if (ndp->ni_dvp == ndp->ni_vp)
vrele(ndp->ni_dvp);
else
@@ -183,6 +189,7 @@ vn_open(ndp, fmode, cmode)
vp->v_writecount++;
return (0);
bad:
+ NDFREE(ndp, NDF_ONLY_PNBUF);
vput(vp);
return (error);
}
diff --git a/sys/kern/vnode_if.src b/sys/kern/vnode_if.src
index c418164..9fd57af 100644
--- a/sys/kern/vnode_if.src
+++ b/sys/kern/vnode_if.src
@@ -339,14 +339,6 @@ vop_readlink {
};
#
-#% abortop dvp = = =
-#
-vop_abortop {
- IN struct vnode *dvp;
- IN struct componentname *cnp;
-};
-
-#
#% inactive vp L U U
#
vop_inactive {
diff --git a/sys/miscfs/devfs/devfs_vnops.c b/sys/miscfs/devfs/devfs_vnops.c
index 52cff5c..1771ac8 100644
--- a/sys/miscfs/devfs/devfs_vnops.c
+++ b/sys/miscfs/devfs/devfs_vnops.c
@@ -680,7 +680,6 @@ DBPRINT(("remove\n"));
*/
if ((error = devfs_vntodn(dvp, &tdp)) != 0) {
abortit:
- VOP_ABORTOP(dvp, cnp);
return (error);
}
if ((error = devfs_vntodn(vp, &tp)) != 0) goto abortit;
@@ -790,7 +789,6 @@ DBPRINT(("link\n"));
|| (vp->v_tag != tdvp->v_tag) ) {
error = EXDEV;
abortit:
- VOP_ABORTOP(tdvp, cnp);
goto out;
}
@@ -904,14 +902,12 @@ devfs_rename(struct vop_rename_args *ap)
|| ((fp->type == DEV_DIR) && (fp->dvm != tdp->dvm ))) {
error = EXDEV;
abortit:
- VOP_ABORTOP(tdvp, tcnp);
if (tdvp == tvp) /* eh? */
vrele(tdvp);
else
vput(tdvp);
if (tvp)
vput(tvp);
- VOP_ABORTOP(fdvp, fcnp); /* XXX, why not in NFS? */
vrele(fdvp);
vrele(fvp);
return (error);
@@ -981,12 +977,10 @@ abortit:
}
/* Release destination completely. */
- VOP_ABORTOP(tdvp, tcnp);
vput(tdvp);
vput(tvp);
/* Delete source. */
- VOP_ABORTOP(fdvp, fcnp); /*XXX*/
vrele(fdvp);
vrele(fvp);
dev_free_name(fnp);
@@ -1225,22 +1219,6 @@ DBPRINT(("readlink\n"));
return error;
}
-#ifdef notyet
-static int
-devfs_abortop(struct vop_abortop_args *ap)
- /*struct vop_abortop_args {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */
-{
-DBPRINT(("abortop\n"));
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- return 0;
-}
-#endif /* notyet */
-
-
static int
devfs_reclaim(struct vop_reclaim_args *ap)
/*struct vop_reclaim_args {
diff --git a/sys/miscfs/fifofs/fifo_vnops.c b/sys/miscfs/fifofs/fifo_vnops.c
index 4a8199a..b64f957 100644
--- a/sys/miscfs/fifofs/fifo_vnops.c
+++ b/sys/miscfs/fifofs/fifo_vnops.c
@@ -79,7 +79,6 @@ static int fifo_advlock __P((struct vop_advlock_args *));
vop_t **fifo_vnodeop_p;
static struct vnodeopv_entry_desc fifo_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_abortop_desc, (vop_t *) fifo_badop },
{ &vop_access_desc, (vop_t *) vop_ebadf },
{ &vop_advlock_desc, (vop_t *) fifo_advlock },
{ &vop_bmap_desc, (vop_t *) fifo_bmap },
diff --git a/sys/miscfs/nullfs/null_vfsops.c b/sys/miscfs/nullfs/null_vfsops.c
index e48a516..1bdc083 100644
--- a/sys/miscfs/nullfs/null_vfsops.c
+++ b/sys/miscfs/nullfs/null_vfsops.c
@@ -53,6 +53,7 @@
#include <sys/mount.h>
#include <sys/namei.h>
#include <miscfs/nullfs/null.h>
+#include <vm/vm_zone.h>
static MALLOC_DEFINE(M_NULLFSMNT, "NULLFS mount", "NULLFS mount structure");
@@ -137,6 +138,7 @@ nullfs_mount(mp, path, data, ndp, p)
if (error)
return (error);
+ NDFREE(ndp, NDF_ONLY_PNBUF);
/*
* Sanity check on lower vnode
diff --git a/sys/miscfs/procfs/procfs_vnops.c b/sys/miscfs/procfs/procfs_vnops.c
index 17075db..d7de7ce 100644
--- a/sys/miscfs/procfs/procfs_vnops.c
+++ b/sys/miscfs/procfs/procfs_vnops.c
@@ -60,7 +60,6 @@
#include <miscfs/procfs/procfs.h>
#include <sys/pioctl.h>
-static int procfs_abortop __P((struct vop_abortop_args *));
static int procfs_access __P((struct vop_access_args *));
static int procfs_badop __P((void));
static int procfs_bmap __P((struct vop_bmap_args *));
@@ -391,25 +390,6 @@ procfs_print(ap)
}
/*
- * _abortop is called when operations such as
- * rename and create fail. this entry is responsible
- * for undoing any side-effects caused by the lookup.
- * this will always include freeing the pathname buffer.
- */
-static int
-procfs_abortop(ap)
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap;
-{
-
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- return (0);
-}
-
-/*
* generic entry point for unsupported operations
*/
static int
@@ -997,7 +977,6 @@ atopid(b, len)
vop_t **procfs_vnodeop_p;
static struct vnodeopv_entry_desc procfs_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_abortop_desc, (vop_t *) procfs_abortop },
{ &vop_access_desc, (vop_t *) procfs_access },
{ &vop_advlock_desc, (vop_t *) procfs_badop },
{ &vop_bmap_desc, (vop_t *) procfs_bmap },
diff --git a/sys/miscfs/umapfs/umap_vfsops.c b/sys/miscfs/umapfs/umap_vfsops.c
index afa44f0..48894fe 100644
--- a/sys/miscfs/umapfs/umap_vfsops.c
+++ b/sys/miscfs/umapfs/umap_vfsops.c
@@ -52,6 +52,7 @@
#include <sys/namei.h>
#include <sys/malloc.h>
#include <miscfs/umapfs/umap.h>
+#include <vm/vm_zone.h>
static MALLOC_DEFINE(M_UMAPFSMNT, "UMAP mount", "UMAP mount structure");
@@ -129,6 +130,7 @@ umapfs_mount(mp, path, data, ndp, p)
error = namei(ndp);
if (error)
return (error);
+ NDFREE(ndp, NDF_ONLY_PNBUF);
/*
* Sanity check on lower vnode
diff --git a/sys/miscfs/union/union_subr.c b/sys/miscfs/union/union_subr.c
index d7caf10..6b88bef 100644
--- a/sys/miscfs/union/union_subr.c
+++ b/sys/miscfs/union/union_subr.c
@@ -846,8 +846,6 @@ union_relookup(um, dvp, vpp, cnp, cn, path, pathlen)
* by namei, some of the work done by lookup and some of
* the work done by VOP_LOOKUP when given a CREATE flag.
* Conclusion: Horrible.
- *
- * The pathname buffer will be FREEed by VOP_MKDIR.
*/
cn->cn_namelen = pathlen;
cn->cn_pnbuf = zalloc(namei_zone);
@@ -874,8 +872,6 @@ union_relookup(um, dvp, vpp, cnp, cn, path, pathlen)
*/
if ((error = relookup(dvp, vpp, cn)) != 0) {
- zfree(namei_zone, cn->cn_pnbuf);
- cn->cn_pnbuf = NULL;
vn_lock(dvp, LK_EXCLUSIVE | LK_RETRY, cnp->cn_proc);
return(error);
}
@@ -921,7 +917,10 @@ union_mkshadow(um, dvp, cnp, vpp)
return (error);
if (*vpp) {
- VOP_ABORTOP(dvp, &cn);
+ if (cn.cn_flags & HASBUF) {
+ zfree(namei_zone, cn.cn_pnbuf);
+ cn.cn_flags &= ~HASBUF;
+ }
if (dvp == *vpp)
vrele(*vpp);
else
@@ -946,6 +945,10 @@ union_mkshadow(um, dvp, cnp, vpp)
VOP_LEASE(dvp, p, cn.cn_cred, LEASE_WRITE);
error = VOP_MKDIR(dvp, vpp, &cn, &va);
+ if (cn.cn_flags & HASBUF) {
+ zfree(namei_zone, cn.cn_pnbuf);
+ cn.cn_flags &= ~HASBUF;
+ }
/*vput(dvp);*/
return (error);
}
@@ -976,7 +979,10 @@ union_mkwhiteout(um, dvp, cnp, path)
return (error);
if (wvp) {
- VOP_ABORTOP(dvp, &cn);
+ if (cn.cn_flags & HASBUF) {
+ zfree(namei_zone, cn.cn_pnbuf);
+ cn.cn_flags &= ~HASBUF;
+ }
if (wvp == dvp)
vrele(wvp);
else
@@ -988,8 +994,10 @@ union_mkwhiteout(um, dvp, cnp, path)
VOP_LEASE(dvp, p, p->p_ucred, LEASE_WRITE);
error = VOP_WHITEOUT(dvp, &cn, CREATE);
- if (error)
- VOP_ABORTOP(dvp, &cn);
+ if (cn.cn_flags & HASBUF) {
+ zfree(namei_zone, cn.cn_pnbuf);
+ cn.cn_flags &= ~HASBUF;
+ }
return (error);
}
@@ -1059,7 +1067,10 @@ union_vn_create(vpp, un, p)
*/
if (vp) {
vput(un->un_dirvp);
- VOP_ABORTOP(un->un_dirvp, &cn);
+ if (cn.cn_flags & HASBUF) {
+ zfree(namei_zone, cn.cn_pnbuf);
+ cn.cn_flags &= ~HASBUF;
+ }
if (vp == un->un_dirvp)
vrele(vp);
else
@@ -1082,6 +1093,10 @@ union_vn_create(vpp, un, p)
vap->va_mode = cmode;
VOP_LEASE(un->un_dirvp, p, cred, LEASE_WRITE);
error = VOP_CREATE(un->un_dirvp, &vp, &cn, vap);
+ if (cn.cn_flags & HASBUF) {
+ zfree(namei_zone, cn.cn_pnbuf);
+ cn.cn_flags &= ~HASBUF;
+ }
vput(un->un_dirvp);
if (error)
return (error);
diff --git a/sys/miscfs/union/union_vfsops.c b/sys/miscfs/union/union_vfsops.c
index ccd9a13..f5782fa 100644
--- a/sys/miscfs/union/union_vfsops.c
+++ b/sys/miscfs/union/union_vfsops.c
@@ -52,6 +52,7 @@
#include <sys/malloc.h>
#include <sys/filedesc.h>
#include <miscfs/union/union.h>
+#include <vm/vm_zone.h>
static MALLOC_DEFINE(M_UNIONFSMNT, "UNION mount", "UNION mount structure");
@@ -144,6 +145,7 @@ union_mount(mp, path, data, ndp, p)
if (error)
goto bad;
+ NDFREE(ndp, NDF_ONLY_PNBUF);
upperrootvp = ndp->ni_vp;
vrele(ndp->ni_dvp);
ndp->ni_dvp = NULL;
diff --git a/sys/miscfs/union/union_vnops.c b/sys/miscfs/union/union_vnops.c
index 5ab1036..03d41a0 100644
--- a/sys/miscfs/union/union_vnops.c
+++ b/sys/miscfs/union/union_vnops.c
@@ -67,7 +67,6 @@ SYSCTL_INT(_vfs, OID_AUTO, uniondebug, CTLFLAG_RW, &uniondebug, 0, "");
SYSCTL_INT(_vfs, OID_AUTO, uniondebug, CTLFLAG_RD, &uniondebug, 0, "");
#endif
-static int union_abortop __P((struct vop_abortop_args *ap));
static int union_access __P((struct vop_access_args *ap));
static int union_advlock __P((struct vop_advlock_args *ap));
static int union_bmap __P((struct vop_bmap_args *ap));
@@ -1682,43 +1681,6 @@ union_readlink(ap)
}
/*
- * union_abortop:
- *
- * dvp is locked on entry and left locked on return
- *
- */
-
-static int
-union_abortop(ap)
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap;
-{
- struct componentname *cnp = ap->a_cnp;
- struct proc *p = cnp->cn_proc;
- struct union_node *un = VTOUNION(ap->a_dvp);
- int islocked = VOP_ISLOCKED(ap->a_dvp, NULL);
- struct vnode *vp;
- int error;
-
- if (islocked) {
- vp = union_lock_other(un, p);
- } else {
- vp = OTHERVP(ap->a_dvp);
- }
- KASSERT(vp != NULL, ("union_abortop: backing vnode missing!"));
-
- ap->a_dvp = vp;
- error = VCALL(vp, VOFFSET(vop_abortop), ap);
-
- if (islocked)
- union_unlock_other(vp, p);
-
- return (error);
-}
-
-/*
* union_inactive:
*
* Called with the vnode locked. We are expected to unlock the vnode.
@@ -1974,7 +1936,6 @@ union_strategy(ap)
vop_t **union_vnodeop_p;
static struct vnodeopv_entry_desc union_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_abortop_desc, (vop_t *) union_abortop },
{ &vop_access_desc, (vop_t *) union_access },
{ &vop_advlock_desc, (vop_t *) union_advlock },
{ &vop_bmap_desc, (vop_t *) union_bmap },
diff --git a/sys/msdosfs/msdosfs_vfsops.c b/sys/msdosfs/msdosfs_vfsops.c
index 5005de3..3fd65ec 100644
--- a/sys/msdosfs/msdosfs_vfsops.c
+++ b/sys/msdosfs/msdosfs_vfsops.c
@@ -60,6 +60,7 @@
#include <sys/fcntl.h>
#include <sys/malloc.h>
#include <sys/stat.h> /* defines ALLPERMS */
+#include <vm/vm_zone.h>
#include <msdosfs/bpb.h>
#include <msdosfs/bootsect.h>
@@ -288,6 +289,7 @@ msdosfs_mount(mp, path, data, ndp, p)
if (error)
return (error);
devvp = ndp->ni_vp;
+ NDFREE(ndp, NDF_ONLY_PNBUF);
if (!vn_isdisk(devvp)) {
vrele(devvp);
diff --git a/sys/msdosfs/msdosfs_vnops.c b/sys/msdosfs/msdosfs_vnops.c
index 05139a7..3ef8e74 100644
--- a/sys/msdosfs/msdosfs_vnops.c
+++ b/sys/msdosfs/msdosfs_vnops.c
@@ -93,7 +93,6 @@ static int msdosfs_mkdir __P((struct vop_mkdir_args *));
static int msdosfs_rmdir __P((struct vop_rmdir_args *));
static int msdosfs_symlink __P((struct vop_symlink_args *));
static int msdosfs_readdir __P((struct vop_readdir_args *));
-static int msdosfs_abortop __P((struct vop_abortop_args *));
static int msdosfs_bmap __P((struct vop_bmap_args *));
static int msdosfs_strategy __P((struct vop_strategy_args *));
static int msdosfs_print __P((struct vop_print_args *));
@@ -185,13 +184,10 @@ msdosfs_create(ap)
error = createde(&ndirent, pdep, &dep, cnp);
if (error)
goto bad;
- if ((cnp->cn_flags & SAVESTART) == 0)
- zfree(namei_zone, cnp->cn_pnbuf);
*ap->a_vpp = DETOV(dep);
return (0);
bad:
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -215,7 +211,6 @@ msdosfs_mknod(ap)
break;
default:
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
return (EINVAL);
}
/* NOTREACHED */
@@ -906,7 +901,6 @@ msdosfs_link(ap)
struct componentname *a_cnp;
} */ *ap;
{
- VOP_ABORTOP(ap->a_tdvp, ap->a_cnp);
return (EOPNOTSUPP);
}
@@ -1015,14 +1009,12 @@ msdosfs_rename(ap)
(tvp && (fvp->v_mount != tvp->v_mount))) {
error = EXDEV;
abortit:
- VOP_ABORTOP(tdvp, tcnp);
if (tdvp == tvp)
vrele(tdvp);
else
vput(tdvp);
if (tvp)
vput(tvp);
- VOP_ABORTOP(fdvp, fcnp);
vrele(fdvp);
vrele(fvp);
return (error);
@@ -1420,15 +1412,12 @@ msdosfs_mkdir(ap)
error = createde(&ndirent, pdep, &dep, cnp);
if (error)
goto bad;
- if ((cnp->cn_flags & SAVESTART) == 0)
- zfree(namei_zone, cnp->cn_pnbuf);
*ap->a_vpp = DETOV(dep);
return (0);
bad:
clusterfree(pmp, newcluster, NULL);
bad2:
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -1504,8 +1493,6 @@ msdosfs_symlink(ap)
char *a_target;
} */ *ap;
{
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- /* VOP_ABORTOP(ap->a_dvp, ap->a_cnp); ??? */
return (EOPNOTSUPP);
}
@@ -1776,18 +1763,6 @@ out:
return (error);
}
-static int
-msdosfs_abortop(ap)
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap;
-{
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- return (0);
-}
-
/*
* vp - address of vnode file the file
* bn - which cluster we are interested in mapping to a filesystem block number.
@@ -1950,7 +1925,6 @@ msdosfs_putpages(ap)
vop_t **msdosfs_vnodeop_p;
static struct vnodeopv_entry_desc msdosfs_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_abortop_desc, (vop_t *) msdosfs_abortop },
{ &vop_access_desc, (vop_t *) msdosfs_access },
{ &vop_bmap_desc, (vop_t *) msdosfs_bmap },
{ &vop_cachedlookup_desc, (vop_t *) msdosfs_lookup },
diff --git a/sys/nfs/nfs_node.c b/sys/nfs/nfs_node.c
index 4db6fc2..89cbdce 100644
--- a/sys/nfs/nfs_node.c
+++ b/sys/nfs/nfs_node.c
@@ -388,20 +388,3 @@ nfs_islocked(ap)
}
#endif
-/*
- * Nfs abort op, called after namei() when a CREATE/DELETE isn't actually
- * done. Currently nothing to do.
- */
-/* ARGSUSED */
-int
-nfs_abortop(ap)
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap;
-{
-
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- return (0);
-}
diff --git a/sys/nfs/nfs_serv.c b/sys/nfs/nfs_serv.c
index ffaeea7..405e437 100644
--- a/sys/nfs/nfs_serv.c
+++ b/sys/nfs/nfs_serv.c
@@ -61,21 +61,13 @@
* and note that nfsm_*() macros can terminate a procedure on certain
* errors.
*
- * VOP_ABORTOP() only frees the path component if HASBUF is set and
- * SAVESTART is *not* set.
- *
- * Various VOP_*() routines tend to free the path component if an
- * error occurs. If no error occurs, the VOP_*() routines only free
- * the path component if SAVESTART is NOT set.
- *
* lookup() and namei()
* may return garbage in various structural fields/return elements
* if an error is returned, and may garbage up nd.ni_dvp even if no
* error is returned and you did not request LOCKPARENT or WANTPARENT.
*
* We use the ni_cnd.cn_flags 'HASBUF' flag to track whether the name
- * buffer has been freed or not. This is unique to nfs_serv.c for
- * the moment, the rest of the system sets HASBUF but never clears it.
+ * buffer has been freed or not.
*/
#include <sys/param.h>
@@ -604,8 +596,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq)
*/
vrele(ndp->ni_startdir);
ndp->ni_startdir = NULL;
- zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
/*
* Get underlying attribute, then release remaining resources ( for
@@ -638,8 +629,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq)
nfsmout:
if (dirp)
vrele(dirp);
- if (nd.ni_cnd.cn_flags & HASBUF)
- zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (ndp->ni_startdir)
vrele(ndp->ni_startdir);
if (ndp->ni_vp)
@@ -1736,9 +1726,9 @@ nfsrv_create(nfsd, slp, procp, mrq)
if (vap->va_type == VREG || vap->va_type == VSOCK) {
nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
- if (error) {
- nd.ni_cnd.cn_flags &= ~HASBUF;
- } else {
+ if (error)
+ NDFREE(&nd, NDF_ONLY_PNBUF);
+ else {
nfsrv_object_create(nd.ni_vp);
if (exclusive_flag) {
exclusive_flag = 0;
@@ -1769,7 +1759,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
if (error) {
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
goto nfsmreply0;
}
vput(nd.ni_vp);
@@ -1864,15 +1854,7 @@ nfsmout:
}
if (dirp)
vrele(dirp);
- if (nd.ni_cnd.cn_flags & HASBUF) {
- /*
- * Since SAVESTART is set, we own the buffer and need to
- * zfree it ourselves.
- */
- if (nd.ni_dvp)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
- }
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp) {
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
@@ -1970,7 +1952,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
if (error)
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
} else {
if (vtyp != VFIFO && (error = suser_xxx(cred, 0, 0)))
goto out;
@@ -1978,7 +1960,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
if (error) {
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
goto out;
}
vput(nd.ni_vp);
@@ -2012,16 +1994,7 @@ out:
vrele(nd.ni_startdir);
nd.ni_startdir = NULL;
}
- if (nd.ni_cnd.cn_flags & HASBUF) {
- /*
- * Since SAVESTART is set, we own the buffer and need to
- * zfree it ourselves.
- */
- if (nd.ni_dvp)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- nd.ni_cnd.cn_flags &= ~HASBUF;
- zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
- }
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp) {
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
@@ -2057,15 +2030,7 @@ nfsmout:
vrele(dirp);
if (nd.ni_startdir)
vrele(nd.ni_startdir);
- if (nd.ni_cnd.cn_flags & HASBUF) {
- /*
- * Since SAVESTART is set, we own the buffer and need to
- * zfree it ourselves.
- */
- if (nd.ni_dvp)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
- }
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp) {
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
@@ -2143,7 +2108,7 @@ out:
nqsrv_getl(nd.ni_dvp, ND_WRITE);
nqsrv_getl(nd.ni_vp, ND_WRITE);
error = VOP_REMOVE(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd);
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
}
}
if (dirp && v3) {
@@ -2157,14 +2122,7 @@ out:
error = 0;
}
nfsmout:
- if (nd.ni_cnd.cn_flags & HASBUF) {
- /*
- * Since SAVESTART is not set, this is sufficient to free
- * the component buffer. It's actually a NOP since we
- * do not save the name, but what the hey.
- */
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- }
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp) {
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
@@ -2327,11 +2285,6 @@ nfsrv_rename(nfsd, slp, procp, mrq)
out:
if (!error) {
/*
- * Do rename. If an error occured, the underlying path
- * components are freed by the VOP routine. If no error
- * occured, the SAVESTART flag prevents them from being
- * freed.
- *
* The VOP_RENAME function releases all vnode references &
* locks prior to returning so we need to clear the pointers
* to bypass cleanup code later on.
@@ -2378,15 +2331,7 @@ nfsmout:
vrele(tdirp);
if (tond.ni_startdir)
vrele(tond.ni_startdir);
- if (tond.ni_cnd.cn_flags & HASBUF) {
- /*
- * The VOP_ABORTOP is probably a NOP. Since we have set
- * SAVESTART, we need to zfree the buffer ourselves.
- */
- if (tond.ni_dvp)
- VOP_ABORTOP(tond.ni_dvp, &tond.ni_cnd);
- zfree(namei_zone, tond.ni_cnd.cn_pnbuf);
- }
+ NDFREE(&tond, NDF_ONLY_PNBUF);
if (tond.ni_dvp) {
if (tond.ni_dvp == tond.ni_vp)
vrele(tond.ni_dvp);
@@ -2403,11 +2348,7 @@ nfsmout:
vrele(fdirp);
if (fromnd.ni_startdir)
vrele(fromnd.ni_startdir);
- if (fromnd.ni_cnd.cn_flags & HASBUF) {
- if (fromnd.ni_dvp)
- VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
- zfree(namei_zone, fromnd.ni_cnd.cn_pnbuf);
- }
+ NDFREE(&fromnd, NDF_ONLY_PNBUF);
if (fromnd.ni_dvp)
vrele(fromnd.ni_dvp);
if (fromnd.ni_vp)
@@ -2494,15 +2435,10 @@ nfsrv_link(nfsd, slp, procp, mrq)
error = EXDEV;
out:
if (!error) {
- /*
- * Do the link op. Since SAVESTART is not set, the
- * underlying path component is freed whether an error
- * is returned or not.
- */
nqsrv_getl(vp, ND_WRITE);
nqsrv_getl(xp, ND_WRITE);
error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd);
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
}
/* fall through */
@@ -2520,14 +2456,7 @@ out1:
/* fall through */
nfsmout:
- if (nd.ni_cnd.cn_flags & HASBUF) {
- /*
- * Since we are not using SAVESTART,
- * VOP_ABORTOP is sufficient to free the path component
- */
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- /* zfree(namei_zone, nd.ni_cnd.cn_pnbuf); */
- }
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (dirp)
vrele(dirp);
if (vp)
@@ -2629,7 +2558,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap, pathcp);
if (error)
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
else {
vput(nd.ni_vp);
nd.ni_vp = NULL;
@@ -2700,15 +2629,7 @@ out:
/* fall through */
nfsmout:
- if (nd.ni_cnd.cn_flags & HASBUF) {
- /*
- * Since SAVESTART is set, we own the buffer and need to
- * zfree it ourselves.
- */
- if (nd.ni_dvp)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
- }
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp) {
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
@@ -2801,12 +2722,7 @@ nfsrv_mkdir(nfsd, slp, procp, mrq)
vap->va_type = VDIR;
if (nd.ni_vp != NULL) {
- /*
- * Freeup path component. Since SAVESTART was not set,
- * VOP_ABORTOP() will handle it.
- */
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = EEXIST;
goto out;
}
@@ -2818,7 +2734,7 @@ nfsrv_mkdir(nfsd, slp, procp, mrq)
*/
nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vpexcl = 1;
vput(nd.ni_dvp);
@@ -2853,12 +2769,7 @@ nfsmout:
if (dirp)
vrele(dirp);
if (nd.ni_dvp) {
- /*
- * Since SAVESTART is not set, VOP_ABORTOP will always free
- * the path component.
- */
- if (nd.ni_cnd.cn_flags & HASBUF)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == nd.ni_vp && vpexcl)
vrele(nd.ni_dvp);
else
@@ -2953,10 +2864,8 @@ out:
nqsrv_getl(nd.ni_dvp, ND_WRITE);
nqsrv_getl(vp, ND_WRITE);
error = VOP_RMDIR(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd);
- } else {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
}
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (dirp)
diraft_ret = VOP_GETATTR(dirp, &diraft, cred, procp);
@@ -2968,12 +2877,7 @@ out:
/* fall through */
nfsmout:
- /*
- * Since SAVESTART is not set, a VOP_ABORTOP is sufficient to
- * deal with the pathname component.
- */
- if (nd.ni_cnd.cn_flags & HASBUF)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (dirp)
vrele(dirp);
if (nd.ni_dvp) {
diff --git a/sys/nfs/nfs_syscalls.c b/sys/nfs/nfs_syscalls.c
index cd4b351..7519e68 100644
--- a/sys/nfs/nfs_syscalls.c
+++ b/sys/nfs/nfs_syscalls.c
@@ -55,6 +55,7 @@
#include <sys/domain.h>
#include <sys/protosw.h>
#include <sys/namei.h>
+#include <vm/vm_zone.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -179,6 +180,7 @@ nfssvc(p, uap)
error = namei(&nd);
if (error)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if ((nd.ni_vp->v_flag & VROOT) == 0)
error = EINVAL;
nmp = VFSTONFS(nd.ni_vp->v_mount);
diff --git a/sys/nfs/nfs_vnops.c b/sys/nfs/nfs_vnops.c
index 7774b8b..4097d96 100644
--- a/sys/nfs/nfs_vnops.c
+++ b/sys/nfs/nfs_vnops.c
@@ -138,7 +138,6 @@ static int nfs_bwrite __P((struct vop_bwrite_args *));
vop_t **nfsv2_vnodeop_p;
static struct vnodeopv_entry_desc nfsv2_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_abortop_desc, (vop_t *) nfs_abortop },
{ &vop_access_desc, (vop_t *) nfs_access },
{ &vop_advlock_desc, (vop_t *) nfs_advlock },
{ &vop_bmap_desc, (vop_t *) nfs_bmap },
@@ -1249,11 +1248,9 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
else if (vap->va_type == VFIFO || vap->va_type == VSOCK)
rdev = nfs_xdrneg1;
else {
- VOP_ABORTOP(dvp, cnp);
return (EOPNOTSUPP);
}
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc)) != 0) {
- VOP_ABORTOP(dvp, cnp);
return (error);
}
nfsstats.rpccnt[NFSPROC_MKNOD]++;
@@ -1304,7 +1301,6 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
cache_enter(dvp, newvp, cnp);
*vpp = newvp;
}
- zfree(namei_zone, cnp->cn_pnbuf);
VTONFS(dvp)->n_flag |= NMODIFIED;
if (!wccflag)
VTONFS(dvp)->n_attrstamp = 0;
@@ -1363,7 +1359,6 @@ nfs_create(ap)
return (nfs_mknodrpc(dvp, ap->a_vpp, cnp, vap));
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc)) != 0) {
- VOP_ABORTOP(dvp, cnp);
return (error);
}
if (vap->va_vaflags & VA_EXCLUSIVE)
@@ -1430,8 +1425,6 @@ again:
cache_enter(dvp, newvp, cnp);
*ap->a_vpp = newvp;
}
- if (error || (cnp->cn_flags & SAVESTART) == 0)
- zfree(namei_zone, cnp->cn_pnbuf);
VTONFS(dvp)->n_flag |= NMODIFIED;
if (!wccflag)
VTONFS(dvp)->n_attrstamp = 0;
@@ -1503,7 +1496,6 @@ nfs_remove(ap)
error = 0;
} else if (!np->n_sillyrename)
error = nfs_sillyrename(dvp, vp, cnp);
- zfree(namei_zone, cnp->cn_pnbuf);
np->n_attrstamp = 0;
return (error);
}
@@ -1623,14 +1615,12 @@ nfs_rename(ap)
}
out:
- VOP_ABORTOP(tdvp, tcnp);
if (tdvp == tvp)
vrele(tdvp);
else
vput(tdvp);
if (tvp)
vput(tvp);
- VOP_ABORTOP(fdvp, fcnp);
vrele(fdvp);
vrele(fvp);
/*
@@ -1722,7 +1712,6 @@ nfs_link(ap)
int v3;
if (vp->v_mount != tdvp->v_mount) {
- VOP_ABORTOP(tdvp, cnp);
return (EXDEV);
}
@@ -1746,7 +1735,6 @@ nfs_link(ap)
nfsm_wcc_data(tdvp, wccflag);
}
nfsm_reqdone;
- zfree(namei_zone, cnp->cn_pnbuf);
VTONFS(tdvp)->n_flag |= NMODIFIED;
if (!attrflag)
VTONFS(vp)->n_attrstamp = 0;
@@ -1856,12 +1844,6 @@ nfs_symlink(ap)
VTONFS(dvp)->n_flag |= NMODIFIED;
if (!wccflag)
VTONFS(dvp)->n_attrstamp = 0;
- /*
- * cnp's buffer expected to be freed if SAVESTART not set or
- * if an error was returned.
- */
- if (error || (cnp->cn_flags & SAVESTART) == 0)
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -1895,7 +1877,6 @@ nfs_mkdir(ap)
int v3 = NFS_ISV3(dvp);
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc)) != 0) {
- VOP_ABORTOP(dvp, cnp);
return (error);
}
len = cnp->cn_namelen;
@@ -1946,8 +1927,6 @@ nfs_mkdir(ap)
vrele(newvp);
} else
*ap->a_vpp = newvp;
- if (error || (cnp->cn_flags & SAVESTART) == 0)
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -1984,7 +1963,6 @@ nfs_rmdir(ap)
if (v3)
nfsm_wcc_data(dvp, wccflag);
nfsm_reqdone;
- zfree(namei_zone, cnp->cn_pnbuf);
VTONFS(dvp)->n_flag |= NMODIFIED;
if (!wccflag)
VTONFS(dvp)->n_attrstamp = 0;
diff --git a/sys/nfs/nfsnode.h b/sys/nfs/nfsnode.h
index 1ca4529..e654bc0 100644
--- a/sys/nfs/nfsnode.h
+++ b/sys/nfs/nfsnode.h
@@ -194,7 +194,6 @@ int nfs_getpages __P((struct vop_getpages_args *));
int nfs_putpages __P((struct vop_putpages_args *));
int nfs_write __P((struct vop_write_args *));
int nqnfs_vop_lease_check __P((struct vop_lease_args *));
-int nfs_abortop __P((struct vop_abortop_args *));
int nfs_inactive __P((struct vop_inactive_args *));
int nfs_reclaim __P((struct vop_reclaim_args *));
diff --git a/sys/nfsclient/nfs_nfsiod.c b/sys/nfsclient/nfs_nfsiod.c
index cd4b351..7519e68 100644
--- a/sys/nfsclient/nfs_nfsiod.c
+++ b/sys/nfsclient/nfs_nfsiod.c
@@ -55,6 +55,7 @@
#include <sys/domain.h>
#include <sys/protosw.h>
#include <sys/namei.h>
+#include <vm/vm_zone.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -179,6 +180,7 @@ nfssvc(p, uap)
error = namei(&nd);
if (error)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if ((nd.ni_vp->v_flag & VROOT) == 0)
error = EINVAL;
nmp = VFSTONFS(nd.ni_vp->v_mount);
diff --git a/sys/nfsclient/nfs_node.c b/sys/nfsclient/nfs_node.c
index 4db6fc2..89cbdce 100644
--- a/sys/nfsclient/nfs_node.c
+++ b/sys/nfsclient/nfs_node.c
@@ -388,20 +388,3 @@ nfs_islocked(ap)
}
#endif
-/*
- * Nfs abort op, called after namei() when a CREATE/DELETE isn't actually
- * done. Currently nothing to do.
- */
-/* ARGSUSED */
-int
-nfs_abortop(ap)
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap;
-{
-
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- return (0);
-}
diff --git a/sys/nfsclient/nfs_vnops.c b/sys/nfsclient/nfs_vnops.c
index 7774b8b..4097d96 100644
--- a/sys/nfsclient/nfs_vnops.c
+++ b/sys/nfsclient/nfs_vnops.c
@@ -138,7 +138,6 @@ static int nfs_bwrite __P((struct vop_bwrite_args *));
vop_t **nfsv2_vnodeop_p;
static struct vnodeopv_entry_desc nfsv2_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_abortop_desc, (vop_t *) nfs_abortop },
{ &vop_access_desc, (vop_t *) nfs_access },
{ &vop_advlock_desc, (vop_t *) nfs_advlock },
{ &vop_bmap_desc, (vop_t *) nfs_bmap },
@@ -1249,11 +1248,9 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
else if (vap->va_type == VFIFO || vap->va_type == VSOCK)
rdev = nfs_xdrneg1;
else {
- VOP_ABORTOP(dvp, cnp);
return (EOPNOTSUPP);
}
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc)) != 0) {
- VOP_ABORTOP(dvp, cnp);
return (error);
}
nfsstats.rpccnt[NFSPROC_MKNOD]++;
@@ -1304,7 +1301,6 @@ nfs_mknodrpc(dvp, vpp, cnp, vap)
cache_enter(dvp, newvp, cnp);
*vpp = newvp;
}
- zfree(namei_zone, cnp->cn_pnbuf);
VTONFS(dvp)->n_flag |= NMODIFIED;
if (!wccflag)
VTONFS(dvp)->n_attrstamp = 0;
@@ -1363,7 +1359,6 @@ nfs_create(ap)
return (nfs_mknodrpc(dvp, ap->a_vpp, cnp, vap));
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc)) != 0) {
- VOP_ABORTOP(dvp, cnp);
return (error);
}
if (vap->va_vaflags & VA_EXCLUSIVE)
@@ -1430,8 +1425,6 @@ again:
cache_enter(dvp, newvp, cnp);
*ap->a_vpp = newvp;
}
- if (error || (cnp->cn_flags & SAVESTART) == 0)
- zfree(namei_zone, cnp->cn_pnbuf);
VTONFS(dvp)->n_flag |= NMODIFIED;
if (!wccflag)
VTONFS(dvp)->n_attrstamp = 0;
@@ -1503,7 +1496,6 @@ nfs_remove(ap)
error = 0;
} else if (!np->n_sillyrename)
error = nfs_sillyrename(dvp, vp, cnp);
- zfree(namei_zone, cnp->cn_pnbuf);
np->n_attrstamp = 0;
return (error);
}
@@ -1623,14 +1615,12 @@ nfs_rename(ap)
}
out:
- VOP_ABORTOP(tdvp, tcnp);
if (tdvp == tvp)
vrele(tdvp);
else
vput(tdvp);
if (tvp)
vput(tvp);
- VOP_ABORTOP(fdvp, fcnp);
vrele(fdvp);
vrele(fvp);
/*
@@ -1722,7 +1712,6 @@ nfs_link(ap)
int v3;
if (vp->v_mount != tdvp->v_mount) {
- VOP_ABORTOP(tdvp, cnp);
return (EXDEV);
}
@@ -1746,7 +1735,6 @@ nfs_link(ap)
nfsm_wcc_data(tdvp, wccflag);
}
nfsm_reqdone;
- zfree(namei_zone, cnp->cn_pnbuf);
VTONFS(tdvp)->n_flag |= NMODIFIED;
if (!attrflag)
VTONFS(vp)->n_attrstamp = 0;
@@ -1856,12 +1844,6 @@ nfs_symlink(ap)
VTONFS(dvp)->n_flag |= NMODIFIED;
if (!wccflag)
VTONFS(dvp)->n_attrstamp = 0;
- /*
- * cnp's buffer expected to be freed if SAVESTART not set or
- * if an error was returned.
- */
- if (error || (cnp->cn_flags & SAVESTART) == 0)
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -1895,7 +1877,6 @@ nfs_mkdir(ap)
int v3 = NFS_ISV3(dvp);
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc)) != 0) {
- VOP_ABORTOP(dvp, cnp);
return (error);
}
len = cnp->cn_namelen;
@@ -1946,8 +1927,6 @@ nfs_mkdir(ap)
vrele(newvp);
} else
*ap->a_vpp = newvp;
- if (error || (cnp->cn_flags & SAVESTART) == 0)
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -1984,7 +1963,6 @@ nfs_rmdir(ap)
if (v3)
nfsm_wcc_data(dvp, wccflag);
nfsm_reqdone;
- zfree(namei_zone, cnp->cn_pnbuf);
VTONFS(dvp)->n_flag |= NMODIFIED;
if (!wccflag)
VTONFS(dvp)->n_attrstamp = 0;
diff --git a/sys/nfsclient/nfsnode.h b/sys/nfsclient/nfsnode.h
index 1ca4529..e654bc0 100644
--- a/sys/nfsclient/nfsnode.h
+++ b/sys/nfsclient/nfsnode.h
@@ -194,7 +194,6 @@ int nfs_getpages __P((struct vop_getpages_args *));
int nfs_putpages __P((struct vop_putpages_args *));
int nfs_write __P((struct vop_write_args *));
int nqnfs_vop_lease_check __P((struct vop_lease_args *));
-int nfs_abortop __P((struct vop_abortop_args *));
int nfs_inactive __P((struct vop_inactive_args *));
int nfs_reclaim __P((struct vop_reclaim_args *));
diff --git a/sys/nfsserver/nfs_serv.c b/sys/nfsserver/nfs_serv.c
index ffaeea7..405e437 100644
--- a/sys/nfsserver/nfs_serv.c
+++ b/sys/nfsserver/nfs_serv.c
@@ -61,21 +61,13 @@
* and note that nfsm_*() macros can terminate a procedure on certain
* errors.
*
- * VOP_ABORTOP() only frees the path component if HASBUF is set and
- * SAVESTART is *not* set.
- *
- * Various VOP_*() routines tend to free the path component if an
- * error occurs. If no error occurs, the VOP_*() routines only free
- * the path component if SAVESTART is NOT set.
- *
* lookup() and namei()
* may return garbage in various structural fields/return elements
* if an error is returned, and may garbage up nd.ni_dvp even if no
* error is returned and you did not request LOCKPARENT or WANTPARENT.
*
* We use the ni_cnd.cn_flags 'HASBUF' flag to track whether the name
- * buffer has been freed or not. This is unique to nfs_serv.c for
- * the moment, the rest of the system sets HASBUF but never clears it.
+ * buffer has been freed or not.
*/
#include <sys/param.h>
@@ -604,8 +596,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq)
*/
vrele(ndp->ni_startdir);
ndp->ni_startdir = NULL;
- zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
/*
* Get underlying attribute, then release remaining resources ( for
@@ -638,8 +629,7 @@ nfsrv_lookup(nfsd, slp, procp, mrq)
nfsmout:
if (dirp)
vrele(dirp);
- if (nd.ni_cnd.cn_flags & HASBUF)
- zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (ndp->ni_startdir)
vrele(ndp->ni_startdir);
if (ndp->ni_vp)
@@ -1736,9 +1726,9 @@ nfsrv_create(nfsd, slp, procp, mrq)
if (vap->va_type == VREG || vap->va_type == VSOCK) {
nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
- if (error) {
- nd.ni_cnd.cn_flags &= ~HASBUF;
- } else {
+ if (error)
+ NDFREE(&nd, NDF_ONLY_PNBUF);
+ else {
nfsrv_object_create(nd.ni_vp);
if (exclusive_flag) {
exclusive_flag = 0;
@@ -1769,7 +1759,7 @@ nfsrv_create(nfsd, slp, procp, mrq)
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
if (error) {
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
goto nfsmreply0;
}
vput(nd.ni_vp);
@@ -1864,15 +1854,7 @@ nfsmout:
}
if (dirp)
vrele(dirp);
- if (nd.ni_cnd.cn_flags & HASBUF) {
- /*
- * Since SAVESTART is set, we own the buffer and need to
- * zfree it ourselves.
- */
- if (nd.ni_dvp)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
- }
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp) {
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
@@ -1970,7 +1952,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
if (error)
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
} else {
if (vtyp != VFIFO && (error = suser_xxx(cred, 0, 0)))
goto out;
@@ -1978,7 +1960,7 @@ nfsrv_mknod(nfsd, slp, procp, mrq)
error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
if (error) {
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
goto out;
}
vput(nd.ni_vp);
@@ -2012,16 +1994,7 @@ out:
vrele(nd.ni_startdir);
nd.ni_startdir = NULL;
}
- if (nd.ni_cnd.cn_flags & HASBUF) {
- /*
- * Since SAVESTART is set, we own the buffer and need to
- * zfree it ourselves.
- */
- if (nd.ni_dvp)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- nd.ni_cnd.cn_flags &= ~HASBUF;
- zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
- }
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp) {
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
@@ -2057,15 +2030,7 @@ nfsmout:
vrele(dirp);
if (nd.ni_startdir)
vrele(nd.ni_startdir);
- if (nd.ni_cnd.cn_flags & HASBUF) {
- /*
- * Since SAVESTART is set, we own the buffer and need to
- * zfree it ourselves.
- */
- if (nd.ni_dvp)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
- }
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp) {
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
@@ -2143,7 +2108,7 @@ out:
nqsrv_getl(nd.ni_dvp, ND_WRITE);
nqsrv_getl(nd.ni_vp, ND_WRITE);
error = VOP_REMOVE(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd);
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
}
}
if (dirp && v3) {
@@ -2157,14 +2122,7 @@ out:
error = 0;
}
nfsmout:
- if (nd.ni_cnd.cn_flags & HASBUF) {
- /*
- * Since SAVESTART is not set, this is sufficient to free
- * the component buffer. It's actually a NOP since we
- * do not save the name, but what the hey.
- */
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- }
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp) {
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
@@ -2327,11 +2285,6 @@ nfsrv_rename(nfsd, slp, procp, mrq)
out:
if (!error) {
/*
- * Do rename. If an error occured, the underlying path
- * components are freed by the VOP routine. If no error
- * occured, the SAVESTART flag prevents them from being
- * freed.
- *
* The VOP_RENAME function releases all vnode references &
* locks prior to returning so we need to clear the pointers
* to bypass cleanup code later on.
@@ -2378,15 +2331,7 @@ nfsmout:
vrele(tdirp);
if (tond.ni_startdir)
vrele(tond.ni_startdir);
- if (tond.ni_cnd.cn_flags & HASBUF) {
- /*
- * The VOP_ABORTOP is probably a NOP. Since we have set
- * SAVESTART, we need to zfree the buffer ourselves.
- */
- if (tond.ni_dvp)
- VOP_ABORTOP(tond.ni_dvp, &tond.ni_cnd);
- zfree(namei_zone, tond.ni_cnd.cn_pnbuf);
- }
+ NDFREE(&tond, NDF_ONLY_PNBUF);
if (tond.ni_dvp) {
if (tond.ni_dvp == tond.ni_vp)
vrele(tond.ni_dvp);
@@ -2403,11 +2348,7 @@ nfsmout:
vrele(fdirp);
if (fromnd.ni_startdir)
vrele(fromnd.ni_startdir);
- if (fromnd.ni_cnd.cn_flags & HASBUF) {
- if (fromnd.ni_dvp)
- VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd);
- zfree(namei_zone, fromnd.ni_cnd.cn_pnbuf);
- }
+ NDFREE(&fromnd, NDF_ONLY_PNBUF);
if (fromnd.ni_dvp)
vrele(fromnd.ni_dvp);
if (fromnd.ni_vp)
@@ -2494,15 +2435,10 @@ nfsrv_link(nfsd, slp, procp, mrq)
error = EXDEV;
out:
if (!error) {
- /*
- * Do the link op. Since SAVESTART is not set, the
- * underlying path component is freed whether an error
- * is returned or not.
- */
nqsrv_getl(vp, ND_WRITE);
nqsrv_getl(xp, ND_WRITE);
error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd);
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
}
/* fall through */
@@ -2520,14 +2456,7 @@ out1:
/* fall through */
nfsmout:
- if (nd.ni_cnd.cn_flags & HASBUF) {
- /*
- * Since we are not using SAVESTART,
- * VOP_ABORTOP is sufficient to free the path component
- */
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- /* zfree(namei_zone, nd.ni_cnd.cn_pnbuf); */
- }
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (dirp)
vrele(dirp);
if (vp)
@@ -2629,7 +2558,7 @@ nfsrv_symlink(nfsd, slp, procp, mrq)
nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap, pathcp);
if (error)
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
else {
vput(nd.ni_vp);
nd.ni_vp = NULL;
@@ -2700,15 +2629,7 @@ out:
/* fall through */
nfsmout:
- if (nd.ni_cnd.cn_flags & HASBUF) {
- /*
- * Since SAVESTART is set, we own the buffer and need to
- * zfree it ourselves.
- */
- if (nd.ni_dvp)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
- }
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp) {
if (nd.ni_dvp == nd.ni_vp)
vrele(nd.ni_dvp);
@@ -2801,12 +2722,7 @@ nfsrv_mkdir(nfsd, slp, procp, mrq)
vap->va_type = VDIR;
if (nd.ni_vp != NULL) {
- /*
- * Freeup path component. Since SAVESTART was not set,
- * VOP_ABORTOP() will handle it.
- */
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
error = EEXIST;
goto out;
}
@@ -2818,7 +2734,7 @@ nfsrv_mkdir(nfsd, slp, procp, mrq)
*/
nqsrv_getl(nd.ni_dvp, ND_WRITE);
error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap);
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vpexcl = 1;
vput(nd.ni_dvp);
@@ -2853,12 +2769,7 @@ nfsmout:
if (dirp)
vrele(dirp);
if (nd.ni_dvp) {
- /*
- * Since SAVESTART is not set, VOP_ABORTOP will always free
- * the path component.
- */
- if (nd.ni_cnd.cn_flags & HASBUF)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (nd.ni_dvp == nd.ni_vp && vpexcl)
vrele(nd.ni_dvp);
else
@@ -2953,10 +2864,8 @@ out:
nqsrv_getl(nd.ni_dvp, ND_WRITE);
nqsrv_getl(vp, ND_WRITE);
error = VOP_RMDIR(nd.ni_dvp, nd.ni_vp, &nd.ni_cnd);
- } else {
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
}
- nd.ni_cnd.cn_flags &= ~HASBUF;
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (dirp)
diraft_ret = VOP_GETATTR(dirp, &diraft, cred, procp);
@@ -2968,12 +2877,7 @@ out:
/* fall through */
nfsmout:
- /*
- * Since SAVESTART is not set, a VOP_ABORTOP is sufficient to
- * deal with the pathname component.
- */
- if (nd.ni_cnd.cn_flags & HASBUF)
- VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if (dirp)
vrele(dirp);
if (nd.ni_dvp) {
diff --git a/sys/nfsserver/nfs_syscalls.c b/sys/nfsserver/nfs_syscalls.c
index cd4b351..7519e68 100644
--- a/sys/nfsserver/nfs_syscalls.c
+++ b/sys/nfsserver/nfs_syscalls.c
@@ -55,6 +55,7 @@
#include <sys/domain.h>
#include <sys/protosw.h>
#include <sys/namei.h>
+#include <vm/vm_zone.h>
#include <netinet/in.h>
#include <netinet/tcp.h>
@@ -179,6 +180,7 @@ nfssvc(p, uap)
error = namei(&nd);
if (error)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
if ((nd.ni_vp->v_flag & VROOT) == 0)
error = EINVAL;
nmp = VFSTONFS(nd.ni_vp->v_mount);
diff --git a/sys/ntfs/ntfs_vfsops.c b/sys/ntfs/ntfs_vfsops.c
index 9ad0775..6bc0555 100644
--- a/sys/ntfs/ntfs_vfsops.c
+++ b/sys/ntfs/ntfs_vfsops.c
@@ -53,6 +53,7 @@
#include <vm/vm_page.h>
#include <vm/vm_object.h>
#include <vm/vm_extern.h>
+#include <vm/vm_zone.h>
#if defined(__NetBSD__)
#include <miscfs/specfs/specdev.h>
@@ -316,7 +317,7 @@ ntfs_mount (
/* can't get devvp!*/
goto error_1;
}
-
+ NDFREE(ndp, NDF_ONLY_PNBUF);
devvp = ndp->ni_vp;
#if defined(__FreeBSD__)
diff --git a/sys/nwfs/nwfs_vnops.c b/sys/nwfs/nwfs_vnops.c
index 29d7a82..22df1b3 100644
--- a/sys/nwfs/nwfs_vnops.c
+++ b/sys/nwfs/nwfs_vnops.c
@@ -77,7 +77,6 @@ static int nwfs_mkdir __P((struct vop_mkdir_args *));
static int nwfs_rmdir __P((struct vop_rmdir_args *));
static int nwfs_symlink __P((struct vop_symlink_args *));
static int nwfs_readdir __P((struct vop_readdir_args *));
-static int nwfs_abortop __P((struct vop_abortop_args *));
static int nwfs_bmap __P((struct vop_bmap_args *));
static int nwfs_strategy __P((struct vop_strategy_args *));
static int nwfs_print __P((struct vop_print_args *));
@@ -87,7 +86,6 @@ static int nwfs_pathconf __P((struct vop_pathconf_args *ap));
vop_t **nwfs_vnodeop_p;
static struct vnodeopv_entry_desc nwfs_vnodeop_entries[] = {
{ &vop_default_desc, (vop_t *) vop_defaultop },
- { &vop_abortop_desc, (vop_t *) nwfs_abortop },
{ &vop_access_desc, (vop_t *) nwfs_access },
{ &vop_bmap_desc, (vop_t *) nwfs_bmap },
{ &vop_open_desc, (vop_t *) nwfs_open },
@@ -453,7 +451,6 @@ nwfs_create(ap)
if (vap->va_type == VSOCK)
return (EOPNOTSUPP);
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc))) {
- VOP_ABORTOP(dvp, cnp);
return (error);
}
fmode = AR_READ | AR_WRITE;
@@ -476,7 +473,6 @@ nwfs_create(ap)
if (cnp->cn_flags & MAKEENTRY)
cache_enter(dvp, vp, cnp);
}
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -510,7 +506,6 @@ nwfs_remove(ap)
cnp->cn_namelen,cnp->cn_nameptr,cnp->cn_proc,cnp->cn_cred);
if (error == 0x899c) error = EACCES;
}
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -604,9 +599,7 @@ out:
/*
* nwfs hard link create call
- * Netware filesystems don't know what links are. But since we already called
- * nwfs_lookup() with create and lockparent, the parent is locked so we
- * have to free it before we return the error.
+ * Netware filesystems don't know what links are.
*/
static int
nwfs_link(ap)
@@ -616,8 +609,6 @@ nwfs_link(ap)
struct componentname *a_cnp;
} */ *ap;
{
-/* VOP_ABORTOP(ap->a_tdvp, ap->a_cnp);*/
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
return EOPNOTSUPP;
}
@@ -635,8 +626,6 @@ nwfs_symlink(ap)
char *a_target;
} */ *ap;
{
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- /* VOP_ABORTOP(ap->a_dvp, ap->a_cnp); ??? */
return (EOPNOTSUPP);
}
@@ -672,11 +661,9 @@ nwfs_mkdir(ap)
char *name=cnp->cn_nameptr;
if ((error = VOP_GETATTR(dvp, &vattr, cnp->cn_cred, cnp->cn_proc))) {
- VOP_ABORTOP(dvp, cnp);
return (error);
}
if ((name[0] == '.') && ((len == 1) || ((len == 2) && (name[1] == '.')))) {
- VOP_ABORTOP(dvp, cnp);
return EEXIST;
}
if (ncp_open_create_file_or_subdir(VTONWFS(dvp),dvp, cnp->cn_namelen,
@@ -696,7 +683,6 @@ nwfs_mkdir(ap)
*ap->a_vpp = newvp;
}
}
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -724,7 +710,6 @@ nwfs_rmdir(ap)
error = ncp_DeleteNSEntry(nmp, dnp->n_fid.f_id,
cnp->cn_namelen, cnp->cn_nameptr,cnp->cn_proc,cnp->cn_cred);
if (error == NWE_DIR_NOT_EMPTY) error = ENOTEMPTY;
- zfree(namei_zone, cnp->cn_pnbuf);
dnp->n_flag |= NMODIFIED;
nwfs_attr_cacheremove(dvp);
cache_purge(dvp);
@@ -864,23 +849,6 @@ nwfs_bmap(ap)
*ap->a_runb = 0;
return (0);
}
-/*
- * nwfs abort op, called after namei() when a CREATE/DELETE isn't actually
- * done. Currently nothing to do.
- */
-/* ARGSUSED */
-int
-nwfs_abortop(ap)
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap;
-{
-
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- return (0);
-}
int
nwfs_nget(struct mount *mp, ncpfid fid, struct nw_entry_info *fap,
diff --git a/sys/svr4/svr4_misc.c b/sys/svr4/svr4_misc.c
index 2abacee..6399049 100644
--- a/sys/svr4/svr4_misc.c
+++ b/sys/svr4/svr4_misc.c
@@ -1650,7 +1650,7 @@ svr4_sys_resolvepath(p, uap)
*retval = strlen(nd.ni_cnd.cn_pnbuf) < SCARG(uap, bufsiz) ?
strlen(nd.ni_cnd.cn_pnbuf) + 1 : SCARG(uap, bufsiz);
bad:
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vput(nd.ni_vp);
- zfree(namei_zone, nd.ni_cnd.cn_pnbuf);
return error;
}
diff --git a/sys/svr4/svr4_sysvec.c b/sys/svr4/svr4_sysvec.c
index f88b7d1..fbd4212 100644
--- a/sys/svr4/svr4_sysvec.c
+++ b/sys/svr4/svr4_sysvec.c
@@ -296,6 +296,7 @@ svr4_emul_find(p, sgp, prefix, path, pbuf, cflag)
free(buf, M_TEMP);
return error;
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
*cp = '/';
}
@@ -306,6 +307,7 @@ svr4_emul_find(p, sgp, prefix, path, pbuf, cflag)
free(buf, M_TEMP);
return error;
}
+ NDFREE(&nd, NDF_ONLY_PNBUF);
/*
* We now compare the vnode of the svr4_root to the one
@@ -324,6 +326,7 @@ svr4_emul_find(p, sgp, prefix, path, pbuf, cflag)
vrele(nd.ni_vp);
return error;
}
+ NDFREE(&ndroot, NDF_ONLY_PNBUF);
if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0) {
goto done;
diff --git a/sys/sys/namei.h b/sys/sys/namei.h
index 79ad5f3..854d779 100644
--- a/sys/sys/namei.h
+++ b/sys/sys/namei.h
@@ -144,13 +144,62 @@ struct nameidata {
/*
* Initialization of an nameidata structure.
*/
-#define NDINIT(ndp, op, flags, segflg, namep, p) { \
- (ndp)->ni_cnd.cn_nameiop = op; \
- (ndp)->ni_cnd.cn_flags = flags; \
- (ndp)->ni_segflg = segflg; \
- (ndp)->ni_dirp = namep; \
- (ndp)->ni_cnd.cn_proc = p; \
+static void NDINIT __P((struct nameidata *, u_long, u_long, enum uio_seg,
+ const char *, struct proc *));
+static __inline void
+NDINIT(ndp, op, flags, segflg, namep, p)
+ struct nameidata *ndp;
+ u_long op, flags;
+ enum uio_seg segflg;
+ const char *namep;
+ struct proc *p;
+{
+ ndp->ni_cnd.cn_nameiop = op;
+ ndp->ni_cnd.cn_flags = flags;
+ ndp->ni_segflg = segflg;
+ ndp->ni_dirp = namep;
+ ndp->ni_cnd.cn_proc = p;
}
+
+#define NDF_NO_DVP_RELE 0x00000001
+#define NDF_NO_DVP_UNLOCK 0x00000002
+#define NDF_NO_DVP_PUT 0x00000003
+#define NDF_NO_VP_RELE 0x00000004
+#define NDF_NO_VP_UNLOCK 0x00000008
+#define NDF_NO_VP_PUT 0x0000000c
+#define NDF_NO_STARTDIR_RELE 0x00000010
+#define NDF_NO_FREE_PNBUF 0x00000020
+#define NDF_ONLY_PNBUF (~NDF_NO_FREE_PNBUF)
+
+#define NDFREE(ndp, flags) do { \
+ struct nameidata *_ndp = (ndp); \
+ unsigned int _flags = (flags); \
+ \
+ if (!(_flags & NDF_NO_FREE_PNBUF) && \
+ (_ndp->ni_cnd.cn_flags & HASBUF)) { \
+ zfree(namei_zone, _ndp->ni_cnd.cn_pnbuf); \
+ _ndp->ni_cnd.cn_flags &= ~HASBUF; \
+ } \
+ if (!(_flags & NDF_NO_DVP_UNLOCK) && \
+ (_ndp->ni_cnd.cn_flags & LOCKPARENT)) \
+ VOP_UNLOCK(_ndp->ni_dvp, 0, _ndp->ni_cnd.cn_proc); \
+ if (!(_flags & NDF_NO_DVP_RELE) && \
+ (_ndp->ni_cnd.cn_flags & (LOCKPARENT|WANTPARENT))) { \
+ vrele(_ndp->ni_dvp); \
+ _ndp->ni_dvp = NULL; \
+ } \
+ if (!(_flags & NDF_NO_VP_RELE) && \
+ _ndp->ni_vp) { \
+ vrele(_ndp->ni_vp); \
+ _ndp->ni_vp = NULL; \
+ } \
+ if (!(_flags & NDF_NO_STARTDIR_RELE) && \
+ (_ndp->ni_cnd.cn_flags & SAVESTART)) { \
+ vrele(_ndp->ni_startdir); \
+ _ndp->ni_startdir = NULL; \
+ } \
+} while (0)
+
#endif
#ifdef KERNEL
diff --git a/sys/ufs/ffs/ffs_vfsops.c b/sys/ufs/ffs/ffs_vfsops.c
index 3652f54..216bb45 100644
--- a/sys/ufs/ffs/ffs_vfsops.c
+++ b/sys/ufs/ffs/ffs_vfsops.c
@@ -59,6 +59,7 @@
#include <vm/vm.h>
#include <vm/vm_page.h>
+#include <vm/vm_zone.h>
static MALLOC_DEFINE(M_FFSNODE, "FFS node", "FFS vnode private part");
@@ -272,6 +273,7 @@ ffs_mount( mp, path, data, ndp, p)
goto error_1;
}
+ NDFREE(ndp, NDF_ONLY_PNBUF);
devvp = ndp->ni_vp;
if (!vn_isdisk(devvp)) {
diff --git a/sys/ufs/ufs/ufs_quota.c b/sys/ufs/ufs/ufs_quota.c
index e1b5b5d..c9865f5 100644
--- a/sys/ufs/ufs/ufs_quota.c
+++ b/sys/ufs/ufs/ufs_quota.c
@@ -46,6 +46,7 @@
#include <sys/proc.h>
#include <sys/vnode.h>
#include <sys/mount.h>
+#include <vm/vm_zone.h>
#include <ufs/ufs/quota.h>
#include <ufs/ufs/inode.h>
@@ -390,6 +391,7 @@ quotaon(p, mp, type, fname)
error = vn_open(&nd, FREAD|FWRITE, 0);
if (error)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
VOP_UNLOCK(vp, 0, p);
if (vp->v_type != VREG) {
diff --git a/sys/ufs/ufs/ufs_vnops.c b/sys/ufs/ufs/ufs_vnops.c
index 437b4f5..9adae8c 100644
--- a/sys/ufs/ufs/ufs_vnops.c
+++ b/sys/ufs/ufs/ufs_vnops.c
@@ -71,7 +71,6 @@
#include <ufs/ufs/ufsmount.h>
#include <ufs/ufs/ufs_extern.h>
-static int ufs_abortop __P((struct vop_abortop_args *));
static int ufs_access __P((struct vop_access_args *));
static int ufs_advlock __P((struct vop_advlock_args *));
static int ufs_chmod __P((struct vnode *, int, struct ucred *, struct proc *));
@@ -736,22 +735,18 @@ ufs_link(ap)
panic("ufs_link: no name");
#endif
if (tdvp->v_mount != vp->v_mount) {
- VOP_ABORTOP(tdvp, cnp);
error = EXDEV;
goto out2;
}
if (tdvp != vp && (error = vn_lock(vp, LK_EXCLUSIVE, p))) {
- VOP_ABORTOP(tdvp, cnp);
goto out2;
}
ip = VTOI(vp);
if ((nlink_t)ip->i_nlink >= LINK_MAX) {
- VOP_ABORTOP(tdvp, cnp);
error = EMLINK;
goto out1;
}
if (ip->i_flags & (IMMUTABLE | APPEND)) {
- VOP_ABORTOP(tdvp, cnp);
error = EPERM;
goto out1;
}
@@ -771,7 +766,6 @@ ufs_link(ap)
ip->i_nlink--;
ip->i_flag |= IN_CHANGE;
}
- zfree(namei_zone, cnp->cn_pnbuf);
out1:
if (tdvp != vp)
VOP_UNLOCK(vp, 0, p);
@@ -833,10 +827,6 @@ ufs_whiteout(ap)
default:
panic("ufs_whiteout: unknown op");
}
- if (cnp->cn_flags & HASBUF) {
- zfree(namei_zone, cnp->cn_pnbuf);
- cnp->cn_flags &= ~HASBUF;
- }
return (error);
}
@@ -899,14 +889,12 @@ ufs_rename(ap)
(tvp && (fvp->v_mount != tvp->v_mount))) {
error = EXDEV;
abortit:
- VOP_ABORTOP(tdvp, tcnp);
if (tdvp == tvp)
vrele(tdvp);
else
vput(tdvp);
if (tvp)
vput(tvp);
- VOP_ABORTOP(fdvp, fcnp);
vrele(fdvp);
vrele(fvp);
return (error);
@@ -940,7 +928,6 @@ abortit:
}
/* Release destination completely. */
- VOP_ABORTOP(tdvp, tcnp);
vput(tdvp);
vput(tvp);
@@ -1349,7 +1336,6 @@ ufs_mkdir(ap)
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, ucp, 0))) {
- zfree(namei_zone, cnp->cn_pnbuf);
UFS_VFREE(tvp, ip->i_number, dmode);
vput(tvp);
return (error);
@@ -1361,7 +1347,6 @@ ufs_mkdir(ap)
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, cnp->cn_cred, 0))) {
- zfree(namei_zone, cnp->cn_pnbuf);
UFS_VFREE(tvp, ip->i_number, dmode);
vput(tvp);
return (error);
@@ -1465,7 +1450,6 @@ bad:
vput(tvp);
}
out:
- zfree(namei_zone, cnp->cn_pnbuf);
return (error);
}
@@ -1733,23 +1717,6 @@ ufs_readlink(ap)
}
/*
- * Ufs abort op, called after namei() when a CREATE/DELETE isn't actually
- * done. If a buffer has been saved in anticipation of a CREATE, delete it.
- */
-/* ARGSUSED */
-int
-ufs_abortop(ap)
- struct vop_abortop_args /* {
- struct vnode *a_dvp;
- struct componentname *a_cnp;
- } */ *ap;
-{
- if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF)
- zfree(namei_zone, ap->a_cnp->cn_pnbuf);
- return (0);
-}
-
-/*
* Calculate the logical to physical mapping if not done already,
* then call the device strategy routine.
*
@@ -2087,10 +2054,8 @@ ufs_makeinode(mode, dvp, vpp, cnp)
mode |= IFREG;
error = UFS_VALLOC(dvp, mode, cnp->cn_cred, &tvp);
- if (error) {
- zfree(namei_zone, cnp->cn_pnbuf);
+ if (error)
return (error);
- }
ip = VTOI(tvp);
ip->i_gid = pdir->i_gid;
#ifdef SUIDDIR
@@ -2131,7 +2096,6 @@ ufs_makeinode(mode, dvp, vpp, cnp)
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, ucp, 0))) {
- zfree(namei_zone, cnp->cn_pnbuf);
UFS_VFREE(tvp, ip->i_number, mode);
vput(tvp);
return (error);
@@ -2143,7 +2107,6 @@ ufs_makeinode(mode, dvp, vpp, cnp)
#ifdef QUOTA
if ((error = getinoquota(ip)) ||
(error = chkiq(ip, 1, cnp->cn_cred, 0))) {
- zfree(namei_zone, cnp->cn_pnbuf);
UFS_VFREE(tvp, ip->i_number, mode);
vput(tvp);
return (error);
@@ -2174,9 +2137,6 @@ ufs_makeinode(mode, dvp, vpp, cnp)
error = ufs_direnter(dvp, tvp, &newdir, cnp, NULL);
if (error)
goto bad;
-
- if ((cnp->cn_flags & SAVESTART) == 0)
- zfree(namei_zone, cnp->cn_pnbuf);
*vpp = tvp;
return (0);
@@ -2185,7 +2145,6 @@ bad:
* Write error occurred trying to update the inode
* or the directory so must deallocate the inode.
*/
- zfree(namei_zone, cnp->cn_pnbuf);
ip->i_effnlink = 0;
ip->i_nlink = 0;
ip->i_flag |= IN_CHANGE;
@@ -2210,7 +2169,6 @@ static struct vnodeopv_entry_desc ufs_vnodeop_entries[] = {
{ &vop_read_desc, (vop_t *) ufs_missingop },
{ &vop_reallocblks_desc, (vop_t *) ufs_missingop },
{ &vop_write_desc, (vop_t *) ufs_missingop },
- { &vop_abortop_desc, (vop_t *) ufs_abortop },
{ &vop_access_desc, (vop_t *) ufs_access },
{ &vop_advlock_desc, (vop_t *) ufs_advlock },
{ &vop_bmap_desc, (vop_t *) ufs_bmap },
diff --git a/sys/vm/vm_swap.c b/sys/vm/vm_swap.c
index 08825b1..9140c1f 100644
--- a/sys/vm/vm_swap.c
+++ b/sys/vm/vm_swap.c
@@ -53,6 +53,7 @@
#include <vm/vm.h>
#include <vm/vm_extern.h>
#include <vm/swap_pager.h>
+#include <vm/vm_zone.h>
/*
* Indirect driver for multi-controller paging.
@@ -173,6 +174,7 @@ swapon(p, uap)
if (error)
return (error);
+ NDFREE(&nd, NDF_ONLY_PNBUF);
vp = nd.ni_vp;
if (!vn_isdisk(vp))
OpenPOWER on IntegriCloud