Changeset View
Changeset View
Standalone View
Standalone View
sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c
Show First 20 Lines • Show All 2,489 Lines • ▼ Show 20 Lines | zfs_jailparam_set(void *obj, void *data) | ||||
if (error == ENOENT) | if (error == ENOENT) | ||||
jsys = -1; | jsys = -1; | ||||
error = vfs_copyopt(opts, "zfs.mount_snapshot", &mount_snapshot, | error = vfs_copyopt(opts, "zfs.mount_snapshot", &mount_snapshot, | ||||
sizeof (mount_snapshot)); | sizeof (mount_snapshot)); | ||||
if (error == ENOENT) | if (error == ENOENT) | ||||
mount_snapshot = -1; | mount_snapshot = -1; | ||||
else | else | ||||
jsys = JAIL_SYS_NEW; | jsys = JAIL_SYS_NEW; | ||||
if (jsys == JAIL_SYS_NEW) { | switch (jsys) { | ||||
case JAIL_SYS_NEW: | |||||
{ | |||||
imp: { is tabbed in one too far. Other instances in the tree use one fewer tabs from a (brief)… | |||||
/* "zfs=new" or "zfs.*": the prison gets its own ZFS info. */ | /* "zfs=new" or "zfs.*": the prison gets its own ZFS info. */ | ||||
struct zfs_jailparam *zjp; | struct zfs_jailparam *zjp; | ||||
/* | /* | ||||
* A child jail cannot have more permissions than its parent | * A child jail cannot have more permissions than its parent | ||||
*/ | */ | ||||
if (pr->pr_parent != &prison0) { | if (pr->pr_parent != &prison0) { | ||||
zjp = zfs_jailparam_find(pr->pr_parent, &ppr); | zjp = zfs_jailparam_find(pr->pr_parent, &ppr); | ||||
mtx_unlock(&ppr->pr_mtx); | mtx_unlock(&ppr->pr_mtx); | ||||
if (zjp->mount_snapshot < mount_snapshot) { | if (zjp->mount_snapshot < mount_snapshot) { | ||||
return (EPERM); | return (EPERM); | ||||
} | } | ||||
} | } | ||||
zfs_jailparam_alloc(pr, &zjp); | zfs_jailparam_alloc(pr, &zjp); | ||||
if (mount_snapshot != -1) | if (mount_snapshot != -1) | ||||
zjp->mount_snapshot = mount_snapshot; | zjp->mount_snapshot = mount_snapshot; | ||||
mtx_unlock(&pr->pr_mtx); | mtx_unlock(&pr->pr_mtx); | ||||
} else { | break; | ||||
} | |||||
case JAIL_SYS_INHERIT: | |||||
/* "zfs=inherit": inherit the parent's ZFS info. */ | /* "zfs=inherit": inherit the parent's ZFS info. */ | ||||
mtx_lock(&pr->pr_mtx); | mtx_lock(&pr->pr_mtx); | ||||
osd_jail_del(pr, zfs_jailparam_slot); | osd_jail_del(pr, zfs_jailparam_slot); | ||||
mtx_unlock(&pr->pr_mtx); | mtx_unlock(&pr->pr_mtx); | ||||
break; | |||||
case -1: | |||||
/* | |||||
* If the setting being changed is not ZFS related | |||||
* then do nothing. | |||||
*/ | |||||
break; | |||||
Not Done Inline Actionsdefault: ? What else is expected? imp: default: ? What else is expected? | |||||
} | } | ||||
return (0); | return (0); | ||||
} | } | ||||
static int | static int | ||||
zfs_jailparam_check(void *obj __unused, void *data) | zfs_jailparam_check(void *obj __unused, void *data) | ||||
{ | { | ||||
struct vfsoptlist *opts = data; | struct vfsoptlist *opts = data; | ||||
int error, jsys, mount_snapshot; | int error, jsys, mount_snapshot; | ||||
▲ Show 20 Lines • Show All 57 Lines • Show Last 20 Lines |
{ is tabbed in one too far. Other instances in the tree use one fewer tabs from a (brief) survey I just did.