Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/unionfs/union_vnops.c
Show First 20 Lines • Show All 277 Lines • ▼ Show 20 Lines | if (uerror == 0) { | ||||
} else if (uvp != NULLVP) | } else if (uvp != NULLVP) | ||||
VOP_UNLOCK(uvp); | VOP_UNLOCK(uvp); | ||||
} | } | ||||
/* check whiteout */ | /* check whiteout */ | ||||
if ((uerror == ENOENT || uerror == EJUSTRETURN) && | if ((uerror == ENOENT || uerror == EJUSTRETURN) && | ||||
(cnp->cn_flags & ISWHITEOUT)) | (cnp->cn_flags & ISWHITEOUT)) | ||||
iswhiteout = true; | iswhiteout = true; | ||||
else if (VOP_GETATTR(udvp, &va, cnp->cn_cred) == 0 && | else if (VOP_GETATTR(udvp, 0, &va, cnp->cn_cred) == 0 && | ||||
(va.va_flags & OPAQUE)) | (va.va_flags & OPAQUE)) | ||||
iswhiteout = true; | iswhiteout = true; | ||||
if (iswhiteout && lvp != NULLVP) { | if (iswhiteout && lvp != NULLVP) { | ||||
vrele(lvp); | vrele(lvp); | ||||
lvp = NULLVP; | lvp = NULLVP; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 724 Lines • ▼ Show 20 Lines | unionfs_getattr(struct vop_getattr_args *ap) | ||||
unp = VTOUNIONFS(ap->a_vp); | unp = VTOUNIONFS(ap->a_vp); | ||||
ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount); | ump = MOUNTTOUNIONFSMOUNT(ap->a_vp->v_mount); | ||||
uvp = unp->un_uppervp; | uvp = unp->un_uppervp; | ||||
lvp = unp->un_lowervp; | lvp = unp->un_lowervp; | ||||
td = curthread; | td = curthread; | ||||
if (uvp != NULLVP) { | if (uvp != NULLVP) { | ||||
if ((error = VOP_GETATTR(uvp, ap->a_vap, ap->a_cred)) == 0) | if ((error = VOP_GETATTR(uvp, 0, ap->a_vap, ap->a_cred)) == 0) | ||||
ap->a_vap->va_fsid = | ap->a_vap->va_fsid = | ||||
ap->a_vp->v_mount->mnt_stat.f_fsid.val[0]; | ap->a_vp->v_mount->mnt_stat.f_fsid.val[0]; | ||||
UNIONFS_INTERNAL_DEBUG( | UNIONFS_INTERNAL_DEBUG( | ||||
"unionfs_getattr: leave mode=%o, uid=%d, gid=%d (%d)\n", | "unionfs_getattr: leave mode=%o, uid=%d, gid=%d (%d)\n", | ||||
ap->a_vap->va_mode, ap->a_vap->va_uid, | ap->a_vap->va_mode, ap->a_vap->va_uid, | ||||
ap->a_vap->va_gid, error); | ap->a_vap->va_gid, error); | ||||
return (error); | return (error); | ||||
} | } | ||||
error = VOP_GETATTR(lvp, ap->a_vap, ap->a_cred); | error = VOP_GETATTR(lvp, 0, ap->a_vap, ap->a_cred); | ||||
if (error == 0 && (ump->um_uppermp->mnt_flag & MNT_RDONLY) == 0) { | if (error == 0 && (ump->um_uppermp->mnt_flag & MNT_RDONLY) == 0) { | ||||
/* correct the attr toward shadow file/dir. */ | /* correct the attr toward shadow file/dir. */ | ||||
if (ap->a_vp->v_type == VREG || ap->a_vp->v_type == VDIR) { | if (ap->a_vp->v_type == VREG || ap->a_vp->v_type == VDIR) { | ||||
unionfs_create_uppervattr_core(ump, ap->a_vap, &va, td); | unionfs_create_uppervattr_core(ump, ap->a_vap, &va, td); | ||||
ap->a_vap->va_mode = va.va_mode; | ap->a_vap->va_mode = va.va_mode; | ||||
ap->a_vap->va_uid = va.va_uid; | ap->a_vap->va_uid = va.va_uid; | ||||
ap->a_vap->va_gid = va.va_gid; | ap->a_vap->va_gid = va.va_gid; | ||||
▲ Show 20 Lines • Show All 573 Lines • ▼ Show 20 Lines | unionfs_mkdir(struct vop_mkdir_args *ap) | ||||
dunp = VTOUNIONFS(dvp); | dunp = VTOUNIONFS(dvp); | ||||
cnp = ap->a_cnp; | cnp = ap->a_cnp; | ||||
lkflags = cnp->cn_lkflags; | lkflags = cnp->cn_lkflags; | ||||
udvp = dunp->un_uppervp; | udvp = dunp->un_uppervp; | ||||
if (udvp != NULLVP) { | if (udvp != NULLVP) { | ||||
/* check opaque */ | /* check opaque */ | ||||
if (!(cnp->cn_flags & ISWHITEOUT)) { | if (!(cnp->cn_flags & ISWHITEOUT)) { | ||||
error = VOP_GETATTR(udvp, &va, cnp->cn_cred); | error = VOP_GETATTR(udvp, 0, &va, cnp->cn_cred); | ||||
if (error != 0) | if (error != 0) | ||||
goto unionfs_mkdir_cleanup; | goto unionfs_mkdir_cleanup; | ||||
if ((va.va_flags & OPAQUE) != 0) | if ((va.va_flags & OPAQUE) != 0) | ||||
cnp->cn_flags |= ISWHITEOUT; | cnp->cn_flags |= ISWHITEOUT; | ||||
} | } | ||||
int udvp_lkflags; | int udvp_lkflags; | ||||
bool uvp_created = false; | bool uvp_created = false; | ||||
▲ Show 20 Lines • Show All 220 Lines • ▼ Show 20 Lines | if (error == 0) { | ||||
} | } | ||||
} | } | ||||
unionfs_downgrade_lock(vp, lkstatus); | unionfs_downgrade_lock(vp, lkstatus); | ||||
if (error != 0) | if (error != 0) | ||||
goto unionfs_readdir_exit; | goto unionfs_readdir_exit; | ||||
/* check opaque */ | /* check opaque */ | ||||
if (uvp != NULLVP && lvp != NULLVP) { | if (uvp != NULLVP && lvp != NULLVP) { | ||||
if ((error = VOP_GETATTR(uvp, &va, ap->a_cred)) != 0) | if ((error = VOP_GETATTR(uvp, 0, &va, ap->a_cred)) != 0) | ||||
goto unionfs_readdir_exit; | goto unionfs_readdir_exit; | ||||
if (va.va_flags & OPAQUE) | if (va.va_flags & OPAQUE) | ||||
lvp = NULLVP; | lvp = NULLVP; | ||||
} | } | ||||
/* upper only */ | /* upper only */ | ||||
if (uvp != NULLVP && lvp == NULLVP) { | if (uvp != NULLVP && lvp == NULLVP) { | ||||
unionfs_forward_vop_start(uvp, &lkflags); | unionfs_forward_vop_start(uvp, &lkflags); | ||||
▲ Show 20 Lines • Show All 1,152 Lines • Show Last 20 Lines |