summaryrefslogtreecommitdiffstats
path: root/sys/miscfs
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 /sys/miscfs
parent529bc073c0dba1aaccc98818ee299b79a111afab (diff)
downloadFreeBSD-src-87724eb67358c0993676ad3dfe9091e192a653f4.zip
FreeBSD-src-87724eb67358c0993676ad3dfe9091e192a653f4.tar.gz
Introduce NDFREE (and remove VOP_ABORTOP)
Diffstat (limited to 'sys/miscfs')
-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
8 files changed, 30 insertions, 92 deletions
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 },
OpenPOWER on IntegriCloud