aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorrmacklem <64620010+rmacklem@users.noreply.github.com>2023-11-28 00:31:03 +0000
committerGitHub <noreply@github.com>2023-11-28 00:31:03 +0000
commitacb33ee1c169bf1c1f687db18fa1815ffa68f246 (patch)
tree80fc0d55d6f058e84b7bc5830ca06770cbea30e4
parentc1a47de86fd5edde091e68e8e91840d3cb9c55b0 (diff)
downloadsrc-acb33ee1c169bf1c1f687db18fa1815ffa68f246.tar.gz
src-acb33ee1c169bf1c1f687db18fa1815ffa68f246.zip
-rw-r--r--include/os/freebsd/spl/sys/vfs.h2
-rw-r--r--module/os/freebsd/spl/spl_vfs.c9
-rw-r--r--module/os/freebsd/zfs/zfs_ctldir.c3
3 files changed, 11 insertions, 3 deletions
diff --git a/include/os/freebsd/spl/sys/vfs.h b/include/os/freebsd/spl/sys/vfs.h
index 7f163fcfdb1e..f2196da56bc8 100644
--- a/include/os/freebsd/spl/sys/vfs.h
+++ b/include/os/freebsd/spl/sys/vfs.h
@@ -101,7 +101,7 @@ void vfs_setmntopt(vfs_t *vfsp, const char *name, const char *arg,
void vfs_clearmntopt(vfs_t *vfsp, const char *name);
int vfs_optionisset(const vfs_t *vfsp, const char *opt, char **argp);
int mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype,
- char *fspath, char *fspec, int fsflags);
+ char *fspath, char *fspec, int fsflags, vfs_t *parent_vfsp);
typedef uint64_t vfs_feature_t;
diff --git a/module/os/freebsd/spl/spl_vfs.c b/module/os/freebsd/spl/spl_vfs.c
index d67bd7178735..724709ddee9d 100644
--- a/module/os/freebsd/spl/spl_vfs.c
+++ b/module/os/freebsd/spl/spl_vfs.c
@@ -117,7 +117,7 @@ vfs_optionisset(const vfs_t *vfsp, const char *opt, char **argp)
int
mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype, char *fspath,
- char *fspec, int fsflags)
+ char *fspec, int fsflags, vfs_t *parent_vfsp)
{
struct vfsconf *vfsp;
struct mount *mp;
@@ -217,6 +217,13 @@ mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype, char *fspath,
mp->mnt_opt = mp->mnt_optnew;
(void) VFS_STATFS(mp, &mp->mnt_stat);
+#ifdef VFS_SUPPORTS_EXJAIL_CLONE
+ /*
+ * Clone the mnt_exjail credentials of the parent, as required.
+ */
+ vfs_exjail_clone(parent_vfsp, mp);
+#endif
+
/*
* Prevent external consumers of mount options from reading
* mnt_optnew.
diff --git a/module/os/freebsd/zfs/zfs_ctldir.c b/module/os/freebsd/zfs/zfs_ctldir.c
index 28445a18b809..a753e91da4fe 100644
--- a/module/os/freebsd/zfs/zfs_ctldir.c
+++ b/module/os/freebsd/zfs/zfs_ctldir.c
@@ -1026,7 +1026,8 @@ zfsctl_snapdir_lookup(struct vop_lookup_args *ap)
"%s/" ZFS_CTLDIR_NAME "/snapshot/%s",
dvp->v_vfsp->mnt_stat.f_mntonname, name);
- err = mount_snapshot(curthread, vpp, "zfs", mountpoint, fullname, 0);
+ err = mount_snapshot(curthread, vpp, "zfs", mountpoint, fullname, 0,
+ dvp->v_vfsp);
kmem_free(mountpoint, mountpoint_len);
if (err == 0) {
/*