View | Details | Raw Unified | Return to bug 275200 | Differences between
and this patch

Collapse All | Expand All

(-)sys/contrib/openzfs/include/os/freebsd/spl/sys/vfs.h (-1 / +1 lines)
Lines 101-107 void vfs_setmntopt(vfs_t *vfsp, const char *name, cons Link Here
101
void vfs_clearmntopt(vfs_t *vfsp, const char *name);
101
void vfs_clearmntopt(vfs_t *vfsp, const char *name);
102
int vfs_optionisset(const vfs_t *vfsp, const char *opt, char **argp);
102
int vfs_optionisset(const vfs_t *vfsp, const char *opt, char **argp);
103
int mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype,
103
int mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype,
104
    char *fspath, char *fspec, int fsflags);
104
    char *fspath, char *fspec, int fsflags, vfs_t *vfsp);
105
105
106
typedef	uint64_t	vfs_feature_t;
106
typedef	uint64_t	vfs_feature_t;
107
107
(-)sys/contrib/openzfs/module/os/freebsd/spl/spl_vfs.c (-1 / +7 lines)
Lines 120-126 vfs_optionisset(const vfs_t *vfsp, const char *opt, ch Link Here
120
120
121
int
121
int
122
mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype, char *fspath,
122
mount_snapshot(kthread_t *td, vnode_t **vpp, const char *fstype, char *fspath,
123
    char *fspec, int fsflags)
123
    char *fspec, int fsflags, vfs_t *parent_vfsp)
124
{
124
{
125
	struct vfsconf *vfsp;
125
	struct vfsconf *vfsp;
126
	struct mount *mp;
126
	struct mount *mp;
Lines 219-224 mount_snapshot(kthread_t *td, vnode_t **vpp, const cha Link Here
219
		vfs_freeopts(mp->mnt_opt);
219
		vfs_freeopts(mp->mnt_opt);
220
	mp->mnt_opt = mp->mnt_optnew;
220
	mp->mnt_opt = mp->mnt_optnew;
221
	(void) VFS_STATFS(mp, &mp->mnt_stat);
221
	(void) VFS_STATFS(mp, &mp->mnt_stat);
222
223
	/*
224
	 * If the parent mount has mnt_exjail set, set mnt_exjail to the
225
	 * same credentials.
226
	 */
227
	vfs_exjail_clone(parent_vfsp, mp);
222
228
223
	/*
229
	/*
224
	 * Prevent external consumers of mount options from reading
230
	 * Prevent external consumers of mount options from reading
(-)sys/contrib/openzfs/module/os/freebsd/zfs/zfs_ctldir.c (-1 / +2 lines)
Lines 1026-1032 zfsctl_snapdir_lookup(struct vop_lookup_args *ap) Link Here
1026
	    "%s/" ZFS_CTLDIR_NAME "/snapshot/%s",
1026
	    "%s/" ZFS_CTLDIR_NAME "/snapshot/%s",
1027
	    dvp->v_vfsp->mnt_stat.f_mntonname, name);
1027
	    dvp->v_vfsp->mnt_stat.f_mntonname, name);
1028
1028
1029
	err = mount_snapshot(curthread, vpp, "zfs", mountpoint, fullname, 0);
1029
	err = mount_snapshot(curthread, vpp, "zfs", mountpoint, fullname, 0,
1030
	    dvp->v_vfsp);
1030
	kmem_free(mountpoint, mountpoint_len);
1031
	kmem_free(mountpoint, mountpoint_len);
1031
	if (err == 0) {
1032
	if (err == 0) {
1032
		/*
1033
		/*
(-)sys/kern/vfs_mount.c (+26 lines)
Lines 3141-3143 resume_all_fs(void) Link Here
3141
	}
3141
	}
3142
	mtx_unlock(&mountlist_mtx);
3142
	mtx_unlock(&mountlist_mtx);
3143
}
3143
}
3144
3145
/*
3146
 * Clone the mnt_exjail field to a new mount point.
3147
 */
3148
void
3149
vfs_exjail_clone(struct mount *inmp, struct mount *outmp)
3150
{
3151
	struct ucred *cr;
3152
3153
	MNT_ILOCK(inmp);
3154
	cr = inmp->mnt_exjail;
3155
	if (cr != NULL) {
3156
		crhold(cr);
3157
		MNT_IUNLOCK(inmp);
3158
		MNT_ILOCK(outmp);
3159
		if (outmp->mnt_exjail == NULL) {
3160
			outmp->mnt_exjail = cr;
3161
			atomic_add_int(&cr->cr_prison->pr_exportcnt, 1);
3162
			cr = NULL;
3163
		}
3164
		MNT_IUNLOCK(outmp);
3165
		if (cr != NULL)
3166
			crfree(cr);
3167
	} else
3168
		MNT_IUNLOCK(inmp);
3169
}
(-)sys/sys/mount.h (+1 lines)
Lines 1017-1022 int vfs_setpublicfs /* set publicly exported fs Link Here
1017
	    (struct mount *, struct netexport *, struct export_args *);
1017
	    (struct mount *, struct netexport *, struct export_args *);
1018
void	vfs_periodic(struct mount *, int);
1018
void	vfs_periodic(struct mount *, int);
1019
int	vfs_busy(struct mount *, int);
1019
int	vfs_busy(struct mount *, int);
1020
void	vfs_exjail_clone(struct mount *, struct mount *);
1020
void	vfs_exjail_delete(struct prison *);
1021
void	vfs_exjail_delete(struct prison *);
1021
int	vfs_export			 /* process mount export info */
1022
int	vfs_export			 /* process mount export info */
1022
	    (struct mount *, struct export_args *, bool);
1023
	    (struct mount *, struct export_args *, bool);

Return to bug 275200