Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 21 Feb 2023 22:43:36 GMT
From:      Allan Jude <allanjude@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org
Subject:   git: 8b04c1cbfc1c - main - Fix per-jail zfs.mount_snapshot setting
Message-ID:  <202302212243.31LMhavc067214@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch main has been updated by allanjude:

URL: https://cgit.FreeBSD.org/src/commit/?id=8b04c1cbfc1cb71a1ce53b3a7855f1d45866fcfb

commit 8b04c1cbfc1cb71a1ce53b3a7855f1d45866fcfb
Author:     Allan Jude <allanjude@FreeBSD.org>
AuthorDate: 2023-02-18 01:44:34 +0000
Commit:     Allan Jude <allanjude@FreeBSD.org>
CommitDate: 2023-02-21 22:42:28 +0000

    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
    Reported by:    imp (previous version), mm (upstream), freqlabs (upstream)
    MFC after:      immediately
    Sponsored by:   Modirum MDPay
    Sponsored by:   Klara, Inc.
    Differential Revision:  https://reviews.freebsd.org/D38662
---
 sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c | 16 ++++++++++++++--
 1 file 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 a1e0595bda34..9fb2873132bf 100644
--- a/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c
+++ b/sys/contrib/openzfs/module/os/freebsd/zfs/zfs_vfsops.c
@@ -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;
 
@@ -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);
 }
 



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302212243.31LMhavc067214>