Skip to content

Commit

Permalink
Fix per-jail zfs.mount_snapshot setting
Browse files Browse the repository at this point in the history
When jail.conf set the nopersist flag during startup, it was
incorrectly destroying the per-jail ZFS settings.

Reported-by: Martin Matuska <[email protected]>
Reviewed-by: Ryan Moeller <[email protected]>
Signed-off-by: Allan Jude <[email protected]>
Sponsored-by: Modirum MDPay
Sponsored-by: Klara, Inc.
Closes #14509
  • Loading branch information
allanjude authored Feb 22, 2023
1 parent 0f32b1f commit 1d56c6d
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions module/os/freebsd/zfs/zfs_vfsops.c
Original file line number Diff line number Diff line change
Expand Up @@ -2495,7 +2495,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;

Expand All @@ -2513,12 +2515,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);
}

Expand Down

0 comments on commit 1d56c6d

Please sign in to comment.