summaryrefslogtreecommitdiffstats
path: root/sys/miscfs/union
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/union
parent529bc073c0dba1aaccc98818ee299b79a111afab (diff)
downloadFreeBSD-src-87724eb67358c0993676ad3dfe9091e192a653f4.zip
FreeBSD-src-87724eb67358c0993676ad3dfe9091e192a653f4.tar.gz
Introduce NDFREE (and remove VOP_ABORTOP)
Diffstat (limited to 'sys/miscfs/union')
-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
3 files changed, 26 insertions, 48 deletions
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