4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
22 * Copyright 2008 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
26 #pragma ident "@(#)zfs_vfsops.c 1.41 08/04/11 SMI"
28 #include <sys/types.h>
29 #include <sys/param.h>
30 #include <sys/systm.h>
31 #include <sys/sysmacros.h>
33 #include <sys/pathname.h>
34 #include <sys/vnode.h>
36 #include <sys/vfs_opreg.h>
37 #include <sys/mntent.h>
38 #include <sys/mount.h>
39 #include <sys/cmn_err.h>
40 #include "fs/fs_subr.h"
41 #include <sys/zfs_znode.h>
42 #include <sys/zfs_dir.h>
44 #include <sys/fs/zfs.h>
46 #include <sys/dsl_prop.h>
47 #include <sys/dsl_dataset.h>
48 #include <sys/dsl_deleg.h>
51 #include <sys/varargs.h>
52 #include <sys/policy.h>
53 #include <sys/atomic.h>
54 #include <sys/mkdev.h>
55 #include <sys/modctl.h>
56 #include <sys/refstr.h>
57 #include <sys/zfs_ioctl.h>
58 #include <sys/zfs_ctldir.h>
59 #include <sys/zfs_fuid.h>
60 #include <sys/bootconf.h>
61 #include <sys/sunddi.h>
63 #include <sys/dmu_objset.h>
64 #include <sys/spa_boot.h>
67 vfsops_t *zfs_vfsops = NULL;
68 static major_t zfs_major;
69 static minor_t zfs_minor;
70 static kmutex_t zfs_dev_mtx;
72 static int zfs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr);
73 static int zfs_umount(vfs_t *vfsp, int fflag, cred_t *cr);
74 static int zfs_mountroot(vfs_t *vfsp, enum whymountroot);
75 static int zfs_root(vfs_t *vfsp, vnode_t **vpp);
76 static int zfs_statvfs(vfs_t *vfsp, struct statvfs64 *statp);
77 static int zfs_vget(vfs_t *vfsp, vnode_t **vpp, fid_t *fidp);
78 static void zfs_freevfs(vfs_t *vfsp);
80 static const fs_operation_def_t zfs_vfsops_template[] = {
81 VFSNAME_MOUNT, { .vfs_mount = zfs_mount },
82 VFSNAME_MOUNTROOT, { .vfs_mountroot = zfs_mountroot },
83 VFSNAME_UNMOUNT, { .vfs_unmount = zfs_umount },
84 VFSNAME_ROOT, { .vfs_root = zfs_root },
85 VFSNAME_STATVFS, { .vfs_statvfs = zfs_statvfs },
86 VFSNAME_SYNC, { .vfs_sync = zfs_sync },
87 VFSNAME_VGET, { .vfs_vget = zfs_vget },
88 VFSNAME_FREEVFS, { .vfs_freevfs = zfs_freevfs },
92 static const fs_operation_def_t zfs_vfsops_eio_template[] = {
93 VFSNAME_FREEVFS, { .vfs_freevfs = zfs_freevfs },
98 * We need to keep a count of active fs's.
99 * This is necessary to prevent our module
100 * from being unloaded after a umount -f
102 static uint32_t zfs_active_fs_count = 0;
104 static char *noatime_cancel[] = { MNTOPT_ATIME, NULL };
105 static char *atime_cancel[] = { MNTOPT_NOATIME, NULL };
106 static char *noxattr_cancel[] = { MNTOPT_XATTR, NULL };
107 static char *xattr_cancel[] = { MNTOPT_NOXATTR, NULL };
110 * MO_DEFAULT is not used since the default value is determined
111 * by the equivalent property.
113 static mntopt_t mntopts[] = {
114 { MNTOPT_NOXATTR, noxattr_cancel, NULL, 0, NULL },
115 { MNTOPT_XATTR, xattr_cancel, NULL, 0, NULL },
116 { MNTOPT_NOATIME, noatime_cancel, NULL, 0, NULL },
117 { MNTOPT_ATIME, atime_cancel, NULL, 0, NULL }
120 static mntopts_t zfs_mntopts = {
121 sizeof (mntopts) / sizeof (mntopt_t),
127 zfs_sync(vfs_t *vfsp, short flag, cred_t *cr)
130 * Data integrity is job one. We don't want a compromised kernel
131 * writing to the storage pool, so we never sync during panic.
137 * SYNC_ATTR is used by fsflush() to force old filesystems like UFS
138 * to sync metadata, which they would otherwise cache indefinitely.
139 * Semantically, the only requirement is that the sync be initiated.
140 * The DMU syncs out txgs frequently, so there's nothing to do.
142 if (flag & SYNC_ATTR)
147 * Sync a specific filesystem.
149 zfsvfs_t *zfsvfs = vfsp->vfs_data;
152 if (zfsvfs->z_log != NULL)
153 zil_commit(zfsvfs->z_log, UINT64_MAX, 0);
155 txg_wait_synced(dmu_objset_pool(zfsvfs->z_os), 0);
159 * Sync all ZFS filesystems. This is what happens when you
160 * run sync(1M). Unlike other filesystems, ZFS honors the
161 * request by waiting for all pools to commit all dirty data.
170 zfs_create_unique_device(dev_t *dev)
175 ASSERT3U(zfs_minor, <=, MAXMIN32);
176 minor_t start = zfs_minor;
178 mutex_enter(&zfs_dev_mtx);
179 if (zfs_minor >= MAXMIN32) {
181 * If we're still using the real major
182 * keep out of /dev/zfs and /dev/zvol minor
183 * number space. If we're using a getudev()'ed
184 * major number, we can use all of its minors.
186 if (zfs_major == ddi_name_to_major(ZFS_DRIVER))
187 zfs_minor = ZFS_MIN_MINOR;
193 *dev = makedevice(zfs_major, zfs_minor);
194 mutex_exit(&zfs_dev_mtx);
195 } while (vfs_devismounted(*dev) && zfs_minor != start);
196 if (zfs_minor == start) {
198 * We are using all ~262,000 minor numbers for the
199 * current major number. Create a new major number.
201 if ((new_major = getudev()) == (major_t)-1) {
203 "zfs_mount: Can't get unique major "
207 mutex_enter(&zfs_dev_mtx);
208 zfs_major = new_major;
211 mutex_exit(&zfs_dev_mtx);
215 /* CONSTANTCONDITION */
222 atime_changed_cb(void *arg, uint64_t newval)
224 zfsvfs_t *zfsvfs = arg;
226 if (newval == TRUE) {
227 zfsvfs->z_atime = TRUE;
228 vfs_clearmntopt(zfsvfs->z_vfs, MNTOPT_NOATIME);
229 vfs_setmntopt(zfsvfs->z_vfs, MNTOPT_ATIME, NULL, 0);
231 zfsvfs->z_atime = FALSE;
232 vfs_clearmntopt(zfsvfs->z_vfs, MNTOPT_ATIME);
233 vfs_setmntopt(zfsvfs->z_vfs, MNTOPT_NOATIME, NULL, 0);
238 xattr_changed_cb(void *arg, uint64_t newval)
240 zfsvfs_t *zfsvfs = arg;
242 if (newval == TRUE) {
243 /* XXX locking on vfs_flag? */
244 zfsvfs->z_vfs->vfs_flag |= VFS_XATTR;
245 vfs_clearmntopt(zfsvfs->z_vfs, MNTOPT_NOXATTR);
246 vfs_setmntopt(zfsvfs->z_vfs, MNTOPT_XATTR, NULL, 0);
248 /* XXX locking on vfs_flag? */
249 zfsvfs->z_vfs->vfs_flag &= ~VFS_XATTR;
250 vfs_clearmntopt(zfsvfs->z_vfs, MNTOPT_XATTR);
251 vfs_setmntopt(zfsvfs->z_vfs, MNTOPT_NOXATTR, NULL, 0);
256 blksz_changed_cb(void *arg, uint64_t newval)
258 zfsvfs_t *zfsvfs = arg;
260 if (newval < SPA_MINBLOCKSIZE ||
261 newval > SPA_MAXBLOCKSIZE || !ISP2(newval))
262 newval = SPA_MAXBLOCKSIZE;
264 zfsvfs->z_max_blksz = newval;
265 zfsvfs->z_vfs->vfs_bsize = newval;
269 readonly_changed_cb(void *arg, uint64_t newval)
271 zfsvfs_t *zfsvfs = arg;
274 /* XXX locking on vfs_flag? */
275 zfsvfs->z_vfs->vfs_flag |= VFS_RDONLY;
276 vfs_clearmntopt(zfsvfs->z_vfs, MNTOPT_RW);
277 vfs_setmntopt(zfsvfs->z_vfs, MNTOPT_RO, NULL, 0);
279 /* XXX locking on vfs_flag? */
280 zfsvfs->z_vfs->vfs_flag &= ~VFS_RDONLY;
281 vfs_clearmntopt(zfsvfs->z_vfs, MNTOPT_RO);
282 vfs_setmntopt(zfsvfs->z_vfs, MNTOPT_RW, NULL, 0);
287 devices_changed_cb(void *arg, uint64_t newval)
289 zfsvfs_t *zfsvfs = arg;
291 if (newval == FALSE) {
292 zfsvfs->z_vfs->vfs_flag |= VFS_NODEVICES;
293 vfs_clearmntopt(zfsvfs->z_vfs, MNTOPT_DEVICES);
294 vfs_setmntopt(zfsvfs->z_vfs, MNTOPT_NODEVICES, NULL, 0);
296 zfsvfs->z_vfs->vfs_flag &= ~VFS_NODEVICES;
297 vfs_clearmntopt(zfsvfs->z_vfs, MNTOPT_NODEVICES);
298 vfs_setmntopt(zfsvfs->z_vfs, MNTOPT_DEVICES, NULL, 0);
303 setuid_changed_cb(void *arg, uint64_t newval)
305 zfsvfs_t *zfsvfs = arg;
307 if (newval == FALSE) {
308 zfsvfs->z_vfs->vfs_flag |= VFS_NOSETUID;
309 vfs_clearmntopt(zfsvfs->z_vfs, MNTOPT_SETUID);
310 vfs_setmntopt(zfsvfs->z_vfs, MNTOPT_NOSETUID, NULL, 0);
312 zfsvfs->z_vfs->vfs_flag &= ~VFS_NOSETUID;
313 vfs_clearmntopt(zfsvfs->z_vfs, MNTOPT_NOSETUID);
314 vfs_setmntopt(zfsvfs->z_vfs, MNTOPT_SETUID, NULL, 0);
319 exec_changed_cb(void *arg, uint64_t newval)
321 zfsvfs_t *zfsvfs = arg;
323 if (newval == FALSE) {
324 zfsvfs->z_vfs->vfs_flag |= VFS_NOEXEC;
325 vfs_clearmntopt(zfsvfs->z_vfs, MNTOPT_EXEC);
326 vfs_setmntopt(zfsvfs->z_vfs, MNTOPT_NOEXEC, NULL, 0);
328 zfsvfs->z_vfs->vfs_flag &= ~VFS_NOEXEC;
329 vfs_clearmntopt(zfsvfs->z_vfs, MNTOPT_NOEXEC);
330 vfs_setmntopt(zfsvfs->z_vfs, MNTOPT_EXEC, NULL, 0);
335 * The nbmand mount option can be changed at mount time.
336 * We can't allow it to be toggled on live file systems or incorrect
337 * behavior may be seen from cifs clients
339 * This property isn't registered via dsl_prop_register(), but this callback
340 * will be called when a file system is first mounted
343 nbmand_changed_cb(void *arg, uint64_t newval)
345 zfsvfs_t *zfsvfs = arg;
346 if (newval == FALSE) {
347 vfs_clearmntopt(zfsvfs->z_vfs, MNTOPT_NBMAND);
348 vfs_setmntopt(zfsvfs->z_vfs, MNTOPT_NONBMAND, NULL, 0);
350 vfs_clearmntopt(zfsvfs->z_vfs, MNTOPT_NONBMAND);
351 vfs_setmntopt(zfsvfs->z_vfs, MNTOPT_NBMAND, NULL, 0);
356 snapdir_changed_cb(void *arg, uint64_t newval)
358 zfsvfs_t *zfsvfs = arg;
360 zfsvfs->z_show_ctldir = newval;
364 vscan_changed_cb(void *arg, uint64_t newval)
366 zfsvfs_t *zfsvfs = arg;
368 zfsvfs->z_vscan = newval;
372 acl_mode_changed_cb(void *arg, uint64_t newval)
374 zfsvfs_t *zfsvfs = arg;
376 zfsvfs->z_acl_mode = newval;
380 acl_inherit_changed_cb(void *arg, uint64_t newval)
382 zfsvfs_t *zfsvfs = arg;
384 zfsvfs->z_acl_inherit = newval;
388 zfs_register_callbacks(vfs_t *vfsp)
390 struct dsl_dataset *ds = NULL;
392 zfsvfs_t *zfsvfs = NULL;
394 int readonly, do_readonly = B_FALSE;
395 int setuid, do_setuid = B_FALSE;
396 int exec, do_exec = B_FALSE;
397 int devices, do_devices = B_FALSE;
398 int xattr, do_xattr = B_FALSE;
399 int atime, do_atime = B_FALSE;
403 zfsvfs = vfsp->vfs_data;
408 * The act of registering our callbacks will destroy any mount
409 * options we may have. In order to enable temporary overrides
410 * of mount options, we stash away the current values and
411 * restore them after we register the callbacks.
413 if (vfs_optionisset(vfsp, MNTOPT_RO, NULL)) {
415 do_readonly = B_TRUE;
416 } else if (vfs_optionisset(vfsp, MNTOPT_RW, NULL)) {
418 do_readonly = B_TRUE;
420 if (vfs_optionisset(vfsp, MNTOPT_NOSUID, NULL)) {
426 if (vfs_optionisset(vfsp, MNTOPT_NODEVICES, NULL)) {
429 } else if (vfs_optionisset(vfsp, MNTOPT_DEVICES, NULL)) {
434 if (vfs_optionisset(vfsp, MNTOPT_NOSETUID, NULL)) {
437 } else if (vfs_optionisset(vfsp, MNTOPT_SETUID, NULL)) {
442 if (vfs_optionisset(vfsp, MNTOPT_NOEXEC, NULL)) {
445 } else if (vfs_optionisset(vfsp, MNTOPT_EXEC, NULL)) {
449 if (vfs_optionisset(vfsp, MNTOPT_NOXATTR, NULL)) {
452 } else if (vfs_optionisset(vfsp, MNTOPT_XATTR, NULL)) {
456 if (vfs_optionisset(vfsp, MNTOPT_NOATIME, NULL)) {
459 } else if (vfs_optionisset(vfsp, MNTOPT_ATIME, NULL)) {
465 * nbmand is a special property. It can only be changed at
468 * This is weird, but it is documented to only be changeable
471 if (vfs_optionisset(vfsp, MNTOPT_NONBMAND, NULL)) {
473 } else if (vfs_optionisset(vfsp, MNTOPT_NBMAND, NULL)) {
476 char osname[MAXNAMELEN];
478 dmu_objset_name(os, osname);
479 if (error = dsl_prop_get_integer(osname, "nbmand", &nbmand,
485 * Register property callbacks.
487 * It would probably be fine to just check for i/o error from
488 * the first prop_register(), but I guess I like to go
491 ds = dmu_objset_ds(os);
492 error = dsl_prop_register(ds, "atime", atime_changed_cb, zfsvfs);
493 error = error ? error : dsl_prop_register(ds,
494 "xattr", xattr_changed_cb, zfsvfs);
495 error = error ? error : dsl_prop_register(ds,
496 "recordsize", blksz_changed_cb, zfsvfs);
497 error = error ? error : dsl_prop_register(ds,
498 "readonly", readonly_changed_cb, zfsvfs);
499 error = error ? error : dsl_prop_register(ds,
500 "devices", devices_changed_cb, zfsvfs);
501 error = error ? error : dsl_prop_register(ds,
502 "setuid", setuid_changed_cb, zfsvfs);
503 error = error ? error : dsl_prop_register(ds,
504 "exec", exec_changed_cb, zfsvfs);
505 error = error ? error : dsl_prop_register(ds,
506 "snapdir", snapdir_changed_cb, zfsvfs);
507 error = error ? error : dsl_prop_register(ds,
508 "aclmode", acl_mode_changed_cb, zfsvfs);
509 error = error ? error : dsl_prop_register(ds,
510 "aclinherit", acl_inherit_changed_cb, zfsvfs);
511 error = error ? error : dsl_prop_register(ds,
512 "vscan", vscan_changed_cb, zfsvfs);
517 * Invoke our callbacks to restore temporary mount options.
520 readonly_changed_cb(zfsvfs, readonly);
522 setuid_changed_cb(zfsvfs, setuid);
524 exec_changed_cb(zfsvfs, exec);
526 devices_changed_cb(zfsvfs, devices);
528 xattr_changed_cb(zfsvfs, xattr);
530 atime_changed_cb(zfsvfs, atime);
532 nbmand_changed_cb(zfsvfs, nbmand);
538 * We may attempt to unregister some callbacks that are not
539 * registered, but this is OK; it will simply return ENOMSG,
540 * which we will ignore.
542 (void) dsl_prop_unregister(ds, "atime", atime_changed_cb, zfsvfs);
543 (void) dsl_prop_unregister(ds, "xattr", xattr_changed_cb, zfsvfs);
544 (void) dsl_prop_unregister(ds, "recordsize", blksz_changed_cb, zfsvfs);
545 (void) dsl_prop_unregister(ds, "readonly", readonly_changed_cb, zfsvfs);
546 (void) dsl_prop_unregister(ds, "devices", devices_changed_cb, zfsvfs);
547 (void) dsl_prop_unregister(ds, "setuid", setuid_changed_cb, zfsvfs);
548 (void) dsl_prop_unregister(ds, "exec", exec_changed_cb, zfsvfs);
549 (void) dsl_prop_unregister(ds, "snapdir", snapdir_changed_cb, zfsvfs);
550 (void) dsl_prop_unregister(ds, "aclmode", acl_mode_changed_cb, zfsvfs);
551 (void) dsl_prop_unregister(ds, "aclinherit", acl_inherit_changed_cb,
553 (void) dsl_prop_unregister(ds, "vscan", vscan_changed_cb, zfsvfs);
559 zfsvfs_setup(zfsvfs_t *zfsvfs, boolean_t mounting)
564 error = zfs_register_callbacks(zfsvfs->z_vfs);
569 * Set the objset user_ptr to track its zfsvfs.
571 mutex_enter(&zfsvfs->z_os->os->os_user_ptr_lock);
572 dmu_objset_set_user(zfsvfs->z_os, zfsvfs);
573 mutex_exit(&zfsvfs->z_os->os->os_user_ptr_lock);
576 * If we are not mounting (ie: online recv), then we don't
577 * have to worry about replaying the log as we blocked all
578 * operations out since we closed the ZIL.
582 * During replay we remove the read only flag to
583 * allow replays to succeed.
585 readonly = zfsvfs->z_vfs->vfs_flag & VFS_RDONLY;
587 zfsvfs->z_vfs->vfs_flag &= ~VFS_RDONLY;
589 zfs_unlinked_drain(zfsvfs);
592 * Parse and replay the intent log.
594 * Because of ziltest, this must be done after
595 * zfs_unlinked_drain(). (Further note: ziltest doesn't
596 * use readonly mounts, where zfs_unlinked_drain() isn't
597 * called.) This is because ziltest causes spa_sync()
598 * to think it's committed, but actually it is not, so
599 * the intent log contains many txg's worth of changes.
601 * In particular, if object N is in the unlinked set in
602 * the last txg to actually sync, then it could be
603 * actually freed in a later txg and then reallocated in
604 * a yet later txg. This would write a "create object
605 * N" record to the intent log. Normally, this would be
606 * fine because the spa_sync() would have written out
607 * the fact that object N is free, before we could write
608 * the "create object N" intent log record.
610 * But when we are in ziltest mode, we advance the "open
611 * txg" without actually spa_sync()-ing the changes to
612 * disk. So we would see that object N is still
613 * allocated and in the unlinked set, and there is an
614 * intent log record saying to allocate it.
616 zil_replay(zfsvfs->z_os, zfsvfs, &zfsvfs->z_assign,
619 zfsvfs->z_vfs->vfs_flag |= readonly; /* restore readonly bit */
623 zfsvfs->z_log = zil_open(zfsvfs->z_os, zfs_get_data);
629 zfs_freezfsvfs(zfsvfs_t *zfsvfs)
631 mutex_destroy(&zfsvfs->z_znodes_lock);
632 mutex_destroy(&zfsvfs->z_online_recv_lock);
633 list_destroy(&zfsvfs->z_all_znodes);
634 rrw_destroy(&zfsvfs->z_teardown_lock);
635 rw_destroy(&zfsvfs->z_teardown_inactive_lock);
636 rw_destroy(&zfsvfs->z_fuid_lock);
637 kmem_free(zfsvfs, sizeof (zfsvfs_t));
641 zfs_domount(vfs_t *vfsp, char *osname, cred_t *cr)
644 uint64_t recordsize, readonly;
654 * Initialize the zfs-specific filesystem structure.
655 * Should probably make this a kmem cache, shuffle fields,
656 * and just bzero up to z_hold_mtx[].
658 zfsvfs = kmem_zalloc(sizeof (zfsvfs_t), KM_SLEEP);
659 zfsvfs->z_vfs = vfsp;
660 zfsvfs->z_parent = zfsvfs;
661 zfsvfs->z_assign = TXG_NOWAIT;
662 zfsvfs->z_max_blksz = SPA_MAXBLOCKSIZE;
663 zfsvfs->z_show_ctldir = ZFS_SNAPDIR_VISIBLE;
665 mutex_init(&zfsvfs->z_znodes_lock, NULL, MUTEX_DEFAULT, NULL);
666 mutex_init(&zfsvfs->z_online_recv_lock, NULL, MUTEX_DEFAULT, NULL);
667 list_create(&zfsvfs->z_all_znodes, sizeof (znode_t),
668 offsetof(znode_t, z_link_node));
669 rrw_init(&zfsvfs->z_teardown_lock);
670 rw_init(&zfsvfs->z_teardown_inactive_lock, NULL, RW_DEFAULT, NULL);
671 rw_init(&zfsvfs->z_fuid_lock, NULL, RW_DEFAULT, NULL);
673 /* Initialize the generic filesystem structure. */
674 vfsp->vfs_bcount = 0;
675 vfsp->vfs_data = NULL;
677 if (zfs_create_unique_device(&mount_dev) == -1) {
681 ASSERT(vfs_devismounted(mount_dev) == 0);
683 if (error = dsl_prop_get_integer(osname, "recordsize", &recordsize,
687 vfsp->vfs_dev = mount_dev;
688 vfsp->vfs_fstype = zfsfstype;
689 vfsp->vfs_bsize = recordsize;
690 vfsp->vfs_flag |= VFS_NOTRUNC;
691 vfsp->vfs_data = zfsvfs;
693 if (error = dsl_prop_get_integer(osname, "readonly", &readonly, NULL))
697 mode = DS_MODE_PRIMARY | DS_MODE_READONLY;
699 mode = DS_MODE_PRIMARY;
701 error = dmu_objset_open(osname, DMU_OST_ZFS, mode, &zfsvfs->z_os);
702 if (error == EROFS) {
703 mode = DS_MODE_PRIMARY | DS_MODE_READONLY;
704 error = dmu_objset_open(osname, DMU_OST_ZFS, mode,
711 if (error = zfs_init_fs(zfsvfs, &zp, cr))
714 /* The call to zfs_init_fs leaves the vnode held, release it here. */
718 * Set features for file system.
720 zfsvfs->z_use_fuids = USE_FUIDS(zfsvfs->z_version, zfsvfs->z_os);
721 if (zfsvfs->z_use_fuids) {
722 vfs_set_feature(vfsp, VFSFT_XVATTR);
723 vfs_set_feature(vfsp, VFSFT_ACEMASKONACCESS);
724 vfs_set_feature(vfsp, VFSFT_ACLONCREATE);
726 if (zfsvfs->z_case == ZFS_CASE_INSENSITIVE) {
727 vfs_set_feature(vfsp, VFSFT_DIRENTFLAGS);
728 vfs_set_feature(vfsp, VFSFT_CASEINSENSITIVE);
729 vfs_set_feature(vfsp, VFSFT_NOCASESENSITIVE);
730 } else if (zfsvfs->z_case == ZFS_CASE_MIXED) {
731 vfs_set_feature(vfsp, VFSFT_DIRENTFLAGS);
732 vfs_set_feature(vfsp, VFSFT_CASEINSENSITIVE);
735 if (dmu_objset_is_snapshot(zfsvfs->z_os)) {
738 ASSERT(mode & DS_MODE_READONLY);
739 atime_changed_cb(zfsvfs, B_FALSE);
740 readonly_changed_cb(zfsvfs, B_TRUE);
741 if (error = dsl_prop_get_integer(osname, "xattr", &pval, NULL))
743 xattr_changed_cb(zfsvfs, pval);
744 zfsvfs->z_issnap = B_TRUE;
746 error = zfsvfs_setup(zfsvfs, B_TRUE);
749 if (!zfsvfs->z_issnap)
750 zfsctl_create(zfsvfs);
754 dmu_objset_close(zfsvfs->z_os);
755 zfs_freezfsvfs(zfsvfs);
757 atomic_add_32(&zfs_active_fs_count, 1);
764 zfs_unregister_callbacks(zfsvfs_t *zfsvfs)
766 objset_t *os = zfsvfs->z_os;
767 struct dsl_dataset *ds;
770 * Unregister properties.
772 if (!dmu_objset_is_snapshot(os)) {
773 ds = dmu_objset_ds(os);
774 VERIFY(dsl_prop_unregister(ds, "atime", atime_changed_cb,
777 VERIFY(dsl_prop_unregister(ds, "xattr", xattr_changed_cb,
780 VERIFY(dsl_prop_unregister(ds, "recordsize", blksz_changed_cb,
783 VERIFY(dsl_prop_unregister(ds, "readonly", readonly_changed_cb,
786 VERIFY(dsl_prop_unregister(ds, "devices", devices_changed_cb,
789 VERIFY(dsl_prop_unregister(ds, "setuid", setuid_changed_cb,
792 VERIFY(dsl_prop_unregister(ds, "exec", exec_changed_cb,
795 VERIFY(dsl_prop_unregister(ds, "snapdir", snapdir_changed_cb,
798 VERIFY(dsl_prop_unregister(ds, "aclmode", acl_mode_changed_cb,
801 VERIFY(dsl_prop_unregister(ds, "aclinherit",
802 acl_inherit_changed_cb, zfsvfs) == 0);
804 VERIFY(dsl_prop_unregister(ds, "vscan",
805 vscan_changed_cb, zfsvfs) == 0);
810 * Convert a decimal digit string to a uint64_t integer.
813 str_to_uint64(char *str, uint64_t *objnum)
818 if (*str < '0' || *str > '9')
821 num = num*10 + *str++ - '0';
829 * The boot path passed from the boot loader is in the form of
830 * "rootpool-name/root-filesystem-object-number'. Convert this
831 * string to a dataset name: "rootpool-name/root-filesystem-name".
834 zfs_parse_bootfs(char *bpath, char *outpath)
840 if (*bpath == 0 || *bpath == '/')
843 slashp = strchr(bpath, '/');
845 /* if no '/', just return the pool name */
846 if (slashp == NULL) {
847 (void) strcpy(outpath, bpath);
851 if (error = str_to_uint64(slashp+1, &objnum))
855 error = dsl_dsobj_to_dsname(bpath, objnum, outpath);
862 zfs_mountroot(vfs_t *vfsp, enum whymountroot why)
865 static int zfsrootdone = 0;
866 zfsvfs_t *zfsvfs = NULL;
874 * The filesystem that we mount as root is defined in the
875 * boot property "zfs-bootfs" with a format of
876 * "poolname/root-dataset-objnum".
878 if (why == ROOT_INIT) {
882 * the process of doing a spa_load will require the
883 * clock to be set before we could (for example) do
884 * something better by looking at the timestamp on
885 * an uberblock, so just set it to -1.
889 if ((zfs_bootfs = spa_get_bootfs()) == NULL) {
890 cmn_err(CE_NOTE, "\nspa_get_bootfs: can not get "
895 if (error = spa_import_rootpool(rootfs.bo_name)) {
896 spa_free_bootfs(zfs_bootfs);
897 cmn_err(CE_NOTE, "\nspa_import_rootpool: error %d\n",
902 if (error = zfs_parse_bootfs(zfs_bootfs, rootfs.bo_name)) {
903 spa_free_bootfs(zfs_bootfs);
904 cmn_err(CE_NOTE, "\nzfs_parse_bootfs: error %d\n",
909 spa_free_bootfs(zfs_bootfs);
911 if (error = vfs_lock(vfsp))
914 if (error = zfs_domount(vfsp, rootfs.bo_name, CRED())) {
915 cmn_err(CE_NOTE, "\nzfs_domount: error %d\n", error);
919 zfsvfs = (zfsvfs_t *)vfsp->vfs_data;
921 if (error = zfs_zget(zfsvfs, zfsvfs->z_root, &zp)) {
922 cmn_err(CE_NOTE, "\nzfs_zget: error %d\n", error);
927 mutex_enter(&vp->v_lock);
929 mutex_exit(&vp->v_lock);
933 * The zfs_zget call above returns with a hold on vp, we release
938 vfs_add((struct vnode *)0, vfsp,
939 (vfsp->vfs_flag & VFS_RDONLY) ? MS_RDONLY : 0);
943 } else if (why == ROOT_REMOUNT) {
944 readonly_changed_cb(vfsp->vfs_data, B_FALSE);
945 vfsp->vfs_flag |= VFS_REMOUNT;
947 /* refresh mount options */
948 zfs_unregister_callbacks(vfsp->vfs_data);
949 return (zfs_register_callbacks(vfsp));
951 } else if (why == ROOT_UNMOUNT) {
952 zfs_unregister_callbacks((zfsvfs_t *)vfsp->vfs_data);
953 (void) zfs_sync(vfsp, 0, 0);
958 * if "why" is equal to anything else other than ROOT_INIT,
959 * ROOT_REMOUNT, or ROOT_UNMOUNT, we do not support it.
966 zfs_mount(vfs_t *vfsp, vnode_t *mvp, struct mounta *uap, cred_t *cr)
971 uio_seg_t fromspace = (uap->flags & MS_SYSSPACE) ?
972 UIO_SYSSPACE : UIO_USERSPACE;
975 if (mvp->v_type != VDIR)
978 mutex_enter(&mvp->v_lock);
979 if ((uap->flags & MS_REMOUNT) == 0 &&
980 (uap->flags & MS_OVERLAY) == 0 &&
981 (mvp->v_count != 1 || (mvp->v_flag & VROOT))) {
982 mutex_exit(&mvp->v_lock);
985 mutex_exit(&mvp->v_lock);
988 * ZFS does not support passing unparsed data in via MS_DATA.
989 * Users should use the MS_OPTIONSTR interface; this means
990 * that all option parsing is already done and the options struct
991 * can be interrogated.
993 if ((uap->flags & MS_DATA) && uap->datalen > 0)
997 * Get the objset name (the "special" mount argument).
999 if (error = pn_get(uap->spec, fromspace, &spn))
1002 osname = spn.pn_path;
1005 * Check for mount privilege?
1007 * If we don't have privilege then see if
1008 * we have local permission to allow it
1010 error = secpolicy_fs_mount(cr, mvp, vfsp);
1012 error = dsl_deleg_access(osname, ZFS_DELEG_PERM_MOUNT, cr);
1017 * Make sure user is the owner of the mount point
1018 * or has sufficient privileges.
1021 vattr.va_mask = AT_UID;
1023 if (error = VOP_GETATTR(mvp, &vattr, 0, cr, NULL)) {
1027 if (secpolicy_vnode_owner(cr, vattr.va_uid) != 0 &&
1028 VOP_ACCESS(mvp, VWRITE, 0, cr, NULL) != 0) {
1033 secpolicy_fs_mount_clearopts(cr, vfsp);
1040 * Refuse to mount a filesystem if we are in a local zone and the
1041 * dataset is not visible.
1043 if (!INGLOBALZONE(curproc) &&
1044 (!zone_dataset_visible(osname, &canwrite) || !canwrite)) {
1050 * When doing a remount, we simply refresh our temporary properties
1051 * according to those options set in the current VFS options.
1053 if (uap->flags & MS_REMOUNT) {
1054 /* refresh mount options */
1055 zfs_unregister_callbacks(vfsp->vfs_data);
1056 error = zfs_register_callbacks(vfsp);
1060 error = zfs_domount(vfsp, osname, cr);
1068 zfs_statvfs(vfs_t *vfsp, struct statvfs64 *statp)
1070 zfsvfs_t *zfsvfs = vfsp->vfs_data;
1072 uint64_t refdbytes, availbytes, usedobjs, availobjs;
1076 dmu_objset_space(zfsvfs->z_os,
1077 &refdbytes, &availbytes, &usedobjs, &availobjs);
1080 * The underlying storage pool actually uses multiple block sizes.
1081 * We report the fragsize as the smallest block size we support,
1082 * and we report our blocksize as the filesystem's maximum blocksize.
1084 statp->f_frsize = 1UL << SPA_MINBLOCKSHIFT;
1085 statp->f_bsize = zfsvfs->z_max_blksz;
1088 * The following report "total" blocks of various kinds in the
1089 * file system, but reported in terms of f_frsize - the
1093 statp->f_blocks = (refdbytes + availbytes) >> SPA_MINBLOCKSHIFT;
1094 statp->f_bfree = availbytes >> SPA_MINBLOCKSHIFT;
1095 statp->f_bavail = statp->f_bfree; /* no root reservation */
1098 * statvfs() should really be called statufs(), because it assumes
1099 * static metadata. ZFS doesn't preallocate files, so the best
1100 * we can do is report the max that could possibly fit in f_files,
1101 * and that minus the number actually used in f_ffree.
1102 * For f_ffree, report the smaller of the number of object available
1103 * and the number of blocks (each object will take at least a block).
1105 statp->f_ffree = MIN(availobjs, statp->f_bfree);
1106 statp->f_favail = statp->f_ffree; /* no "root reservation" */
1107 statp->f_files = statp->f_ffree + usedobjs;
1109 (void) cmpldev(&d32, vfsp->vfs_dev);
1110 statp->f_fsid = d32;
1113 * We're a zfs filesystem.
1115 (void) strcpy(statp->f_basetype, vfssw[vfsp->vfs_fstype].vsw_name);
1117 statp->f_flag = vf_to_stf(vfsp->vfs_flag);
1119 statp->f_namemax = ZFS_MAXNAMELEN;
1122 * We have all of 32 characters to stuff a string here.
1123 * Is there anything useful we could/should provide?
1125 bzero(statp->f_fstr, sizeof (statp->f_fstr));
1132 zfs_root(vfs_t *vfsp, vnode_t **vpp)
1134 zfsvfs_t *zfsvfs = vfsp->vfs_data;
1140 error = zfs_zget(zfsvfs, zfsvfs->z_root, &rootzp);
1142 *vpp = ZTOV(rootzp);
1149 * Teardown the zfsvfs::z_os.
1151 * Note, if 'unmounting' if FALSE, we return with the 'z_teardown_lock'
1152 * and 'z_teardown_inactive_lock' held.
1155 zfsvfs_teardown(zfsvfs_t *zfsvfs, boolean_t unmounting)
1159 rrw_enter(&zfsvfs->z_teardown_lock, RW_WRITER, FTAG);
1163 * We purge the parent filesystem's vfsp as the parent
1164 * filesystem and all of its snapshots have their vnode's
1165 * v_vfsp set to the parent's filesystem's vfsp. Note,
1166 * 'z_parent' is self referential for non-snapshots.
1168 (void) dnlc_purge_vfsp(zfsvfs->z_parent->z_vfs, 0);
1172 * Close the zil. NB: Can't close the zil while zfs_inactive
1173 * threads are blocked as zil_close can call zfs_inactive.
1175 if (zfsvfs->z_log) {
1176 zil_close(zfsvfs->z_log);
1177 zfsvfs->z_log = NULL;
1180 rw_enter(&zfsvfs->z_teardown_inactive_lock, RW_WRITER);
1183 * If we are not unmounting (ie: online recv) and someone already
1184 * unmounted this file system while we were doing the switcheroo,
1185 * or a reopen of z_os failed then just bail out now.
1187 if (!unmounting && (zfsvfs->z_unmounted || zfsvfs->z_os == NULL)) {
1188 rw_exit(&zfsvfs->z_teardown_inactive_lock);
1189 rrw_exit(&zfsvfs->z_teardown_lock, FTAG);
1194 * At this point there are no vops active, and any new vops will
1195 * fail with EIO since we have z_teardown_lock for writer (only
1196 * relavent for forced unmount).
1198 * Release all holds on dbufs.
1200 mutex_enter(&zfsvfs->z_znodes_lock);
1201 for (zp = list_head(&zfsvfs->z_all_znodes); zp != NULL;
1202 zp = list_next(&zfsvfs->z_all_znodes, zp))
1204 ASSERT(ZTOV(zp)->v_count > 0);
1205 zfs_znode_dmu_fini(zp);
1207 mutex_exit(&zfsvfs->z_znodes_lock);
1210 * If we are unmounting, set the unmounted flag and let new vops
1211 * unblock. zfs_inactive will have the unmounted behavior, and all
1212 * other vops will fail with EIO.
1215 zfsvfs->z_unmounted = B_TRUE;
1216 rrw_exit(&zfsvfs->z_teardown_lock, FTAG);
1217 rw_exit(&zfsvfs->z_teardown_inactive_lock);
1221 * z_os will be NULL if there was an error in attempting to reopen
1222 * zfsvfs, so just return as the properties had already been
1223 * unregistered and cached data had been evicted before.
1225 if (zfsvfs->z_os == NULL)
1229 * Unregister properties.
1231 zfs_unregister_callbacks(zfsvfs);
1236 if (dmu_objset_evict_dbufs(zfsvfs->z_os)) {
1237 txg_wait_synced(dmu_objset_pool(zfsvfs->z_os), 0);
1238 (void) dmu_objset_evict_dbufs(zfsvfs->z_os);
1246 zfs_umount(vfs_t *vfsp, int fflag, cred_t *cr)
1248 zfsvfs_t *zfsvfs = vfsp->vfs_data;
1252 ret = secpolicy_fs_unmount(cr, vfsp);
1254 ret = dsl_deleg_access((char *)refstr_value(vfsp->vfs_resource),
1255 ZFS_DELEG_PERM_MOUNT, cr);
1261 * We purge the parent filesystem's vfsp as the parent filesystem
1262 * and all of its snapshots have their vnode's v_vfsp set to the
1263 * parent's filesystem's vfsp. Note, 'z_parent' is self
1264 * referential for non-snapshots.
1266 (void) dnlc_purge_vfsp(zfsvfs->z_parent->z_vfs, 0);
1269 * Unmount any snapshots mounted under .zfs before unmounting the
1272 if (zfsvfs->z_ctldir != NULL &&
1273 (ret = zfsctl_umount_snapshots(vfsp, fflag, cr)) != 0) {
1277 if (!(fflag & MS_FORCE)) {
1279 * Check the number of active vnodes in the file system.
1280 * Our count is maintained in the vfs structure, but the
1281 * number is off by 1 to indicate a hold on the vfs
1284 * The '.zfs' directory maintains a reference of its
1285 * own, and any active references underneath are
1286 * reflected in the vnode count.
1288 if (zfsvfs->z_ctldir == NULL) {
1289 if (vfsp->vfs_count > 1)
1292 if (vfsp->vfs_count > 2 ||
1293 zfsvfs->z_ctldir->v_count > 1)
1298 vfsp->vfs_flag |= VFS_UNMOUNTED;
1300 VERIFY(zfsvfs_teardown(zfsvfs, B_TRUE) == 0);
1304 * z_os will be NULL if there was an error in
1305 * attempting to reopen zfsvfs.
1309 * Unset the objset user_ptr.
1311 mutex_enter(&os->os->os_user_ptr_lock);
1312 dmu_objset_set_user(os, NULL);
1313 mutex_exit(&os->os->os_user_ptr_lock);
1316 * Finally close the objset
1318 dmu_objset_close(os);
1322 * We can now safely destroy the '.zfs' directory node.
1324 if (zfsvfs->z_ctldir != NULL)
1325 zfsctl_destroy(zfsvfs);
1331 zfs_vget(vfs_t *vfsp, vnode_t **vpp, fid_t *fidp)
1333 zfsvfs_t *zfsvfs = vfsp->vfs_data;
1335 uint64_t object = 0;
1336 uint64_t fid_gen = 0;
1345 if (fidp->fid_len == LONG_FID_LEN) {
1346 zfid_long_t *zlfid = (zfid_long_t *)fidp;
1347 uint64_t objsetid = 0;
1348 uint64_t setgen = 0;
1350 for (i = 0; i < sizeof (zlfid->zf_setid); i++)
1351 objsetid |= ((uint64_t)zlfid->zf_setid[i]) << (8 * i);
1353 for (i = 0; i < sizeof (zlfid->zf_setgen); i++)
1354 setgen |= ((uint64_t)zlfid->zf_setgen[i]) << (8 * i);
1358 err = zfsctl_lookup_objset(vfsp, objsetid, &zfsvfs);
1364 if (fidp->fid_len == SHORT_FID_LEN || fidp->fid_len == LONG_FID_LEN) {
1365 zfid_short_t *zfid = (zfid_short_t *)fidp;
1367 for (i = 0; i < sizeof (zfid->zf_object); i++)
1368 object |= ((uint64_t)zfid->zf_object[i]) << (8 * i);
1370 for (i = 0; i < sizeof (zfid->zf_gen); i++)
1371 fid_gen |= ((uint64_t)zfid->zf_gen[i]) << (8 * i);
1377 /* A zero fid_gen means we are in the .zfs control directories */
1379 (object == ZFSCTL_INO_ROOT || object == ZFSCTL_INO_SNAPDIR)) {
1380 *vpp = zfsvfs->z_ctldir;
1381 ASSERT(*vpp != NULL);
1382 if (object == ZFSCTL_INO_SNAPDIR) {
1383 VERIFY(zfsctl_root_lookup(*vpp, "snapshot", vpp, NULL,
1384 0, NULL, NULL, NULL, NULL, NULL) == 0);
1392 gen_mask = -1ULL >> (64 - 8 * i);
1394 dprintf("getting %llu [%u mask %llx]\n", object, fid_gen, gen_mask);
1395 if (err = zfs_zget(zfsvfs, object, &zp)) {
1399 zp_gen = zp->z_phys->zp_gen & gen_mask;
1402 if (zp->z_unlinked || zp_gen != fid_gen) {
1403 dprintf("znode gen (%u) != fid gen (%u)\n", zp_gen, fid_gen);
1415 * Block out VOPs and close zfsvfs_t::z_os
1417 * Note, if successful, then we return with the 'z_teardown_lock' and
1418 * 'z_teardown_inactive_lock' write held.
1421 zfs_suspend_fs(zfsvfs_t *zfsvfs, char *name, int *mode)
1425 if ((error = zfsvfs_teardown(zfsvfs, B_FALSE)) != 0)
1428 *mode = zfsvfs->z_os->os_mode;
1429 dmu_objset_name(zfsvfs->z_os, name);
1430 dmu_objset_close(zfsvfs->z_os);
1436 * Reopen zfsvfs_t::z_os and release VOPs.
1439 zfs_resume_fs(zfsvfs_t *zfsvfs, const char *osname, int mode)
1443 ASSERT(RRW_WRITE_HELD(&zfsvfs->z_teardown_lock));
1444 ASSERT(RW_WRITE_HELD(&zfsvfs->z_teardown_inactive_lock));
1446 err = dmu_objset_open(osname, DMU_OST_ZFS, mode, &zfsvfs->z_os);
1448 zfsvfs->z_os = NULL;
1452 VERIFY(zfsvfs_setup(zfsvfs, B_FALSE) == 0);
1455 * Attempt to re-establish all the active znodes with
1456 * their dbufs. If a zfs_rezget() fails, then we'll let
1457 * any potential callers discover that via ZFS_ENTER_VERIFY_VP
1458 * when they try to use their znode.
1460 mutex_enter(&zfsvfs->z_znodes_lock);
1461 for (zp = list_head(&zfsvfs->z_all_znodes); zp;
1462 zp = list_next(&zfsvfs->z_all_znodes, zp)) {
1463 (void) zfs_rezget(zp);
1465 mutex_exit(&zfsvfs->z_znodes_lock);
1469 /* release the VOPs */
1470 rw_exit(&zfsvfs->z_teardown_inactive_lock);
1471 rrw_exit(&zfsvfs->z_teardown_lock, FTAG);
1475 * Since we couldn't reopen zfsvfs::z_os, force
1476 * unmount this file system.
1478 if (vn_vfswlock(zfsvfs->z_vfs->vfs_vnodecovered) == 0)
1479 (void) dounmount(zfsvfs->z_vfs, MS_FORCE, CRED());
1485 zfs_freevfs(vfs_t *vfsp)
1487 zfsvfs_t *zfsvfs = vfsp->vfs_data;
1490 for (i = 0; i != ZFS_OBJ_MTX_SZ; i++)
1491 mutex_destroy(&zfsvfs->z_hold_mtx[i]);
1493 zfs_fuid_destroy(zfsvfs);
1494 zfs_freezfsvfs(zfsvfs);
1496 atomic_add_32(&zfs_active_fs_count, -1);
1500 * VFS_INIT() initialization. Note that there is no VFS_FINI(),
1501 * so we can't safely do any non-idempotent initialization here.
1502 * Leave that to zfs_init() and zfs_fini(), which are called
1503 * from the module's _init() and _fini() entry points.
1507 zfs_vfsinit(int fstype, char *name)
1514 * Setup vfsops and vnodeops tables.
1516 error = vfs_setfsops(fstype, zfs_vfsops_template, &zfs_vfsops);
1518 cmn_err(CE_WARN, "zfs: bad vfs ops template");
1521 error = zfs_create_op_tables();
1523 zfs_remove_op_tables();
1524 cmn_err(CE_WARN, "zfs: bad vnode ops template");
1525 (void) vfs_freevfsops_by_type(zfsfstype);
1529 mutex_init(&zfs_dev_mtx, NULL, MUTEX_DEFAULT, NULL);
1532 * Unique major number for all zfs mounts.
1533 * If we run out of 32-bit minors, we'll getudev() another major.
1535 zfs_major = ddi_name_to_major(ZFS_DRIVER);
1536 zfs_minor = ZFS_MIN_MINOR;
1545 * Initialize .zfs directory structures
1550 * Initialize znode cache, vnode ops, etc...
1565 return (zfs_active_fs_count != 0);
1569 zfs_set_version(const char *name, uint64_t newvers)
1577 * XXX for now, require that the filesystem be unmounted. Would
1578 * be nice to find the zfsvfs_t and just update that if
1582 if (newvers < ZPL_VERSION_INITIAL || newvers > ZPL_VERSION)
1585 error = dmu_objset_open(name, DMU_OST_ZFS, DS_MODE_PRIMARY, &os);
1589 error = zap_lookup(os, MASTER_NODE_OBJ, ZPL_VERSION_STR,
1593 if (newvers < curvers) {
1598 tx = dmu_tx_create(os);
1599 dmu_tx_hold_zap(tx, MASTER_NODE_OBJ, 0, ZPL_VERSION_STR);
1600 error = dmu_tx_assign(tx, TXG_WAIT);
1605 error = zap_update(os, MASTER_NODE_OBJ, ZPL_VERSION_STR, 8, 1,
1608 spa_history_internal_log(LOG_DS_UPGRADE,
1609 dmu_objset_spa(os), tx, CRED(),
1610 "oldver=%llu newver=%llu dataset = %llu", curvers, newvers,
1615 dmu_objset_close(os);
1620 * Read a property stored within the master node.
1623 zfs_get_zplprop(objset_t *os, zfs_prop_t prop, uint64_t *value)
1629 * Look up the file system's value for the property. For the
1630 * version property, we look up a slightly different string.
1632 if (prop == ZFS_PROP_VERSION)
1633 pname = ZPL_VERSION_STR;
1635 pname = zfs_prop_to_name(prop);
1637 error = zap_lookup(os, MASTER_NODE_OBJ, pname, 8, 1, value);
1639 if (error == ENOENT) {
1640 /* No value set, use the default value */
1642 case ZFS_PROP_VERSION:
1643 *value = ZPL_VERSION;
1645 case ZFS_PROP_NORMALIZE:
1646 case ZFS_PROP_UTF8ONLY:
1650 *value = ZFS_CASE_SENSITIVE;
1660 static vfsdef_t vfw = {
1664 VSW_HASPROTO|VSW_CANRWRO|VSW_CANREMOUNT|VSW_VOLATILEDEV|VSW_STATS|
1669 struct modlfs zfs_modlfs = {
1670 &mod_fsops, "ZFS filesystem version " SPA_VERSION_STRING, &vfw