diff options
author | Allan Jude <allanjude@FreeBSD.org> | 2023-02-18 01:44:34 +0000 |
---|---|---|
committer | Allan Jude <allanjude@FreeBSD.org> | 2023-02-22 13:48:20 +0000 |
commit | b772fe0d662650d8a517bc07f3c433486c24b347 (patch) | |
tree | 051dff982d25fbadfe496af715ed46a966517906 | |
parent | 0f59de6879b8590177c050a1dd02a5383271f33b (diff) | |
download | src-b772fe0d662650d8a517bc07f3c433486c24b347.tar.gz src-b772fe0d662650d8a517bc07f3c433486c24b347.zip |
Fix per-jail zfs.mount_snapshot setting
When jail.conf set the nopersist flag during startup, it was
incorrectly destroying the per-jail ZFS settings.
PR: 260160
Reviewed by: imp (previous version), mm (upstream), freqlabs (upstream)
Approved by: re (cperciva)
Sponsored by: Modirum MDPay
Sponsored by: Klara, Inc.
Differential Revision: https://reviews.freebsd.org/D38662
(cherry picked from commit 8b04c1cbfc1cb71a1ce53b3a7855f1d45866fcfb)
(cherry picked from commit 426ed00525409d084e97dc44397722aff2cc0bb3)
-rw-r--r-- | sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c index 85449ebb9d97..6ffd36885655 100644 --- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c +++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c @@ -2525,7 +2525,9 @@ zfs_jailparam_set(void *obj, void *data) mount_snapshot = -1; else jsys = JAIL_SYS_NEW; - if (jsys == JAIL_SYS_NEW) { + switch (jsys) { + case JAIL_SYS_NEW: + { /* "zfs=new" or "zfs.*": the prison gets its own ZFS info. */ struct zfs_jailparam *zjp; @@ -2543,12 +2545,22 @@ zfs_jailparam_set(void *obj, void *data) if (mount_snapshot != -1) zjp->mount_snapshot = mount_snapshot; mtx_unlock(&pr->pr_mtx); - } else { + break; + } + case JAIL_SYS_INHERIT: /* "zfs=inherit": inherit the parent's ZFS info. */ mtx_lock(&pr->pr_mtx); osd_jail_del(pr, zfs_jailparam_slot); mtx_unlock(&pr->pr_mtx); + break; + case -1: + /* + * If the setting being changed is not ZFS related + * then do nothing. + */ + break; } + return (0); } |