Changeset View
Changeset View
Standalone View
Standalone View
sys/fs/unionfs/union_vfsops.c
Show First 20 Lines • Show All 365 Lines • ▼ Show 20 Lines | if (flags & LK_TYPE_MASK) | ||||
vn_lock(vp, flags); | vn_lock(vp, flags); | ||||
*vpp = vp; | *vpp = vp; | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
unionfs_quotactl(struct mount *mp, int cmd, uid_t uid, void *arg) | unionfs_quotactl(struct mount *mp, int cmd, uid_t uid, void *arg, | ||||
bool *mp_busy) | |||||
{ | { | ||||
struct mount *uppermp; | |||||
struct unionfs_mount *ump; | struct unionfs_mount *ump; | ||||
int error; | |||||
bool unbusy; | |||||
ump = MOUNTTOUNIONFSMOUNT(mp); | ump = MOUNTTOUNIONFSMOUNT(mp); | ||||
uppermp = atomic_load_ptr(&ump->um_uppervp->v_mount); | |||||
KASSERT(*mp_busy == true, ("upper mount not busy")); | |||||
/* | /* | ||||
* See comment in sys_quotactl() for an explanation of why the | |||||
* lower mount needs to be busied by the caller of VFS_QUOTACTL() | |||||
* but may be unbusied by the implementation. We must unbusy | |||||
* the upper mount for the same reason; otherwise a namei lookup | |||||
* issued by the VFS_QUOTACTL() implementation could traverse the | |||||
* upper mount and deadlock. | |||||
*/ | |||||
vfs_unbusy(mp); | |||||
*mp_busy = false; | |||||
unbusy = true; | |||||
error = vfs_busy(uppermp, 0); | |||||
/* | |||||
* Writing is always performed to upper vnode. | * Writing is always performed to upper vnode. | ||||
*/ | */ | ||||
return (VFS_QUOTACTL(ump->um_uppervp->v_mount, cmd, uid, arg)); | if (error == 0) | ||||
error = VFS_QUOTACTL(uppermp, cmd, uid, arg, &unbusy); | |||||
if (unbusy) | |||||
vfs_unbusy(uppermp); | |||||
return (error); | |||||
} | } | ||||
static int | static int | ||||
unionfs_statfs(struct mount *mp, struct statfs *sbp) | unionfs_statfs(struct mount *mp, struct statfs *sbp) | ||||
{ | { | ||||
struct unionfs_mount *ump; | struct unionfs_mount *ump; | ||||
int error; | int error; | ||||
struct statfs *mstat; | struct statfs *mstat; | ||||
▲ Show 20 Lines • Show All 112 Lines • Show Last 20 Lines |