Index: coda/coda_vfsops.c =================================================================== RCS file: /home/ncvs/src/sys/coda/coda_vfsops.c,v retrieving revision 1.20 diff -u -r1.20 coda_vfsops.c --- coda_vfsops.c 1999/09/11 00:45:56 1.20 +++ coda_vfsops.c 1999/11/14 21:16:33 @@ -134,7 +134,7 @@ } /* Validate mount device. Similar to getmdev(). */ - + /* XXX This looks like it is leaking memory passed in (should be freed through VOP_RELEASEND) */ NDINIT(ndp, LOOKUP, FOLLOW, UIO_USERSPACE, data, p); error = namei(ndp); dvp = ndp->ni_vp; @@ -143,6 +143,7 @@ MARK_INT_FAIL(CODA_MOUNT_STATS); return (error); } + /* XXX VOP_RELEASEND(dvp, ndp); */ if (dvp->v_type != VCHR) { MARK_INT_FAIL(CODA_MOUNT_STATS); vrele(dvp); Index: coda/coda_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/coda/coda_vnops.c,v retrieving revision 1.20 diff -u -r1.20 coda_vnops.c --- coda_vnops.c 1999/11/13 20:58:09 1.20 +++ coda_vnops.c 1999/11/14 21:44:34 @@ -131,7 +131,6 @@ { &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 */ @@ -556,6 +555,7 @@ error));) return(error); } + VOP_RELEASEND(tvp, &ndp.ni_cnd); /* * Make sure this is a coda style cnode, but it may be a @@ -745,30 +745,7 @@ 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 +1185,6 @@ } #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 +1245,6 @@ 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 +1298,6 @@ 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 +1464,6 @@ 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 +1513,6 @@ CODADEBUG(CODA_RMDIR, myprintf(("in rmdir result %d\n", error)); ) - if ((cnp->cn_flags & SAVESTART) == 0) { - zfree(namei_zone, cnp->cn_pnbuf); - } return(error); } Index: dev/ccd/ccd.c =================================================================== RCS file: /home/ncvs/src/sys/dev/ccd/ccd.c,v retrieving revision 1.66 diff -u -r1.66 ccd.c --- ccd.c 1999/11/07 10:01:14 1.66 +++ ccd.c 1999/11/14 21:37:17 @@ -1598,9 +1598,8 @@ 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 ((error = VOP_GETATTR(vp, &va, p->p_ucred, p)) != 0) { @@ -1608,16 +1607,13 @@ if (ccddebug & CCDB_FOLLOW|CCDB_INIT) printf("ccdlookup: getattr error = %d\n", error); #endif - VOP_UNLOCK(vp, 0, p); - (void)vn_close(vp, FREAD|FWRITE, p->p_ucred, p); - return (error); + goto bad; } /* XXX: eventually we should handle VREG, too. */ if (va.va_type != VBLK) { - VOP_UNLOCK(vp, 0, p); - (void)vn_close(vp, FREAD|FWRITE, p->p_ucred, p); - return (ENOTBLK); + error = ENOTBLK; + goto bad; } #ifdef DEBUG @@ -1628,6 +1624,11 @@ VOP_UNLOCK(vp, 0, p); *vpp = vp; return (0); +bad: + /* XXX VOP_RELEASEND(NULL, &nd.cn) if vn_open fills in nd normally - though zfree was missing */ + VOP_UNLOCK(vp, 0, p); + (void)vn_close(vp, FREAD|FWRITE, p->p_ucred, p); + return (error); } /* Index: dev/vinum/vinumio.c =================================================================== RCS file: /home/ncvs/src/sys/dev/vinum/vinumio.c,v retrieving revision 1.45 diff -u -r1.45 vinumio.c --- vinumio.c 1999/10/13 03:17:59 1.45 +++ vinumio.c 1999/11/14 21:48:42 @@ -77,6 +77,7 @@ drive->vp->v_usecount); } if (drive->vp->v_type != VBLK) { /* only consider block devices */ + /* XXX VOP_RELEASEND here if vn_open fills in nd normally */ VOP_UNLOCK(drive->vp, 0, drive->p); close_drive(drive); drive->lasterror = ENOTBLK; @@ -87,6 +88,7 @@ return ENOTBLK; } drive->vp->v_numoutput = 0; + /* XXX VOP_RELEASEND here if vn_open fills in nd normally */ VOP_UNLOCK(drive->vp, 0, drive->p); return 0; } @@ -848,7 +850,6 @@ volatile int gooddrives; /* number of usable drives found */ int firsttime; /* set if we have never configured before */ int error; - struct nameidata nd; /* mount point credentials */ char *config_text; /* read the config info from disk into here */ char *volatile cptr; /* pointer into config information */ char *eptr; /* end pointer into config information */ @@ -990,9 +991,9 @@ * serious is afoot. Complain and let the user * snarf the config to see what's wrong. */ + /* XXX nd looks very uninitialized to *me*, at least */ log(LOG_ERR, - "vinum: Config error on drive %s, aborting integration\n", - nd.ni_dirp); + "vinum: Config error, aborting integration\n"); Free(config_text); Free(config_line); free_drive(drive); /* give it back */ Index: dev/vn/vn.c =================================================================== RCS file: /home/ncvs/src/sys/dev/vn/vn.c,v retrieving revision 1.102 diff -u -r1.102 vn.c --- vn.c 1999/11/07 10:01:14 1.102 +++ vn.c 1999/11/14 23:41:23 @@ -536,6 +536,7 @@ } if (nd.ni_vp->v_type != VREG || (error = VOP_GETATTR(nd.ni_vp, &vattr, p->p_ucred, p))) { + /* XXX VOP_RELEASEND() if vn_open ... */ VOP_UNLOCK(nd.ni_vp, 0, p); (void) vn_close(nd.ni_vp, flags, p->p_ucred, p); return (error ? error : EINVAL); @@ -554,6 +555,7 @@ vn->sc_size = vattr.va_size / vn->sc_secsize; error = vnsetcred(vn, p->p_ucred); if (error) { + /* XXX VOP_RELEASEND() if vn_open ... */ (void) vn_close(nd.ni_vp, flags, p->p_ucred, p); return(error); } @@ -575,6 +577,7 @@ IFOPT(vn, VN_FOLLOW) printf("vnioctl: SET vp %p size %x blks\n", vn->sc_vp, vn->sc_size); + /* XXX VOP_RELEASEND() if vn_open ... */ return(0); } Index: gnu/ext2fs/ext2_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/gnu/ext2fs/ext2_vnops.c,v retrieving revision 1.49 diff -u -r1.49 ext2_vnops.c --- ext2_vnops.c 1999/11/13 20:58:10 1.49 +++ ext2_vnops.c 1999/11/13 22:36:38 @@ -329,22 +329,18 @@ 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 @@ 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 @@ (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 @@ } /* Release destination completely. */ - VOP_ABORTOP(tdvp, tcnp); vput(tdvp); vput(tvp); @@ -873,7 +865,6 @@ #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 +876,6 @@ #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 +946,6 @@ } else *ap->a_vpp = tvp; out: - zfree(namei_zone, cnp->cn_pnbuf); return (error); #undef DIRBLKSIZ #define DIRBLKSIZ DEV_BSIZE @@ -1093,7 +1082,6 @@ error = UFS_VALLOC(dvp, mode, cnp->cn_cred, &tvp); if (error) { - zfree(namei_zone, cnp->cn_pnbuf); return (error); } ip = VTOI(tvp); @@ -1138,7 +1126,6 @@ #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 +1137,6 @@ #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 +1164,6 @@ if (error) goto bad; - if ((cnp->cn_flags & SAVESTART) == 0) - zfree(namei_zone, cnp->cn_pnbuf); *vpp = tvp; return (0); @@ -1188,7 +1172,6 @@ * 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); Index: i386/ibcs2/ibcs2_stat.c =================================================================== RCS file: /home/ncvs/src/sys/i386/ibcs2/ibcs2_stat.c,v retrieving revision 1.9 diff -u -r1.9 ibcs2_stat.c --- ibcs2_stat.c 1999/01/28 01:59:52 1.9 +++ ibcs2_stat.c 1999/11/22 01:30:18 @@ -45,6 +45,8 @@ #include #include +#include + static void bsd_stat2ibcs_stat __P((struct stat *, struct ibcs2_stat *)); static int cvt_statfs __P((struct statfs *, caddr_t, int)); @@ -108,6 +110,7 @@ return (error); mp = nd.ni_vp->v_mount; sp = &mp->mnt_stat; + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); if ((error = VFS_STATFS(mp, sp, p)) != 0) return (error); Index: i386/ibcs2/ibcs2_util.c =================================================================== RCS file: /home/ncvs/src/sys/i386/ibcs2/ibcs2_util.c,v retrieving revision 1.6 diff -u -r1.6 ibcs2_util.c --- ibcs2_util.c 1997/07/20 09:39:49 1.6 +++ ibcs2_util.c 1999/11/22 01:34:10 @@ -37,6 +37,8 @@ #include +#include + const char ibcs2_emul_path[] = "/compat/ibcs2"; /* @@ -133,6 +135,7 @@ if ((error = namei(&ndroot)) != 0) { /* Cannot happen! */ free(buf, M_TEMP); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); return error; } @@ -164,8 +167,11 @@ done: + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); - if (!cflag) + if (!cflag) { + VOP_RELEASEND(ndroot.ni_vp, &ndroot.ni_cnd); vrele(ndroot.ni_vp); + } return error; } Index: i386/ibcs2/ibcs2_xenix.c =================================================================== RCS file: /home/ncvs/src/sys/i386/ibcs2/ibcs2_xenix.c,v retrieving revision 1.19 diff -u -r1.19 ibcs2_xenix.c --- ibcs2_xenix.c 1999/08/28 00:44:00 1.19 +++ ibcs2_xenix.c 1999/11/22 01:34:36 @@ -49,6 +49,8 @@ #include #include +#include + extern struct sysent xenix_sysent[]; int @@ -218,6 +220,7 @@ if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0) error = VOP_ACCESS(vp, flags, cred, p); } + VOP_RELEASEND(NULL, &nd.ni_cnd); vput(vp); return error; } Index: i386/ibcs2/imgact_coff.c =================================================================== RCS file: /home/ncvs/src/sys/i386/ibcs2/imgact_coff.c,v retrieving revision 1.39 diff -u -r1.39 imgact_coff.c --- imgact_coff.c 1999/11/14 17:33:40 1.39 +++ imgact_coff.c 1999/11/14 17:34:39 @@ -26,7 +26,7 @@ * (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: src/sys/i386/ibcs2/imgact_coff.c,v 1.39 1999/11/14 17:33:40 eivind Exp $ + * $FreeBSD: src/sys/i386/ibcs2/imgact_coff.c,v 1.38 1999/10/29 18:08:39 phk Exp $ */ #include @@ -279,8 +279,8 @@ fail: VOP_UNLOCK(vp, 0, p); unlocked_fail: + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); - zfree(namei_zone, nd.ni_cnd.cn_pnbuf); return error; } Index: i386/linux/linux_misc.c =================================================================== RCS file: /home/ncvs/src/sys/i386/linux/linux_misc.c,v retrieving revision 1.75 diff -u -r1.75 linux_misc.c --- linux_misc.c 1999/10/29 18:08:45 1.75 +++ linux_misc.c 1999/11/22 01:37:07 @@ -54,6 +54,7 @@ #include #include #include +#include #include #include @@ -194,10 +195,12 @@ goto cleanup; vp = ni.ni_vp; + /* XXX This looks like a totally bogus check */ if (vp == NULL) { error = ENOEXEC; /* ?? */ goto cleanup; } + VOP_RELEASEND(vp, &ni.ni_cnd); /* * From here on down, we have a locked vnode that must be unlocked. Index: i386/linux/linux_stats.c =================================================================== RCS file: /home/ncvs/src/sys/i386/linux/linux_stats.c,v retrieving revision 1.16 diff -u -r1.16 linux_stats.c --- linux_stats.c 1999/11/08 03:33:21 1.16 +++ linux_stats.c 1999/11/22 01:37:49 @@ -45,6 +45,8 @@ #include #include +#include + struct linux_newstat { u_short stat_dev; u_short __pad1; @@ -111,6 +113,7 @@ error = namei(&nd); if (error) return (error); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); error = vn_stat(nd.ni_vp, &buf, p); vput(nd.ni_vp); @@ -147,6 +150,7 @@ error = namei(&nd); if (error) return (error); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vp = nd.ni_vp; error = vn_stat(vp, &sb, p); @@ -217,6 +221,7 @@ error = namei(ndp); if (error) return error; + VOP_RELEASEND(ndp->ni_vp, &ndp->ni_cnd); mp = ndp->ni_vp->v_mount; bsd_statfs = &mp->mnt_stat; vrele(ndp->ni_vp); Index: i386/linux/linux_util.c =================================================================== RCS file: /home/ncvs/src/sys/i386/linux/linux_util.c,v retrieving revision 1.8 diff -u -r1.8 linux_util.c --- linux_util.c 1999/08/28 00:45:25 1.8 +++ linux_util.c 1999/11/22 01:37:58 @@ -39,6 +39,8 @@ #include +#include + const char linux_emul_path[] = "/compat/linux"; /* @@ -135,6 +137,7 @@ if ((error = namei(&ndroot)) != 0) { /* Cannot happen! */ free(buf, M_TEMP); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); return error; } @@ -164,13 +167,18 @@ free(buf, M_TEMP); } + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); - if (!cflag) + if (!cflag) { + VOP_RELEASEND(ndroot.ni_vp, &ndroot.ni_cnd); vrele(ndroot.ni_vp); + } return error; bad: + VOP_RELEASEND(ndroot.ni_vp, &ndroot.ni_cnd); vrele(ndroot.ni_vp); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); free(buf, M_TEMP); return error; Index: isofs/cd9660/cd9660_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/isofs/cd9660/cd9660_vnops.c,v retrieving revision 1.60 diff -u -r1.60 cd9660_vnops.c --- cd9660_vnops.c 1999/10/11 19:18:43 1.60 +++ cd9660_vnops.c 1999/11/13 23:31:30 @@ -71,7 +71,6 @@ 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 *)); @@ -708,22 +707,6 @@ } /* - * 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. */ @@ -851,7 +834,6 @@ 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 }, Index: kern/imgact_elf.c =================================================================== RCS file: /home/ncvs/src/sys/kern/imgact_elf.c,v retrieving revision 1.66 diff -u -r1.66 imgact_elf.c --- imgact_elf.c 1999/10/29 18:08:48 1.66 +++ imgact_elf.c 1999/11/21 23:48:53 @@ -60,6 +60,7 @@ #include #include #include +#include #include #include @@ -330,7 +331,7 @@ nd.ni_vp = NULL; goto fail; } - + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); imgp->vp = nd.ni_vp; /* Index: kern/kern_exec.c =================================================================== RCS file: /home/ncvs/src/sys/kern/kern_exec.c,v retrieving revision 1.102 diff -u -r1.102 kern_exec.c --- kern_exec.c 1999/10/29 18:08:50 1.102 +++ kern_exec.c 1999/11/15 00:55:14 @@ -184,9 +184,9 @@ goto exec_fail_dealloc; if (imgp->interpreted) { exec_unmap_first_page(imgp); - /* free old vnode and name buffer */ + /* free iname buffer and old vnode and name buffer */ + VOP_RELEASEND(ndp->ni_vp, &ndp->ni_cnd); 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); @@ -329,8 +329,8 @@ ARG_MAX + PAGE_SIZE); if (imgp->vp) { + VOP_RELEASEND(imgp->vp, &ndp->ni_cnd); vrele(imgp->vp); - zfree(namei_zone, ndp->ni_cnd.cn_pnbuf); } if (error == 0) Index: kern/uipc_usrreq.c =================================================================== RCS file: /home/ncvs/src/sys/kern/uipc_usrreq.c,v retrieving revision 1.51 diff -u -r1.51 uipc_usrreq.c --- uipc_usrreq.c 1999/10/11 15:19:11 1.51 +++ uipc_usrreq.c 1999/11/15 01:00:51 @@ -559,7 +559,7 @@ return (error); vp = nd.ni_vp; if (vp != NULL) { - VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); if (nd.ni_dvp == vp) vrele(nd.ni_dvp); else @@ -572,6 +572,7 @@ 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); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); vput(nd.ni_dvp); if (error) return (error); @@ -608,6 +609,7 @@ if (error) return (error); vp = nd.ni_vp; + VOP_RELEASEND(vp, &nd.ni_cnd); if (vp->v_type != VSOCK) { error = ENOTSOCK; goto bad; Index: kern/vfs_default.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_default.c,v retrieving revision 1.24 diff -u -r1.24 vfs_default.c --- vfs_default.c 1999/11/07 15:09:49 1.24 +++ vfs_default.c 1999/11/13 23:32:27 @@ -63,7 +63,6 @@ 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 }, Index: kern/vfs_syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_syscalls.c,v retrieving revision 1.143 diff -u -r1.143 vfs_syscalls.c --- vfs_syscalls.c 1999/11/13 20:58:11 1.143 +++ vfs_syscalls.c 1999/11/20 17:07:38 @@ -143,6 +143,7 @@ if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; + VOP_RELEASEND(vp, &nd.ni_cnd); if (SCARG(uap, flags) & MNT_UPDATE) { if ((vp->v_flag & VROOT) == 0) { vput(vp); @@ -297,6 +298,7 @@ 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 @@ if ((error = namei(&nd)) != 0) return (error); vp = nd.ni_vp; + VOP_RELEASEND(vp, &nd.ni_cnd); mp = vp->v_mount; /* @@ -602,6 +605,7 @@ if ((error = namei(&nd)) != 0) return (error); mp = nd.ni_vp->v_mount; + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); return (VFS_QUOTACTL(mp, SCARG(uap, cmd), SCARG(uap, uid), SCARG(uap, arg), p)); @@ -636,6 +640,7 @@ return (error); mp = nd.ni_vp->v_mount; sp = &mp->mnt_stat; + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); error = VFS_STATFS(mp, sp, p); if (error) @@ -833,6 +838,7 @@ SCARG(uap, path), p); if ((error = change_dir(&nd, p)) != 0) return (error); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(fdp->fd_cdir); fdp->fd_cdir = nd.ni_vp; return (0); @@ -908,6 +914,7 @@ SCARG(uap, path), p); if ((error = change_dir(&nd, p)) != 0) return (error); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(fdp->fd_rdir); fdp->fd_rdir = nd.ni_vp; if (!fdp->fd_jdir) { @@ -1000,6 +1007,7 @@ } p->p_dupfd = 0; vp = nd.ni_vp; + VOP_RELEASEND(vp, &nd.ni_cnd); fp->f_data = (caddr_t)vp; fp->f_flag = flags & FMASK; @@ -1134,20 +1142,18 @@ } 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); } + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); + vput(nd.ni_dvp); } else { - VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); if (nd.ni_dvp == vp) vrele(nd.ni_dvp); else @@ -1186,7 +1192,7 @@ if ((error = namei(&nd)) != 0) return (error); if (nd.ni_vp != NULL) { - VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); if (nd.ni_dvp == nd.ni_vp) vrele(nd.ni_dvp); else @@ -1201,6 +1207,7 @@ error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, &vattr); if (error == 0) vput(nd.ni_vp); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); vput(nd.ni_dvp); return (error); } @@ -1238,7 +1245,6 @@ 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 +1254,7 @@ VOP_LEASE(vp, p, p->p_ucred, LEASE_WRITE); error = VOP_LINK(nd.ni_dvp, vp, &nd.ni_cnd); } + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); if (nd.ni_dvp == nd.ni_vp) vrele(nd.ni_dvp); else @@ -1290,7 +1297,7 @@ if ((error = namei(&nd)) != 0) goto out; if (nd.ni_vp) { - VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); if (nd.ni_dvp == nd.ni_vp) vrele(nd.ni_dvp); else @@ -1303,6 +1310,7 @@ 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); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); if (error == 0) vput(nd.ni_vp); vput(nd.ni_dvp); @@ -1334,7 +1342,7 @@ return (error); if (nd.ni_vp != NULLVP || !(nd.ni_cnd.cn_flags & ISWHITEOUT)) { - VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); if (nd.ni_dvp == nd.ni_vp) vrele(nd.ni_dvp); else @@ -1345,8 +1353,8 @@ } 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); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); vput(nd.ni_dvp); ASSERT_VOP_UNLOCKED(nd.ni_dvp, "undelete"); ASSERT_VOP_UNLOCKED(nd.ni_vp, "undelete"); @@ -1395,9 +1403,8 @@ 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); } + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); if (nd.ni_dvp == vp) vrele(nd.ni_dvp); else @@ -1541,6 +1548,7 @@ if ((flags & VWRITE) == 0 || (error = vn_writechk(vp)) == 0) error = VOP_ACCESS(vp, flags, cred, p); } + VOP_RELEASEND(vp, &nd.ni_cnd); vput(vp); out1: cred->cr_uid = t_uid; @@ -1577,6 +1585,7 @@ if ((error = namei(&nd)) != 0) return (error); error = vn_stat(nd.ni_vp, &sb, p); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vput(nd.ni_vp); if (error) return (error); @@ -1615,6 +1624,7 @@ return (error); vp = nd.ni_vp; error = vn_stat(vp, &sb, p); + VOP_RELEASEND(vp, &nd.ni_cnd); vput(vp); if (error) return (error); @@ -1680,6 +1690,7 @@ if ((error = namei(&nd)) != 0) return (error); error = vn_stat(nd.ni_vp, &sb, p); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vput(nd.ni_vp); if (error) return (error); @@ -1716,6 +1727,7 @@ return (error); vp = nd.ni_vp; error = vn_stat(vp, &sb, p); + VOP_RELEASEND(vp, &nd.ni_cnd); vput(vp); if (error) return (error); @@ -1770,6 +1782,7 @@ if ((error = namei(&nd)) != 0) return (error); error = vn_stat(nd.ni_vp, &sb, p); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vput(nd.ni_vp); if (error) return (error); @@ -1808,6 +1821,7 @@ return (error); vp = nd.ni_vp; error = vn_stat(vp, &sb, p); + VOP_RELEASEND(vp, &nd.ni_cnd); vput(vp); if (error) return (error); @@ -1842,6 +1856,7 @@ if ((error = namei(&nd)) != 0) return (error); error = VOP_PATHCONF(nd.ni_vp, SCARG(uap, name), p->p_retval); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vput(nd.ni_vp); return (error); } @@ -1891,6 +1906,7 @@ auio.uio_resid = SCARG(uap, count); error = VOP_READLINK(vp, &auio, p->p_ucred); } + VOP_RELEASEND(vp, &nd.ni_cnd); vput(vp); p->p_retval[0] = SCARG(uap, count) - auio.uio_resid; return (error); @@ -1949,6 +1965,7 @@ if ((error = namei(&nd)) != 0) return (error); error = setfflags(p, nd.ni_vp, SCARG(uap, flags)); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); return error; } @@ -2022,6 +2039,7 @@ if ((error = namei(&nd)) != 0) return (error); error = setfmode(p, nd.ni_vp, SCARG(uap, mode)); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); return error; } @@ -2051,6 +2069,7 @@ if ((error = namei(&nd)) != 0) return (error); error = setfmode(p, nd.ni_vp, SCARG(uap, mode)); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); return error; } @@ -2128,8 +2147,8 @@ if ((error = namei(&nd)) != 0) return (error); error = setfown(p, nd.ni_vp, SCARG(uap, uid), SCARG(uap, gid)); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); - return (error); } @@ -2160,6 +2179,7 @@ if ((error = namei(&nd)) != 0) return (error); error = setfown(p, nd.ni_vp, SCARG(uap, uid), SCARG(uap, gid)); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); return (error); } @@ -2266,6 +2286,7 @@ if ((error = namei(&nd)) != 0) return (error); error = setutimes(p, nd.ni_vp, ts, usrtvp == NULL); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); return (error); } @@ -2300,6 +2321,7 @@ if ((error = namei(&nd)) != 0) return (error); error = setutimes(p, nd.ni_vp, ts, usrtvp == NULL); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vrele(nd.ni_vp); return (error); } @@ -2376,6 +2398,7 @@ vattr.va_size = SCARG(uap, length); error = VOP_SETATTR(vp, &vattr, p->p_ucred, p); } + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vput(vp); return (error); } @@ -2555,7 +2578,7 @@ /* Translate error code for rename("dir1", "dir2/."). */ if (error == EISDIR && fvp->v_type == VDIR) error = EINVAL; - VOP_ABORTOP(fromnd.ni_dvp, &fromnd.ni_cnd); + VOP_RELEASEND(fromnd.ni_dvp, &fromnd.ni_cnd); vrele(fromnd.ni_dvp); vrele(fvp); goto out1; @@ -2594,15 +2617,17 @@ } error = VOP_RENAME(fromnd.ni_dvp, fromnd.ni_vp, &fromnd.ni_cnd, tond.ni_dvp, tond.ni_vp, &tond.ni_cnd); + VOP_RELEASEND(fromnd.ni_dvp, &fromnd.ni_cnd); + VOP_RELEASEND(tond.ni_dvp, &tond.ni_cnd); } else { - VOP_ABORTOP(tond.ni_dvp, &tond.ni_cnd); + VOP_RELEASEND(fromnd.ni_dvp, &fromnd.ni_cnd); + VOP_RELEASEND(tond.ni_dvp, &tond.ni_cnd); 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); } @@ -2611,11 +2636,9 @@ 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); @@ -2650,7 +2673,7 @@ return (error); vp = nd.ni_vp; if (vp != NULL) { - VOP_ABORTOP(nd.ni_dvp, &nd.ni_cnd); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); if (nd.ni_dvp == vp) vrele(nd.ni_dvp); else @@ -2663,6 +2686,7 @@ 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); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); vput(nd.ni_dvp); if (!error) vput(nd.ni_vp); @@ -2717,9 +2741,8 @@ 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); } + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); if (nd.ni_dvp == vp) vrele(nd.ni_dvp); else @@ -3023,6 +3046,7 @@ if (vcount(vp) > 1) VOP_REVOKE(vp, REVOKEALL); out: + VOP_RELEASEND(vp, &nd.ni_cnd); vrele(vp); return (error); } @@ -3079,6 +3103,7 @@ bzero(&fh, sizeof(fh)); fh.fh_fsid = vp->v_mount->mnt_stat.f_fsid; error = VFS_VPTOFH(vp, &fh.fh_fid); + VOP_RELEASEND(vp, &nd.ni_cnd); vput(vp); if (error) return (error); Index: kern/vfs_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/kern/vfs_vnops.c,v retrieving revision 1.83 diff -u -r1.83 vfs_vnops.c --- vfs_vnops.c 1999/11/08 03:32:15 1.83 +++ vfs_vnops.c 1999/11/17 23:14:25 @@ -52,6 +52,7 @@ #include #include #include +#include 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 @@ /* * 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 @@ 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) { + VOP_RELEASEND(ndp->ni_dvp, &ndp->ni_cnd); + 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 @@ vp->v_writecount++; return (0); bad: + VOP_RELEASEND(vp, &ndp->ni_cnd); vput(vp); return (error); } Index: kern/vnode_if.sh =================================================================== RCS file: /home/ncvs/src/sys/kern/vnode_if.sh,v retrieving revision 1.20 diff -u -r1.20 vnode_if.sh --- vnode_if.sh 1999/09/26 18:31:51 1.20 +++ vnode_if.sh 1999/11/13 23:28:09 @@ -71,6 +71,11 @@ * Created from @(#)vnode_if.sh 8.1 (Berkeley) 6/10/93 */ +#define VOP_RELEASEND(vp, cnp) do { \\ + (void)(vp); /* Do side effects of (vp) */ \\ + zfree(namei_zone, (cnp)->cn_pnbuf); \\ +} while (0) + extern struct vnodeop_desc vop_default_desc; END_OF_LEADING_COMMENT ; @@ -157,6 +162,9 @@ } else { die "No IN/OUT direction for \"$ln\"."; } + # Strip extra 'NOFREE' specs I use in vnode_if.src to track + # which cnp's will not be freed. + $ln =~ s/NOFREE\s+//; if ($ln =~ s/^WILLRELE\s+//) { $rele = 'WILLRELE'; } else { Index: kern/vnode_if.src =================================================================== RCS file: /home/ncvs/src/sys/kern/vnode_if.src,v retrieving revision 1.25 diff -u -r1.25 vnode_if.src --- vnode_if.src 1999/11/13 20:58:11 1.25 +++ vnode_if.src 1999/11/13 23:29:03 @@ -65,6 +65,8 @@ # on the flags and operation fields in the (cnp) structure. Note # especially that *vpp may equal dvp and both may be locked. # +# XXX - note that handling of struct componentname hasn't been updated for +# freeing reflexively. vop_lookup { IN struct vnode *dvp; INOUT struct vnode **vpp; @@ -77,6 +79,8 @@ # # This must be an exact copy of lookup. See kern/vfs_cache.c for details. # +# XXX - note that handling of struct componentname hasn't been updated for +# freeing reflexively. vop_cachedlookup { IN struct vnode *dvp; INOUT struct vnode **vpp; @@ -331,14 +335,6 @@ IN struct vnode *vp; INOUT struct uio *uio; IN struct ucred *cred; -}; - -# -#% abortop dvp = = = -# -vop_abortop { - IN struct vnode *dvp; - IN struct componentname *cnp; }; # Index: miscfs/devfs/devfs_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/miscfs/devfs/devfs_vnops.c,v retrieving revision 1.84 diff -u -r1.84 devfs_vnops.c --- devfs_vnops.c 1999/11/13 20:58:12 1.84 +++ devfs_vnops.c 1999/11/13 22:36:47 @@ -681,7 +681,6 @@ */ if ((error = devfs_vntodn(dvp, &tdp)) != 0) { abortit: - VOP_ABORTOP(dvp, cnp); return (error); } if ((error = devfs_vntodn(vp, &tp)) != 0) goto abortit; @@ -791,7 +790,6 @@ || (vp->v_tag != tdvp->v_tag) ) { error = EXDEV; abortit: - VOP_ABORTOP(tdvp, cnp); goto out; } @@ -905,14 +903,12 @@ || ((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); @@ -982,12 +978,10 @@ } /* 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); @@ -1235,8 +1229,6 @@ } */ { DBPRINT(("abortop\n")); - if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF) - zfree(namei_zone, ap->a_cnp->cn_pnbuf); return 0; } #endif /* notyet */ Index: miscfs/fifofs/fifo_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/miscfs/fifofs/fifo_vnops.c,v retrieving revision 1.44 diff -u -r1.44 fifo_vnops.c --- fifo_vnops.c 1999/08/28 00:46:47 1.44 +++ fifo_vnops.c 1999/11/13 23:48:14 @@ -79,7 +79,6 @@ 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 }, Index: miscfs/nullfs/null_vfsops.c =================================================================== RCS file: /home/ncvs/src/sys/miscfs/nullfs/null_vfsops.c,v retrieving revision 1.31 diff -u -r1.31 null_vfsops.c --- null_vfsops.c 1999/09/11 00:46:01 1.31 +++ null_vfsops.c 1999/11/22 05:22:05 @@ -53,6 +53,7 @@ #include #include #include +#include static MALLOC_DEFINE(M_NULLFSMNT, "NULLFS mount", "NULLFS mount structure"); @@ -137,6 +138,7 @@ if (error) return (error); + VOP_RELEASEND(ndp->ni_vp, &ndp->ni_cnd); /* * Sanity check on lower vnode Index: miscfs/procfs/procfs_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/miscfs/procfs/procfs_vnops.c,v retrieving revision 1.73 diff -u -r1.73 procfs_vnops.c --- procfs_vnops.c 1999/11/07 07:52:02 1.73 +++ procfs_vnops.c 1999/11/13 23:51:45 @@ -59,7 +59,6 @@ #include #include -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 *)); @@ -390,25 +389,6 @@ } /* - * _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 @@ -995,7 +975,6 @@ 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 }, Index: miscfs/umapfs/umap_vfsops.c =================================================================== RCS file: /home/ncvs/src/sys/miscfs/umapfs/umap_vfsops.c,v retrieving revision 1.28 diff -u -r1.28 umap_vfsops.c --- umap_vfsops.c 1999/09/11 00:46:02 1.28 +++ umap_vfsops.c 1999/11/22 05:23:13 @@ -52,6 +52,7 @@ #include #include #include +#include static MALLOC_DEFINE(M_UMAPFSMNT, "UMAP mount", "UMAP mount structure"); @@ -129,6 +130,7 @@ error = namei(ndp); if (error) return (error); + VOP_RELEASEND(ndp->ni_vp, &ndp->ni_cnd); /* * Sanity check on lower vnode Index: miscfs/union/union_subr.c =================================================================== RCS file: /home/ncvs/src/sys/miscfs/union/union_subr.c,v retrieving revision 1.42 diff -u -r1.42 union_subr.c --- union_subr.c 1999/10/03 12:18:24 1.42 +++ union_subr.c 1999/11/14 00:28:07 @@ -846,8 +846,6 @@ * 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 @@ */ 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,7 @@ return (error); if (*vpp) { - VOP_ABORTOP(dvp, &cn); + VOP_RELEASEND(dvp, &cn); if (dvp == *vpp) vrele(*vpp); else @@ -946,6 +942,7 @@ VOP_LEASE(dvp, p, cn.cn_cred, LEASE_WRITE); error = VOP_MKDIR(dvp, vpp, &cn, &va); + VOP_RELEASEND(dvp, &cn); /*vput(dvp);*/ return (error); } @@ -976,7 +973,7 @@ return (error); if (wvp) { - VOP_ABORTOP(dvp, &cn); + VOP_RELEASEND(dvp, &cn); if (wvp == dvp) vrele(wvp); else @@ -988,8 +985,7 @@ VOP_LEASE(dvp, p, p->p_ucred, LEASE_WRITE); error = VOP_WHITEOUT(dvp, &cn, CREATE); - if (error) - VOP_ABORTOP(dvp, &cn); + VOP_RELEASEND(dvp, &cn); return (error); } @@ -1059,7 +1055,7 @@ */ if (vp) { vput(un->un_dirvp); - VOP_ABORTOP(un->un_dirvp, &cn); + VOP_RELEASEND(un->un_dirvp, &cn); if (vp == un->un_dirvp) vrele(vp); else @@ -1082,6 +1078,7 @@ vap->va_mode = cmode; VOP_LEASE(un->un_dirvp, p, cred, LEASE_WRITE); error = VOP_CREATE(un->un_dirvp, &vp, &cn, vap); + VOP_RELEASEND(un->un_dirvp, &cn); vput(un->un_dirvp); if (error) return (error); Index: miscfs/union/union_vfsops.c =================================================================== RCS file: /home/ncvs/src/sys/miscfs/union/union_vfsops.c,v retrieving revision 1.36 diff -u -r1.36 union_vfsops.c --- union_vfsops.c 1999/09/26 20:52:41 1.36 +++ union_vfsops.c 1999/11/22 05:23:22 @@ -52,6 +52,7 @@ #include #include #include +#include static MALLOC_DEFINE(M_UNIONFSMNT, "UNION mount", "UNION mount structure"); @@ -144,6 +145,7 @@ if (error) goto bad; + VOP_RELEASEND(ndp->ni_vp, &ndp->ni_cnd); upperrootvp = ndp->ni_vp; vrele(ndp->ni_dvp); ndp->ni_dvp = NULL; Index: miscfs/union/union_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/miscfs/union/union_vnops.c,v retrieving revision 1.68 diff -u -r1.68 union_vnops.c --- union_vnops.c 1999/11/13 20:58:14 1.68 +++ union_vnops.c 1999/11/13 23:56:39 @@ -69,7 +69,6 @@ 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)); @@ -704,7 +703,6 @@ int error = EROFS; if ((dvp = union_lock_upper(dun, cnp->cn_proc)) != NULL) { - struct vnode *vp; error = VOP_MKNOD(dvp, ap->a_vpp, cnp, ap->a_vap); union_unlock_upper(dvp, cnp->cn_proc); } @@ -1685,43 +1683,6 @@ } /* - * 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); - 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. @@ -1977,7 +1938,6 @@ 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 }, Index: msdosfs/msdosfs_vfsops.c =================================================================== RCS file: /home/ncvs/src/sys/msdosfs/msdosfs_vfsops.c,v retrieving revision 1.54 diff -u -r1.54 msdosfs_vfsops.c --- msdosfs_vfsops.c 1999/11/09 14:15:30 1.54 +++ msdosfs_vfsops.c 1999/11/22 05:23:38 @@ -60,6 +60,7 @@ #include #include #include /* defines ALLPERMS */ +#include #include #include @@ -288,6 +289,7 @@ if (error) return (error); devvp = ndp->ni_vp; + VOP_RELEASEND(devvp, &ndp->ni_cnd); if (!vn_isdisk(devvp)) { vrele(devvp); Index: msdosfs/msdosfs_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/msdosfs/msdosfs_vnops.c,v retrieving revision 1.90 diff -u -r1.90 msdosfs_vnops.c --- msdosfs_vnops.c 1999/09/20 23:27:57 1.90 +++ msdosfs_vnops.c 1999/11/14 20:08:52 @@ -93,7 +93,6 @@ 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 @@ 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 @@ break; default: - zfree(namei_zone, ap->a_cnp->cn_pnbuf); return (EINVAL); } /* NOTREACHED */ @@ -906,7 +901,6 @@ struct componentname *a_cnp; } */ *ap; { - VOP_ABORTOP(ap->a_tdvp, ap->a_cnp); return (EOPNOTSUPP); } @@ -1015,14 +1009,12 @@ (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 @@ 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 @@ 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 @@ 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 @@ 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 }, Index: nfs/nfs_node.c =================================================================== RCS file: /home/ncvs/src/sys/nfs/nfs_node.c,v retrieving revision 1.32 diff -u -r1.32 nfs_node.c --- nfs_node.c 1999/08/28 00:49:57 1.32 +++ nfs_node.c 1999/11/13 22:35:53 @@ -398,8 +398,5 @@ struct componentname *a_cnp; } */ *ap; { - - if ((ap->a_cnp->cn_flags & (HASBUF | SAVESTART)) == HASBUF) - zfree(namei_zone, ap->a_cnp->cn_pnbuf); return (0); } Index: nfs/nfs_serv.c =================================================================== RCS file: /home/ncvs/src/sys/nfs/nfs_serv.c,v retrieving revision 1.88 diff -u -r1.88 nfs_serv.c --- nfs_serv.c 1999/11/13 20:58:15 1.88 +++ nfs_serv.c 1999/11/22 03:09:48 @@ -61,13 +61,6 @@ * 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 @@ -500,6 +493,8 @@ error = 0; goto nfsmout; } + /* XXX Do we need to separately free nd.ni_cnd here? I don't know + - psycho namei... */ /* * Locate index file for public filehandle @@ -592,7 +587,11 @@ */ vrele(ndp->ni_startdir); ndp->ni_startdir = NULL; - zfree(namei_zone, nd.ni_cnd.cn_pnbuf); + /* XXX We have no vnode that we are certain we can call + VOP_RELEASEND on here. nd.ni_vp could potentially be a + different filesystem from what nd.ni_dvp would have + been. I think. */ + VOP_RELEASEND(NULL, &nd.ni_cnd); nd.ni_cnd.cn_flags &= ~HASBUF; /* @@ -627,7 +626,7 @@ if (dirp) vrele(dirp); if (nd.ni_cnd.cn_flags & HASBUF) - zfree(namei_zone, nd.ni_cnd.cn_pnbuf); + VOP_RELEASEND(NULL, &nd.ni_cnd); if (ndp->ni_startdir) vrele(ndp->ni_startdir); if (ndp->ni_vp) @@ -1661,6 +1660,7 @@ nqsrv_getl(nd.ni_dvp, ND_WRITE); error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap); if (error) { + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); nd.ni_cnd.cn_flags &= ~HASBUF; } else { nfsrv_object_create(nd.ni_vp); @@ -1693,6 +1693,7 @@ error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap); if (error) { + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); nd.ni_cnd.cn_flags &= ~HASBUF; goto nfsmreply0; } @@ -1789,13 +1790,8 @@ 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); + KASSERT(nd.ni_dvp, ("Missing dvp (XXX Can this happen?")); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); } if (nd.ni_dvp) { if (nd.ni_dvp == nd.ni_vp) @@ -1893,8 +1889,10 @@ nd.ni_startdir = NULL; nqsrv_getl(nd.ni_dvp, ND_WRITE); error = VOP_CREATE(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap); - if (error) + if (error) { + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); nd.ni_cnd.cn_flags &= ~HASBUF; + } } else { if (vtyp != VFIFO && (error = suser_xxx(cred, 0, 0))) goto out; @@ -1902,6 +1900,7 @@ error = VOP_MKNOD(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap); if (error) { + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); nd.ni_cnd.cn_flags &= ~HASBUF; goto out; } @@ -1937,14 +1936,8 @@ 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); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); nd.ni_cnd.cn_flags &= ~HASBUF; - zfree(namei_zone, nd.ni_cnd.cn_pnbuf); } if (nd.ni_dvp) { if (nd.ni_dvp == nd.ni_vp) @@ -1981,15 +1974,8 @@ 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); - } + if (nd.ni_cnd.cn_flags & HASBUF) + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); if (nd.ni_dvp) { if (nd.ni_dvp == nd.ni_vp) vrele(nd.ni_dvp); @@ -2067,6 +2053,7 @@ 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); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); nd.ni_cnd.cn_flags &= ~HASBUF; } } @@ -2082,12 +2069,7 @@ } 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); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); } if (nd.ni_dvp) { if (nd.ni_dvp == nd.ni_vp) @@ -2302,15 +2284,8 @@ 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); - } + if (tond.ni_cnd.cn_flags & HASBUF) + VOP_RELEASEND(tond.ni_dvp, &tond.ni_cnd); if (tond.ni_dvp) { if (tond.ni_dvp == tond.ni_vp) vrele(tond.ni_dvp); @@ -2327,11 +2302,8 @@ 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); - } + if (fromnd.ni_cnd.cn_flags & HASBUF) + VOP_RELEASEND(fromnd.ni_dvp, &fromnd.ni_cnd); if (fromnd.ni_dvp) vrele(fromnd.ni_dvp); if (fromnd.ni_vp) @@ -2418,14 +2390,10 @@ 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); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); nd.ni_cnd.cn_flags &= ~HASBUF; } /* fall through */ @@ -2444,14 +2412,8 @@ /* 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); */ - } + if (nd.ni_cnd.cn_flags & HASBUF) + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); if (dirp) vrele(dirp); if (vp) @@ -2552,9 +2514,10 @@ */ nqsrv_getl(nd.ni_dvp, ND_WRITE); error = VOP_SYMLINK(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap, pathcp); - if (error) + if (error) { + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); nd.ni_cnd.cn_flags &= ~HASBUF; - else { + } else { vput(nd.ni_vp); nd.ni_vp = NULL; } @@ -2624,15 +2587,8 @@ /* 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); - } + if (nd.ni_cnd.cn_flags & HASBUF) + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); if (nd.ni_dvp) { if (nd.ni_dvp == nd.ni_vp) vrele(nd.ni_dvp); @@ -2725,11 +2681,7 @@ 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); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); nd.ni_cnd.cn_flags &= ~HASBUF; error = EEXIST; goto out; @@ -2742,6 +2694,7 @@ */ nqsrv_getl(nd.ni_dvp, ND_WRITE); error = VOP_MKDIR(nd.ni_dvp, &nd.ni_vp, &nd.ni_cnd, vap); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); nd.ni_cnd.cn_flags &= ~HASBUF; vpexcl = 1; @@ -2777,12 +2730,8 @@ 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); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); if (nd.ni_dvp == nd.ni_vp && vpexcl) vrele(nd.ni_dvp); else @@ -2877,9 +2826,8 @@ 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); } + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); nd.ni_cnd.cn_flags &= ~HASBUF; if (dirp) @@ -2892,12 +2840,8 @@ /* 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); + VOP_RELEASEND(nd.ni_dvp, &nd.ni_cnd); if (dirp) vrele(dirp); if (nd.ni_dvp) { Index: nfs/nfs_syscalls.c =================================================================== RCS file: /home/ncvs/src/sys/nfs/nfs_syscalls.c,v retrieving revision 1.54 diff -u -r1.54 nfs_syscalls.c --- nfs_syscalls.c 1999/11/11 17:24:02 1.54 +++ nfs_syscalls.c 1999/11/22 05:23:55 @@ -55,6 +55,7 @@ #include #include #include +#include #include #include @@ -179,6 +180,7 @@ error = namei(&nd); if (error) return (error); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); if ((nd.ni_vp->v_flag & VROOT) == 0) error = EINVAL; nmp = VFSTONFS(nd.ni_vp->v_mount); Index: nfs/nfs_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/nfs/nfs_vnops.c,v retrieving revision 1.144 diff -u -r1.144 nfs_vnops.c --- nfs_vnops.c 1999/11/13 20:58:16 1.144 +++ nfs_vnops.c 1999/11/13 23:59:14 @@ -138,7 +138,6 @@ 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 @@ 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 @@ 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; @@ -1369,7 +1365,6 @@ 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) @@ -1436,8 +1431,6 @@ 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; @@ -1509,7 +1502,6 @@ 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); } @@ -1629,14 +1621,12 @@ } 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); /* @@ -1728,7 +1718,6 @@ int v3; if (vp->v_mount != tdvp->v_mount) { - VOP_ABORTOP(tdvp, cnp); return (EXDEV); } @@ -1752,7 +1741,6 @@ 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; @@ -1830,12 +1818,6 @@ */ if (error == EEXIST) error = 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); } @@ -1869,7 +1851,6 @@ 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; @@ -1920,8 +1901,6 @@ vrele(newvp); } else *ap->a_vpp = newvp; - if (error || (cnp->cn_flags & SAVESTART) == 0) - zfree(namei_zone, cnp->cn_pnbuf); return (error); } @@ -1958,7 +1937,6 @@ 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; Index: nfs/nfsnode.h =================================================================== RCS file: /home/ncvs/src/sys/nfs/nfsnode.h,v retrieving revision 1.29 diff -u -r1.29 nfsnode.h --- nfsnode.h 1999/08/28 00:50:03 1.29 +++ nfsnode.h 1999/11/13 23:57:55 @@ -168,7 +168,6 @@ 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 *)); Index: ntfs/ntfs_vfsops.c =================================================================== RCS file: /home/ncvs/src/sys/ntfs/ntfs_vfsops.c,v retrieving revision 1.16 diff -u -r1.16 ntfs_vfsops.c --- ntfs_vfsops.c 1999/11/09 14:15:32 1.16 +++ ntfs_vfsops.c 1999/11/22 05:23:46 @@ -46,6 +46,7 @@ #include #include #include +#include /*#define NTFS_DEBUG 1*/ #include @@ -292,7 +293,7 @@ /* can't get devvp!*/ goto error_1; } - + VOP_RELEASEND(ndp->ni_vp, &ndp->ni_cnd); devvp = ndp->ni_vp; if (!vn_isdisk(devvp)) { Index: nwfs/nwfs_io.c =================================================================== RCS file: /home/ncvs/src/sys/nwfs/nwfs_io.c,v retrieving revision 1.5 diff -u -r1.5 nwfs_io.c --- nwfs_io.c 1999/10/29 18:09:13 1.5 +++ nwfs_io.c 1999/11/22 05:13:16 @@ -81,6 +81,8 @@ struct nwnode *np = VTONW(vp); struct nw_entry_info fattr; struct vnode *newvp; + /* XXX This is only used to store vp/dvp, and should probably + NOT be nameidata */ struct nameidata nami, *ndp = &nami; struct componentname *cnp = &ndp->ni_cnd; ncpfid fid; Index: nwfs/nwfs_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/nwfs/nwfs_vnops.c,v retrieving revision 1.3 diff -u -r1.3 nwfs_vnops.c --- nwfs_vnops.c 1999/10/14 09:35:37 1.3 +++ nwfs_vnops.c 1999/11/14 00:03:57 @@ -77,7 +77,6 @@ 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 @@ 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 }, @@ -447,7 +445,6 @@ 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; @@ -470,7 +467,6 @@ if (cnp->cn_flags & MAKEENTRY) cache_enter(dvp, vp, cnp); } - zfree(namei_zone, cnp->cn_pnbuf); return (error); } @@ -504,7 +500,6 @@ 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); } @@ -598,9 +593,7 @@ /* * 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) @@ -610,8 +603,6 @@ struct componentname *a_cnp; } */ *ap; { -/* VOP_ABORTOP(ap->a_tdvp, ap->a_cnp);*/ - zfree(namei_zone, ap->a_cnp->cn_pnbuf); return EOPNOTSUPP; } @@ -629,8 +620,6 @@ char *a_target; } */ *ap; { - zfree(namei_zone, ap->a_cnp->cn_pnbuf); - /* VOP_ABORTOP(ap->a_dvp, ap->a_cnp); ??? */ return (EOPNOTSUPP); } @@ -666,11 +655,9 @@ 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, @@ -690,7 +677,6 @@ *ap->a_vpp = newvp; } } - zfree(namei_zone, cnp->cn_pnbuf); return (error); } @@ -718,7 +704,6 @@ 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); @@ -856,23 +841,6 @@ *ap->a_runp = 0; if (ap->a_runb != NULL) *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); } Index: svr4/svr4_misc.c =================================================================== RCS file: /home/ncvs/src/sys/svr4/svr4_misc.c,v retrieving revision 1.9 diff -u -r1.9 svr4_misc.c --- svr4_misc.c 1999/10/29 18:09:20 1.9 +++ svr4_misc.c 1999/11/14 20:15:44 @@ -1614,7 +1614,8 @@ *retval = strlen(nd.ni_cnd.cn_pnbuf) < SCARG(uap, bufsiz) ? strlen(nd.ni_cnd.cn_pnbuf) + 1 : SCARG(uap, bufsiz); bad: + /* XXX Not guaranteed to be the right VP - change above */ + VOP_RELEASEND(nd.ni_vp, nd.ni_cnd.cn_pnbuf); vput(nd.ni_vp); - zfree(namei_zone, nd.ni_cnd.cn_pnbuf); return error; } Index: svr4/svr4_sysvec.c =================================================================== RCS file: /home/ncvs/src/sys/svr4/svr4_sysvec.c,v retrieving revision 1.8 diff -u -r1.8 svr4_sysvec.c --- svr4_sysvec.c 1999/10/17 14:44:48 1.8 +++ svr4_sysvec.c 1999/11/22 05:16:58 @@ -296,6 +296,7 @@ free(buf, M_TEMP); return error; } + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); *cp = '/'; } @@ -306,6 +307,7 @@ free(buf, M_TEMP); return error; } + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); /* * We now compare the vnode of the svr4_root to the one @@ -324,6 +326,7 @@ vrele(nd.ni_vp); return error; } + VOP_RELEASEND(ndroot.ni_vp, &ndroot.ni_cnd); if ((error = VOP_GETATTR(nd.ni_vp, &vat, p->p_ucred, p)) != 0) { goto done; Index: ufs/ffs/ffs_vfsops.c =================================================================== RCS file: /home/ncvs/src/sys/ufs/ffs/ffs_vfsops.c,v retrieving revision 1.111 diff -u -r1.111 ffs_vfsops.c --- ffs_vfsops.c 1999/11/09 14:15:33 1.111 +++ ffs_vfsops.c 1999/11/22 05:24:41 @@ -59,6 +59,7 @@ #include #include +#include static MALLOC_DEFINE(M_FFSNODE, "FFS node", "FFS vnode private part"); @@ -272,6 +273,7 @@ goto error_1; } + VOP_RELEASEND(ndp->ni_vp, &ndp->ni_cnd); devvp = ndp->ni_vp; if (!vn_isdisk(devvp)) { Index: ufs/ufs/ufs_vnops.c =================================================================== RCS file: /home/ncvs/src/sys/ufs/ufs/ufs_vnops.c,v retrieving revision 1.127 diff -u -r1.127 ufs_vnops.c --- ufs_vnops.c 1999/11/13 20:58:17 1.127 +++ ufs_vnops.c 1999/11/14 20:16:37 @@ -71,7 +71,6 @@ #include #include -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 @@ 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 @@ 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 @@ 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 @@ (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 @@ } /* Release destination completely. */ - VOP_ABORTOP(tdvp, tcnp); vput(tdvp); vput(tvp); @@ -1349,7 +1336,6 @@ #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 @@ #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 @@ vput(tvp); } out: - zfree(namei_zone, cnp->cn_pnbuf); return (error); } @@ -1733,23 +1717,6 @@ } /* - * 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 @@ 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 @@ #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 @@ #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 @@ 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 @@ * 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 @@ { &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 }, Index: vm/vm_swap.c =================================================================== RCS file: /home/ncvs/src/sys/vm/vm_swap.c,v retrieving revision 1.89 diff -u -r1.89 vm_swap.c --- vm_swap.c 1999/10/08 19:10:18 1.89 +++ vm_swap.c 1999/11/22 05:24:53 @@ -53,6 +53,7 @@ #include #include #include +#include /* * "sw" is a fake device implemented @@ -239,6 +240,7 @@ if (error) return (error); + VOP_RELEASEND(nd.ni_vp, &nd.ni_cnd); vp = nd.ni_vp; switch (vp->v_type) {