diff options
Diffstat (limited to 'sys/fs/unionfs')
-rw-r--r-- | sys/fs/unionfs/union_subr.c | 30 | ||||
-rw-r--r-- | sys/fs/unionfs/union_vnops.c | 16 |
2 files changed, 40 insertions, 6 deletions
diff --git a/sys/fs/unionfs/union_subr.c b/sys/fs/unionfs/union_subr.c index 6b88bef..d1d6e31 100644 --- a/sys/fs/unionfs/union_subr.c +++ b/sys/fs/unionfs/union_subr.c @@ -747,6 +747,7 @@ union_copyup(un, docopy, cred, p) struct proc *p; { int error; + struct mount *mp; struct vnode *lvp, *uvp; /* @@ -759,9 +760,12 @@ union_copyup(un, docopy, cred, p) if (error) return (error); - error = union_vn_create(&uvp, un, p); - if (error) + if ((error = vn_start_write(un->un_dirvp, &mp, V_WAIT | PCATCH)) != 0) return (error); + if ((error = union_vn_create(&uvp, un, p)) != 0) { + vn_finished_write(mp); + return (error); + } lvp = un->un_lowervp; @@ -785,6 +789,7 @@ union_copyup(un, docopy, cred, p) } VOP_UNLOCK(uvp, 0, p); + vn_finished_write(mp); union_newupper(un, uvp); KASSERT(uvp->v_usecount > 0, ("copy: uvp refcount 0: %d", uvp->v_usecount)); union_vn_close(uvp, FWRITE, cred, p); @@ -910,11 +915,15 @@ union_mkshadow(um, dvp, cnp, vpp) struct vattr va; struct proc *p = cnp->cn_proc; struct componentname cn; + struct mount *mp; - error = union_relookup(um, dvp, vpp, cnp, &cn, - cnp->cn_nameptr, cnp->cn_namelen); - if (error) + if ((error = vn_start_write(dvp, &mp, V_WAIT | PCATCH)) != 0) + return (error); + if ((error = union_relookup(um, dvp, vpp, cnp, &cn, + cnp->cn_nameptr, cnp->cn_namelen)) != 0) { + vn_finished_write(mp); return (error); + } if (*vpp) { if (cn.cn_flags & HASBUF) { @@ -925,6 +934,7 @@ union_mkshadow(um, dvp, cnp, vpp) vrele(*vpp); else vput(*vpp); + vn_finished_write(mp); *vpp = NULLVP; return (EEXIST); } @@ -950,6 +960,7 @@ union_mkshadow(um, dvp, cnp, vpp) cn.cn_flags &= ~HASBUF; } /*vput(dvp);*/ + vn_finished_write(mp); return (error); } @@ -973,10 +984,15 @@ union_mkwhiteout(um, dvp, cnp, path) struct proc *p = cnp->cn_proc; struct vnode *wvp; struct componentname cn; + struct mount *mp; + if ((error = vn_start_write(dvp, &mp, V_WAIT | PCATCH)) != 0) + return (error); error = union_relookup(um, dvp, &wvp, cnp, &cn, path, strlen(path)); - if (error) + if (error) { + vn_finished_write(mp); return (error); + } if (wvp) { if (cn.cn_flags & HASBUF) { @@ -987,6 +1003,7 @@ union_mkwhiteout(um, dvp, cnp, path) vrele(wvp); else vput(wvp); + vn_finished_write(mp); return (EEXIST); } @@ -998,6 +1015,7 @@ union_mkwhiteout(um, dvp, cnp, path) zfree(namei_zone, cn.cn_pnbuf); cn.cn_flags &= ~HASBUF; } + vn_finished_write(mp); return (error); } diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index 1c5ed5d..d7b95f3 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -93,6 +93,7 @@ static int union_print __P((struct vop_print_args *ap)); static int union_read __P((struct vop_read_args *ap)); static int union_readdir __P((struct vop_readdir_args *ap)); static int union_readlink __P((struct vop_readlink_args *ap)); +static int union_getwritemount __P((struct vop_getwritemount_args *ap)); static int union_reclaim __P((struct vop_reclaim_args *ap)); static int union_remove __P((struct vop_remove_args *ap)); static int union_rename __P((struct vop_rename_args *ap)); @@ -1681,6 +1682,20 @@ union_readlink(ap) return (error); } +static int +union_getwritemount(ap) + struct vop_getwritemount_args /* { + struct vnode *a_vp; + struct mount **a_mpp; + } */ *ap; +{ + struct vnode *vp = UPPERVP(ap->a_vp); + + if (vp == NULL) + panic("union: missing upper layer in getwritemount"); + return(VOP_GETWRITEMOUNT(vp, ap->a_mpp)); +} + /* * union_inactive: * @@ -1963,6 +1978,7 @@ static struct vnodeopv_entry_desc union_vnodeop_entries[] = { { &vop_read_desc, (vop_t *) union_read }, { &vop_readdir_desc, (vop_t *) union_readdir }, { &vop_readlink_desc, (vop_t *) union_readlink }, + { &vop_getwritemount_desc, (vop_t *) union_getwritemount }, { &vop_reclaim_desc, (vop_t *) union_reclaim }, { &vop_remove_desc, (vop_t *) union_remove }, { &vop_rename_desc, (vop_t *) union_rename }, |