Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/unionfs/union_subr.c
Show First 20 Lines • Show All 935 Lines • ▼ Show 20 Lines | unionfs_vn_create_on_upper(struct vnode **vpp, struct vnode *udvp, | ||||
if ((error = VOP_CREATE(udvp, &vp, &cn, uvap)) != 0) | if ((error = VOP_CREATE(udvp, &vp, &cn, uvap)) != 0) | ||||
goto unionfs_vn_create_on_upper_free_out1; | goto unionfs_vn_create_on_upper_free_out1; | ||||
if ((error = VOP_OPEN(vp, fmode, cred, td, NULL)) != 0) { | if ((error = VOP_OPEN(vp, fmode, cred, td, NULL)) != 0) { | ||||
vput(vp); | vput(vp); | ||||
goto unionfs_vn_create_on_upper_free_out1; | goto unionfs_vn_create_on_upper_free_out1; | ||||
} | } | ||||
VOP_ADD_WRITECOUNT(vp, 1); | error = VOP_ADD_WRITECOUNT(vp, 1); | ||||
CTR3(KTR_VFS, "%s: vp %p v_writecount increased to %d", __func__, vp, | CTR3(KTR_VFS, "%s: vp %p v_writecount increased to %d", __func__, vp, | ||||
vp->v_writecount); | vp->v_writecount); | ||||
if (error == 0) { | |||||
*vpp = vp; | *vpp = vp; | ||||
} else { | |||||
VOP_CLOSE(vp, fmode, cred, td); | |||||
} | |||||
unionfs_vn_create_on_upper_free_out1: | unionfs_vn_create_on_upper_free_out1: | ||||
VOP_UNLOCK(udvp, LK_RELEASE); | VOP_UNLOCK(udvp, LK_RELEASE); | ||||
unionfs_vn_create_on_upper_free_out2: | unionfs_vn_create_on_upper_free_out2: | ||||
if (cn.cn_flags & HASBUF) { | if (cn.cn_flags & HASBUF) { | ||||
uma_zfree(namei_zone, cn.cn_pnbuf); | uma_zfree(namei_zone, cn.cn_pnbuf); | ||||
cn.cn_flags &= ~HASBUF; | cn.cn_flags &= ~HASBUF; | ||||
▲ Show 20 Lines • Show All 117 Lines • ▼ Show 20 Lines | unionfs_copyfile(struct unionfs_node *unp, int docopy, struct ucred *cred, | ||||
if (docopy != 0) { | if (docopy != 0) { | ||||
error = VOP_OPEN(lvp, FREAD, cred, td, NULL); | error = VOP_OPEN(lvp, FREAD, cred, td, NULL); | ||||
if (error == 0) { | if (error == 0) { | ||||
error = unionfs_copyfile_core(lvp, uvp, cred, td); | error = unionfs_copyfile_core(lvp, uvp, cred, td); | ||||
VOP_CLOSE(lvp, FREAD, cred, td); | VOP_CLOSE(lvp, FREAD, cred, td); | ||||
} | } | ||||
} | } | ||||
VOP_CLOSE(uvp, FWRITE, cred, td); | VOP_CLOSE(uvp, FWRITE, cred, td); | ||||
VOP_ADD_WRITECOUNT(uvp, -1); | VOP_ADD_WRITECOUNT_SUCCEED(uvp, -1); | ||||
CTR3(KTR_VFS, "%s: vp %p v_writecount decreased to %d", __func__, uvp, | CTR3(KTR_VFS, "%s: vp %p v_writecount decreased to %d", __func__, uvp, | ||||
uvp->v_writecount); | uvp->v_writecount); | ||||
vn_finished_write(mp); | vn_finished_write(mp); | ||||
if (error == 0) { | if (error == 0) { | ||||
/* Reset the attributes. Ignore errors. */ | /* Reset the attributes. Ignore errors. */ | ||||
uva.va_type = VNON; | uva.va_type = VNON; | ||||
▲ Show 20 Lines • Show All 178 Lines • Show Last 20 Lines |