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 (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
25 /* Portions Copyright 2010 Robert Milkowski */
27 #include <sys/types.h>
28 #include <sys/param.h>
29 #include <sys/systm.h>
30 #include <sys/sysmacros.h>
32 #include <sys/pathname.h>
33 #include <sys/vnode.h>
35 #include <sys/vfs_opreg.h>
36 #include <sys/mntent.h>
37 #include <sys/mount.h>
38 #include <sys/cmn_err.h>
39 #include "fs/fs_subr.h"
40 #include <sys/zfs_znode.h>
41 #include <sys/zfs_vnops.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>
52 #include <sys/varargs.h>
53 #include <sys/policy.h>
54 #include <sys/atomic.h>
55 #include <sys/mkdev.h>
56 #include <sys/modctl.h>
57 #include <sys/refstr.h>
58 #include <sys/zfs_ioctl.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 #include "zfs_comutil.h"
72 zfs_sync(struct super_block
*sb
, int wait
, cred_t
*cr
)
74 zfs_sb_t
*zsb
= sb
->s_fs_info
;
77 * Data integrity is job one. We don't want a compromised kernel
78 * writing to the storage pool, so we never sync during panic.
80 if (unlikely(oops_in_progress
))
84 * Semantically, the only requirement is that the sync be initiated.
85 * The DMU syncs out txgs frequently, so there's nothing to do.
92 * Sync a specific filesystem.
97 dp
= dmu_objset_pool(zsb
->z_os
);
100 * If the system is shutting down, then skip any
101 * filesystems which may exist on a suspended pool.
103 if (spa_suspended(dp
->dp_spa
)) {
108 if (zsb
->z_log
!= NULL
)
109 zil_commit(zsb
->z_log
, 0);
114 * Sync all ZFS filesystems. This is what happens when you
115 * run sync(1M). Unlike other filesystems, ZFS honors the
116 * request by waiting for all pools to commit all dirty data.
123 EXPORT_SYMBOL(zfs_sync
);
126 atime_changed_cb(void *arg
, uint64_t newval
)
129 struct super_block
*sb
= zsb
->z_sb
;
130 struct vfsmount
*vfs
= zsb
->z_vfs
;
132 if (newval
== TRUE
) {
133 vfs
->mnt_flags
&= ~MNT_NOATIME
;
134 sb
->s_flags
&= ~MS_NOATIME
;
137 vfs
->mnt_flags
|= MNT_NOATIME
;
138 sb
->s_flags
|= MS_NOATIME
;
139 zsb
->z_atime
= FALSE
;
144 xattr_changed_cb(void *arg
, uint64_t newval
)
148 if (newval
== TRUE
) {
149 zsb
->z_flags
|= ZSB_XATTR_USER
;
151 zsb
->z_flags
&= ~ZSB_XATTR_USER
;
156 blksz_changed_cb(void *arg
, uint64_t newval
)
160 if (newval
< SPA_MINBLOCKSIZE
||
161 newval
> SPA_MAXBLOCKSIZE
|| !ISP2(newval
))
162 newval
= SPA_MAXBLOCKSIZE
;
164 zsb
->z_max_blksz
= newval
;
168 readonly_changed_cb(void *arg
, uint64_t newval
)
171 struct super_block
*sb
= zsb
->z_sb
;
172 struct vfsmount
*vfs
= zsb
->z_vfs
;
175 vfs
->mnt_flags
|= MNT_READONLY
;
176 sb
->s_flags
|= MS_RDONLY
;
178 vfs
->mnt_flags
&= ~MNT_READONLY
;
179 sb
->s_flags
&= ~MS_RDONLY
;
184 devices_changed_cb(void *arg
, uint64_t newval
)
187 struct super_block
*sb
= zsb
->z_sb
;
188 struct vfsmount
*vfs
= zsb
->z_vfs
;
190 if (newval
== FALSE
) {
191 vfs
->mnt_flags
|= MNT_NODEV
;
192 sb
->s_flags
|= MS_NODEV
;
194 vfs
->mnt_flags
&= ~MNT_NODEV
;
195 sb
->s_flags
&= ~MS_NODEV
;
200 setuid_changed_cb(void *arg
, uint64_t newval
)
203 struct super_block
*sb
= zsb
->z_sb
;
204 struct vfsmount
*vfs
= zsb
->z_vfs
;
206 if (newval
== FALSE
) {
207 vfs
->mnt_flags
|= MNT_NOSUID
;
208 sb
->s_flags
|= MS_NOSUID
;
210 vfs
->mnt_flags
&= ~MNT_NOSUID
;
211 sb
->s_flags
&= ~MS_NOSUID
;
216 exec_changed_cb(void *arg
, uint64_t newval
)
219 struct super_block
*sb
= zsb
->z_sb
;
220 struct vfsmount
*vfs
= zsb
->z_vfs
;
222 if (newval
== FALSE
) {
223 vfs
->mnt_flags
|= MNT_NOEXEC
;
224 sb
->s_flags
|= MS_NOEXEC
;
226 vfs
->mnt_flags
&= ~MNT_NOEXEC
;
227 sb
->s_flags
&= ~MS_NOEXEC
;
232 * The nbmand mount option can be changed at mount time.
233 * We can't allow it to be toggled on live file systems or incorrect
234 * behavior may be seen from cifs clients
236 * This property isn't registered via dsl_prop_register(), but this callback
237 * will be called when a file system is first mounted
240 nbmand_changed_cb(void *arg
, uint64_t newval
)
243 struct super_block
*sb
= zsb
->z_sb
;
245 if (newval
== TRUE
) {
246 sb
->s_flags
|= MS_MANDLOCK
;
248 sb
->s_flags
&= ~MS_MANDLOCK
;
253 snapdir_changed_cb(void *arg
, uint64_t newval
)
255 ((zfs_sb_t
*)arg
)->z_show_ctldir
= newval
;
259 vscan_changed_cb(void *arg
, uint64_t newval
)
261 ((zfs_sb_t
*)arg
)->z_vscan
= newval
;
265 acl_inherit_changed_cb(void *arg
, uint64_t newval
)
267 ((zfs_sb_t
*)arg
)->z_acl_inherit
= newval
;
271 zfs_register_callbacks(zfs_sb_t
*zsb
)
273 struct vfsmount
*vfsp
= zsb
->z_vfs
;
274 struct dsl_dataset
*ds
= NULL
;
275 objset_t
*os
= zsb
->z_os
;
277 boolean_t readonly
= B_FALSE
;
278 boolean_t setuid
= B_TRUE
;
279 boolean_t exec
= B_TRUE
;
280 boolean_t devices
= B_TRUE
;
281 boolean_t xattr
= B_TRUE
;
282 boolean_t atime
= B_TRUE
;
283 char osname
[MAXNAMELEN
];
287 * While Linux allows multiple vfs mounts per super block we have
288 * limited it artificially to one in zfs_fill_super. Thus it is
289 * safe for us to modify the vfs mount fails through the callbacks.
291 if ((vfsp
->mnt_flags
& MNT_READONLY
) ||
292 !spa_writeable(dmu_objset_spa(os
)))
295 if (vfsp
->mnt_flags
& MNT_NOSUID
) {
299 if (vfsp
->mnt_flags
& MNT_NODEV
)
303 if (vfsp
->mnt_flags
& MNT_NOEXEC
)
306 if (vfsp
->mnt_flags
& MNT_NOATIME
)
310 * nbmand is a special property which may only be changed at
311 * mount time. Unfortunately, Linux does not have a VFS mount
312 * flag instead this is a super block flag. So setting this
313 * option at mount time will have to wait until we can parse
314 * the mount option string. For now we rely on the nbmand
315 * value stored with the object set. Additional mount option
316 * string to be handled:
318 * case: sensitive|insensitive|mixed
322 dmu_objset_name(os
, osname
);
323 if ((error
= dsl_prop_get_integer(osname
, "nbmand", &nbmand
, NULL
)))
327 * Register property callbacks.
329 * It would probably be fine to just check for i/o error from
330 * the first prop_register(), but I guess I like to go
333 ds
= dmu_objset_ds(os
);
334 error
= dsl_prop_register(ds
,
335 "atime", atime_changed_cb
, zsb
);
336 error
= error
? error
: dsl_prop_register(ds
,
337 "xattr", xattr_changed_cb
, zsb
);
338 error
= error
? error
: dsl_prop_register(ds
,
339 "recordsize", blksz_changed_cb
, zsb
);
340 error
= error
? error
: dsl_prop_register(ds
,
341 "readonly", readonly_changed_cb
, zsb
);
342 error
= error
? error
: dsl_prop_register(ds
,
343 "devices", devices_changed_cb
, zsb
);
344 error
= error
? error
: dsl_prop_register(ds
,
345 "setuid", setuid_changed_cb
, zsb
);
346 error
= error
? error
: dsl_prop_register(ds
,
347 "exec", exec_changed_cb
, zsb
);
348 error
= error
? error
: dsl_prop_register(ds
,
349 "snapdir", snapdir_changed_cb
, zsb
);
350 error
= error
? error
: dsl_prop_register(ds
,
351 "aclinherit", acl_inherit_changed_cb
, zsb
);
352 error
= error
? error
: dsl_prop_register(ds
,
353 "vscan", vscan_changed_cb
, zsb
);
358 * Invoke our callbacks to set required flags.
360 readonly_changed_cb(zsb
, readonly
);
361 setuid_changed_cb(zsb
, setuid
);
362 exec_changed_cb(zsb
, exec
);
363 devices_changed_cb(zsb
, devices
);
364 xattr_changed_cb(zsb
, xattr
);
365 atime_changed_cb(zsb
, atime
);
366 nbmand_changed_cb(zsb
, nbmand
);
372 * We may attempt to unregister some callbacks that are not
373 * registered, but this is OK; it will simply return ENOMSG,
374 * which we will ignore.
376 (void) dsl_prop_unregister(ds
, "atime", atime_changed_cb
, zsb
);
377 (void) dsl_prop_unregister(ds
, "xattr", xattr_changed_cb
, zsb
);
378 (void) dsl_prop_unregister(ds
, "recordsize", blksz_changed_cb
, zsb
);
379 (void) dsl_prop_unregister(ds
, "readonly", readonly_changed_cb
, zsb
);
380 (void) dsl_prop_unregister(ds
, "devices", devices_changed_cb
, zsb
);
381 (void) dsl_prop_unregister(ds
, "setuid", setuid_changed_cb
, zsb
);
382 (void) dsl_prop_unregister(ds
, "exec", exec_changed_cb
, zsb
);
383 (void) dsl_prop_unregister(ds
, "snapdir", snapdir_changed_cb
, zsb
);
384 (void) dsl_prop_unregister(ds
, "aclinherit", acl_inherit_changed_cb
,
386 (void) dsl_prop_unregister(ds
, "vscan", vscan_changed_cb
, zsb
);
390 EXPORT_SYMBOL(zfs_register_callbacks
);
393 zfs_space_delta_cb(dmu_object_type_t bonustype
, void *data
,
394 uint64_t *userp
, uint64_t *groupp
)
396 znode_phys_t
*znp
= data
;
400 * Is it a valid type of object to track?
402 if (bonustype
!= DMU_OT_ZNODE
&& bonustype
!= DMU_OT_SA
)
406 * If we have a NULL data pointer
407 * then assume the id's aren't changing and
408 * return EEXIST to the dmu to let it know to
414 if (bonustype
== DMU_OT_ZNODE
) {
415 *userp
= znp
->zp_uid
;
416 *groupp
= znp
->zp_gid
;
420 ASSERT(bonustype
== DMU_OT_SA
);
421 hdrsize
= sa_hdrsize(data
);
424 *userp
= *((uint64_t *)((uintptr_t)data
+ hdrsize
+
426 *groupp
= *((uint64_t *)((uintptr_t)data
+ hdrsize
+
430 * This should only happen for newly created
431 * files that haven't had the znode data filled
442 fuidstr_to_sid(zfs_sb_t
*zsb
, const char *fuidstr
,
443 char *domainbuf
, int buflen
, uid_t
*ridp
)
448 fuid
= strtonum(fuidstr
, NULL
);
450 domain
= zfs_fuid_find_by_idx(zsb
, FUID_INDEX(fuid
));
452 (void) strlcpy(domainbuf
, domain
, buflen
);
455 *ridp
= FUID_RID(fuid
);
459 zfs_userquota_prop_to_obj(zfs_sb_t
*zsb
, zfs_userquota_prop_t type
)
462 case ZFS_PROP_USERUSED
:
463 return (DMU_USERUSED_OBJECT
);
464 case ZFS_PROP_GROUPUSED
:
465 return (DMU_GROUPUSED_OBJECT
);
466 case ZFS_PROP_USERQUOTA
:
467 return (zsb
->z_userquota_obj
);
468 case ZFS_PROP_GROUPQUOTA
:
469 return (zsb
->z_groupquota_obj
);
477 zfs_userspace_many(zfs_sb_t
*zsb
, zfs_userquota_prop_t type
,
478 uint64_t *cookiep
, void *vbuf
, uint64_t *bufsizep
)
483 zfs_useracct_t
*buf
= vbuf
;
486 if (!dmu_objset_userspace_present(zsb
->z_os
))
489 obj
= zfs_userquota_prop_to_obj(zsb
, type
);
495 for (zap_cursor_init_serialized(&zc
, zsb
->z_os
, obj
, *cookiep
);
496 (error
= zap_cursor_retrieve(&zc
, &za
)) == 0;
497 zap_cursor_advance(&zc
)) {
498 if ((uintptr_t)buf
- (uintptr_t)vbuf
+ sizeof (zfs_useracct_t
) >
502 fuidstr_to_sid(zsb
, za
.za_name
,
503 buf
->zu_domain
, sizeof (buf
->zu_domain
), &buf
->zu_rid
);
505 buf
->zu_space
= za
.za_first_integer
;
511 ASSERT3U((uintptr_t)buf
- (uintptr_t)vbuf
, <=, *bufsizep
);
512 *bufsizep
= (uintptr_t)buf
- (uintptr_t)vbuf
;
513 *cookiep
= zap_cursor_serialize(&zc
);
514 zap_cursor_fini(&zc
);
517 EXPORT_SYMBOL(zfs_userspace_many
);
520 * buf must be big enough (eg, 32 bytes)
523 id_to_fuidstr(zfs_sb_t
*zsb
, const char *domain
, uid_t rid
,
524 char *buf
, boolean_t addok
)
529 if (domain
&& domain
[0]) {
530 domainid
= zfs_fuid_find_by_domain(zsb
, domain
, NULL
, addok
);
534 fuid
= FUID_ENCODE(domainid
, rid
);
535 (void) sprintf(buf
, "%llx", (longlong_t
)fuid
);
540 zfs_userspace_one(zfs_sb_t
*zsb
, zfs_userquota_prop_t type
,
541 const char *domain
, uint64_t rid
, uint64_t *valp
)
549 if (!dmu_objset_userspace_present(zsb
->z_os
))
552 obj
= zfs_userquota_prop_to_obj(zsb
, type
);
556 err
= id_to_fuidstr(zsb
, domain
, rid
, buf
, B_FALSE
);
560 err
= zap_lookup(zsb
->z_os
, obj
, buf
, 8, 1, valp
);
565 EXPORT_SYMBOL(zfs_userspace_one
);
568 zfs_set_userquota(zfs_sb_t
*zsb
, zfs_userquota_prop_t type
,
569 const char *domain
, uint64_t rid
, uint64_t quota
)
575 boolean_t fuid_dirtied
;
577 if (type
!= ZFS_PROP_USERQUOTA
&& type
!= ZFS_PROP_GROUPQUOTA
)
580 if (zsb
->z_version
< ZPL_VERSION_USERSPACE
)
583 objp
= (type
== ZFS_PROP_USERQUOTA
) ? &zsb
->z_userquota_obj
:
584 &zsb
->z_groupquota_obj
;
586 err
= id_to_fuidstr(zsb
, domain
, rid
, buf
, B_TRUE
);
589 fuid_dirtied
= zsb
->z_fuid_dirty
;
591 tx
= dmu_tx_create(zsb
->z_os
);
592 dmu_tx_hold_zap(tx
, *objp
? *objp
: DMU_NEW_OBJECT
, B_TRUE
, NULL
);
594 dmu_tx_hold_zap(tx
, MASTER_NODE_OBJ
, B_TRUE
,
595 zfs_userquota_prop_prefixes
[type
]);
598 zfs_fuid_txhold(zsb
, tx
);
599 err
= dmu_tx_assign(tx
, TXG_WAIT
);
605 mutex_enter(&zsb
->z_lock
);
607 *objp
= zap_create(zsb
->z_os
, DMU_OT_USERGROUP_QUOTA
,
609 VERIFY(0 == zap_add(zsb
->z_os
, MASTER_NODE_OBJ
,
610 zfs_userquota_prop_prefixes
[type
], 8, 1, objp
, tx
));
612 mutex_exit(&zsb
->z_lock
);
615 err
= zap_remove(zsb
->z_os
, *objp
, buf
, tx
);
619 err
= zap_update(zsb
->z_os
, *objp
, buf
, 8, 1, "a
, tx
);
623 zfs_fuid_sync(zsb
, tx
);
627 EXPORT_SYMBOL(zfs_set_userquota
);
630 zfs_fuid_overquota(zfs_sb_t
*zsb
, boolean_t isgroup
, uint64_t fuid
)
633 uint64_t used
, quota
, usedobj
, quotaobj
;
636 usedobj
= isgroup
? DMU_GROUPUSED_OBJECT
: DMU_USERUSED_OBJECT
;
637 quotaobj
= isgroup
? zsb
->z_groupquota_obj
: zsb
->z_userquota_obj
;
639 if (quotaobj
== 0 || zsb
->z_replay
)
642 (void) sprintf(buf
, "%llx", (longlong_t
)fuid
);
643 err
= zap_lookup(zsb
->z_os
, quotaobj
, buf
, 8, 1, "a
);
647 err
= zap_lookup(zsb
->z_os
, usedobj
, buf
, 8, 1, &used
);
650 return (used
>= quota
);
652 EXPORT_SYMBOL(zfs_fuid_overquota
);
655 zfs_owner_overquota(zfs_sb_t
*zsb
, znode_t
*zp
, boolean_t isgroup
)
660 quotaobj
= isgroup
? zsb
->z_groupquota_obj
: zsb
->z_userquota_obj
;
662 fuid
= isgroup
? zp
->z_gid
: zp
->z_uid
;
664 if (quotaobj
== 0 || zsb
->z_replay
)
667 return (zfs_fuid_overquota(zsb
, isgroup
, fuid
));
669 EXPORT_SYMBOL(zfs_owner_overquota
);
672 zfs_sb_create(const char *osname
, zfs_sb_t
**zsbp
)
680 zsb
= kmem_zalloc(sizeof (zfs_sb_t
), KM_SLEEP
);
683 * We claim to always be readonly so we can open snapshots;
684 * other ZPL code will prevent us from writing to snapshots.
686 error
= dmu_objset_own(osname
, DMU_OST_ZFS
, B_TRUE
, zsb
, &os
);
688 kmem_free(zsb
, sizeof (zfs_sb_t
));
693 * Initialize the zfs-specific filesystem structure.
694 * Should probably make this a kmem cache, shuffle fields,
695 * and just bzero up to z_hold_mtx[].
699 zsb
->z_max_blksz
= SPA_MAXBLOCKSIZE
;
700 zsb
->z_show_ctldir
= ZFS_SNAPDIR_VISIBLE
;
703 error
= zfs_get_zplprop(os
, ZFS_PROP_VERSION
, &zsb
->z_version
);
706 } else if (zsb
->z_version
>
707 zfs_zpl_version_map(spa_version(dmu_objset_spa(os
)))) {
708 (void) printk("Can't mount a version %lld file system "
709 "on a version %lld pool\n. Pool must be upgraded to mount "
710 "this file system.", (u_longlong_t
)zsb
->z_version
,
711 (u_longlong_t
)spa_version(dmu_objset_spa(os
)));
715 if ((error
= zfs_get_zplprop(os
, ZFS_PROP_NORMALIZE
, &zval
)) != 0)
717 zsb
->z_norm
= (int)zval
;
719 if ((error
= zfs_get_zplprop(os
, ZFS_PROP_UTF8ONLY
, &zval
)) != 0)
721 zsb
->z_utf8
= (zval
!= 0);
723 if ((error
= zfs_get_zplprop(os
, ZFS_PROP_CASE
, &zval
)) != 0)
725 zsb
->z_case
= (uint_t
)zval
;
728 * Fold case on file systems that are always or sometimes case
731 if (zsb
->z_case
== ZFS_CASE_INSENSITIVE
||
732 zsb
->z_case
== ZFS_CASE_MIXED
)
733 zsb
->z_norm
|= U8_TEXTPREP_TOUPPER
;
735 zsb
->z_use_fuids
= USE_FUIDS(zsb
->z_version
, zsb
->z_os
);
736 zsb
->z_use_sa
= USE_SA(zsb
->z_version
, zsb
->z_os
);
739 /* should either have both of these objects or none */
740 error
= zap_lookup(os
, MASTER_NODE_OBJ
, ZFS_SA_ATTRS
, 8, 1,
746 * Pre SA versions file systems should never touch
747 * either the attribute registration or layout objects.
752 error
= sa_setup(os
, sa_obj
, zfs_attr_table
, ZPL_END
,
757 if (zsb
->z_version
>= ZPL_VERSION_SA
)
758 sa_register_update_callback(os
, zfs_sa_upgrade
);
760 error
= zap_lookup(os
, MASTER_NODE_OBJ
, ZFS_ROOT_OBJ
, 8, 1,
764 ASSERT(zsb
->z_root
!= 0);
766 error
= zap_lookup(os
, MASTER_NODE_OBJ
, ZFS_UNLINKED_SET
, 8, 1,
767 &zsb
->z_unlinkedobj
);
771 error
= zap_lookup(os
, MASTER_NODE_OBJ
,
772 zfs_userquota_prop_prefixes
[ZFS_PROP_USERQUOTA
],
773 8, 1, &zsb
->z_userquota_obj
);
774 if (error
&& error
!= ENOENT
)
777 error
= zap_lookup(os
, MASTER_NODE_OBJ
,
778 zfs_userquota_prop_prefixes
[ZFS_PROP_GROUPQUOTA
],
779 8, 1, &zsb
->z_groupquota_obj
);
780 if (error
&& error
!= ENOENT
)
783 error
= zap_lookup(os
, MASTER_NODE_OBJ
, ZFS_FUID_TABLES
, 8, 1,
785 if (error
&& error
!= ENOENT
)
788 error
= zap_lookup(os
, MASTER_NODE_OBJ
, ZFS_SHARES_DIR
, 8, 1,
790 if (error
&& error
!= ENOENT
)
793 mutex_init(&zsb
->z_znodes_lock
, NULL
, MUTEX_DEFAULT
, NULL
);
794 mutex_init(&zsb
->z_lock
, NULL
, MUTEX_DEFAULT
, NULL
);
795 list_create(&zsb
->z_all_znodes
, sizeof (znode_t
),
796 offsetof(znode_t
, z_link_node
));
797 rrw_init(&zsb
->z_teardown_lock
);
798 rw_init(&zsb
->z_teardown_inactive_lock
, NULL
, RW_DEFAULT
, NULL
);
799 rw_init(&zsb
->z_fuid_lock
, NULL
, RW_DEFAULT
, NULL
);
800 for (i
= 0; i
!= ZFS_OBJ_MTX_SZ
; i
++)
801 mutex_init(&zsb
->z_hold_mtx
[i
], NULL
, MUTEX_DEFAULT
, NULL
);
807 dmu_objset_disown(os
, zsb
);
809 kmem_free(zsb
, sizeof (zfs_sb_t
));
814 zfs_sb_setup(zfs_sb_t
*zsb
, boolean_t mounting
)
818 error
= zfs_register_callbacks(zsb
);
823 * Set the objset user_ptr to track its zsb.
825 mutex_enter(&zsb
->z_os
->os_user_ptr_lock
);
826 dmu_objset_set_user(zsb
->z_os
, zsb
);
827 mutex_exit(&zsb
->z_os
->os_user_ptr_lock
);
829 zsb
->z_log
= zil_open(zsb
->z_os
, zfs_get_data
);
832 * If we are not mounting (ie: online recv), then we don't
833 * have to worry about replaying the log as we blocked all
834 * operations out since we closed the ZIL.
840 * During replay we remove the read only flag to
841 * allow replays to succeed.
843 readonly
= zsb
->z_vfs
->mnt_flags
& MNT_READONLY
;
845 zsb
->z_vfs
->mnt_flags
&= ~MNT_READONLY
;
847 zfs_unlinked_drain(zsb
);
850 * Parse and replay the intent log.
852 * Because of ziltest, this must be done after
853 * zfs_unlinked_drain(). (Further note: ziltest
854 * doesn't use readonly mounts, where
855 * zfs_unlinked_drain() isn't called.) This is because
856 * ziltest causes spa_sync() to think it's committed,
857 * but actually it is not, so the intent log contains
858 * many txg's worth of changes.
860 * In particular, if object N is in the unlinked set in
861 * the last txg to actually sync, then it could be
862 * actually freed in a later txg and then reallocated
863 * in a yet later txg. This would write a "create
864 * object N" record to the intent log. Normally, this
865 * would be fine because the spa_sync() would have
866 * written out the fact that object N is free, before
867 * we could write the "create object N" intent log
870 * But when we are in ziltest mode, we advance the "open
871 * txg" without actually spa_sync()-ing the changes to
872 * disk. So we would see that object N is still
873 * allocated and in the unlinked set, and there is an
874 * intent log record saying to allocate it.
876 if (spa_writeable(dmu_objset_spa(zsb
->z_os
))) {
877 if (zil_replay_disable
) {
878 zil_destroy(zsb
->z_log
, B_FALSE
);
880 zsb
->z_replay
= B_TRUE
;
881 zil_replay(zsb
->z_os
, zsb
,
883 zsb
->z_replay
= B_FALSE
;
886 zsb
->z_vfs
->mnt_flags
|= readonly
; /* restore readonly bit */
893 zfs_sb_free(zfs_sb_t
*zsb
)
897 zfs_fuid_destroy(zsb
);
899 mutex_destroy(&zsb
->z_znodes_lock
);
900 mutex_destroy(&zsb
->z_lock
);
901 list_destroy(&zsb
->z_all_znodes
);
902 rrw_destroy(&zsb
->z_teardown_lock
);
903 rw_destroy(&zsb
->z_teardown_inactive_lock
);
904 rw_destroy(&zsb
->z_fuid_lock
);
905 for (i
= 0; i
!= ZFS_OBJ_MTX_SZ
; i
++)
906 mutex_destroy(&zsb
->z_hold_mtx
[i
]);
907 kmem_free(zsb
, sizeof (zfs_sb_t
));
911 zfs_set_fuid_feature(zfs_sb_t
*zsb
)
913 zsb
->z_use_fuids
= USE_FUIDS(zsb
->z_version
, zsb
->z_os
);
914 zsb
->z_use_sa
= USE_SA(zsb
->z_version
, zsb
->z_os
);
918 zfs_unregister_callbacks(zfs_sb_t
*zsb
)
920 objset_t
*os
= zsb
->z_os
;
921 struct dsl_dataset
*ds
;
924 * Unregister properties.
926 if (!dmu_objset_is_snapshot(os
)) {
927 ds
= dmu_objset_ds(os
);
928 VERIFY(dsl_prop_unregister(ds
, "atime", atime_changed_cb
,
931 VERIFY(dsl_prop_unregister(ds
, "xattr", xattr_changed_cb
,
934 VERIFY(dsl_prop_unregister(ds
, "recordsize", blksz_changed_cb
,
937 VERIFY(dsl_prop_unregister(ds
, "readonly", readonly_changed_cb
,
940 VERIFY(dsl_prop_unregister(ds
, "devices", devices_changed_cb
,
943 VERIFY(dsl_prop_unregister(ds
, "setuid", setuid_changed_cb
,
946 VERIFY(dsl_prop_unregister(ds
, "exec", exec_changed_cb
,
949 VERIFY(dsl_prop_unregister(ds
, "snapdir", snapdir_changed_cb
,
952 VERIFY(dsl_prop_unregister(ds
, "aclinherit",
953 acl_inherit_changed_cb
, zsb
) == 0);
955 VERIFY(dsl_prop_unregister(ds
, "vscan",
956 vscan_changed_cb
, zsb
) == 0);
959 EXPORT_SYMBOL(zfs_unregister_callbacks
);
963 * zfs_check_global_label:
964 * Check that the hex label string is appropriate for the dataset
965 * being mounted into the global_zone proper.
967 * Return an error if the hex label string is not default or
968 * admin_low/admin_high. For admin_low labels, the corresponding
969 * dataset must be readonly.
972 zfs_check_global_label(const char *dsname
, const char *hexsl
)
974 if (strcasecmp(hexsl
, ZFS_MLSLABEL_DEFAULT
) == 0)
976 if (strcasecmp(hexsl
, ADMIN_HIGH
) == 0)
978 if (strcasecmp(hexsl
, ADMIN_LOW
) == 0) {
979 /* must be readonly */
982 if (dsl_prop_get_integer(dsname
,
983 zfs_prop_to_name(ZFS_PROP_READONLY
), &rdonly
, NULL
))
985 return (rdonly
? 0 : EACCES
);
989 #endif /* HAVE_MLSLABEL */
992 zfs_statvfs(struct dentry
*dentry
, struct kstatfs
*statp
)
994 zfs_sb_t
*zsb
= dentry
->d_sb
->s_fs_info
;
995 uint64_t refdbytes
, availbytes
, usedobjs
, availobjs
;
1000 dmu_objset_space(zsb
->z_os
,
1001 &refdbytes
, &availbytes
, &usedobjs
, &availobjs
);
1004 * The underlying storage pool actually uses multiple block
1005 * size. Under Solaris frsize (fragment size) is reported as
1006 * the smallest block size we support, and bsize (block size)
1007 * as the filesystem's maximum block size. Unfortunately,
1008 * under Linux the fragment size and block size are often used
1009 * interchangeably. Thus we are forced to report both of them
1010 * as the filesystem's maximum block size.
1012 statp
->f_frsize
= zsb
->z_max_blksz
;
1013 statp
->f_bsize
= zsb
->z_max_blksz
;
1014 bshift
= fls(statp
->f_bsize
) - 1;
1017 * The following report "total" blocks of various kinds in
1018 * the file system, but reported in terms of f_bsize - the
1022 statp
->f_blocks
= (refdbytes
+ availbytes
) >> bshift
;
1023 statp
->f_bfree
= availbytes
>> bshift
;
1024 statp
->f_bavail
= statp
->f_bfree
; /* no root reservation */
1027 * statvfs() should really be called statufs(), because it assumes
1028 * static metadata. ZFS doesn't preallocate files, so the best
1029 * we can do is report the max that could possibly fit in f_files,
1030 * and that minus the number actually used in f_ffree.
1031 * For f_ffree, report the smaller of the number of object available
1032 * and the number of blocks (each object will take at least a block).
1034 statp
->f_ffree
= MIN(availobjs
, statp
->f_bfree
);
1035 statp
->f_files
= statp
->f_ffree
+ usedobjs
;
1036 statp
->f_fsid
.val
[0] = dentry
->d_sb
->s_dev
;
1037 statp
->f_fsid
.val
[1] = 0;
1038 statp
->f_type
= ZFS_SUPER_MAGIC
;
1039 statp
->f_namelen
= ZFS_MAXNAMELEN
;
1042 * We have all of 40 characters to stuff a string here.
1043 * Is there anything useful we could/should provide?
1045 bzero(statp
->f_spare
, sizeof (statp
->f_spare
));
1050 EXPORT_SYMBOL(zfs_statvfs
);
1053 zfs_root(zfs_sb_t
*zsb
, struct inode
**ipp
)
1060 error
= zfs_zget(zsb
, zsb
->z_root
, &rootzp
);
1062 *ipp
= ZTOI(rootzp
);
1067 EXPORT_SYMBOL(zfs_root
);
1070 * Teardown the zfs_sb_t::z_os.
1072 * Note, if 'unmounting' if FALSE, we return with the 'z_teardown_lock'
1073 * and 'z_teardown_inactive_lock' held.
1076 zfsvfs_teardown(zfs_sb_t
*zsb
, boolean_t unmounting
)
1080 rrw_enter(&zsb
->z_teardown_lock
, RW_WRITER
, FTAG
);
1084 * We purge the parent filesystem's super block as the
1085 * parent filesystem and all of its snapshots have their
1086 * inode's super block set to the parent's filesystem's
1087 * super block. Note, 'z_parent' is self referential
1088 * for non-snapshots.
1090 shrink_dcache_sb(zsb
->z_parent
->z_sb
);
1091 (void) spl_invalidate_inodes(zsb
->z_parent
->z_sb
, 0);
1095 * Close the zil. NB: Can't close the zil while zfs_inactive
1096 * threads are blocked as zil_close can call zfs_inactive.
1099 zil_close(zsb
->z_log
);
1103 rw_enter(&zsb
->z_teardown_inactive_lock
, RW_WRITER
);
1106 * If we are not unmounting (ie: online recv) and someone already
1107 * unmounted this file system while we were doing the switcheroo,
1108 * or a reopen of z_os failed then just bail out now.
1110 if (!unmounting
&& (zsb
->z_unmounted
|| zsb
->z_os
== NULL
)) {
1111 rw_exit(&zsb
->z_teardown_inactive_lock
);
1112 rrw_exit(&zsb
->z_teardown_lock
, FTAG
);
1117 * At this point there are no vops active, and any new vops will
1118 * fail with EIO since we have z_teardown_lock for writer (only
1119 * relavent for forced unmount).
1121 * Release all holds on dbufs.
1123 mutex_enter(&zsb
->z_znodes_lock
);
1124 for (zp
= list_head(&zsb
->z_all_znodes
); zp
!= NULL
;
1125 zp
= list_next(&zsb
->z_all_znodes
, zp
))
1127 ASSERT(atomic_read(&ZTOI(zp
)->i_count
) > 0);
1128 zfs_znode_dmu_fini(zp
);
1130 mutex_exit(&zsb
->z_znodes_lock
);
1133 * If we are unmounting, set the unmounted flag and let new vops
1134 * unblock. zfs_inactive will have the unmounted behavior, and all
1135 * other vops will fail with EIO.
1138 zsb
->z_unmounted
= B_TRUE
;
1139 rrw_exit(&zsb
->z_teardown_lock
, FTAG
);
1140 rw_exit(&zsb
->z_teardown_inactive_lock
);
1144 * z_os will be NULL if there was an error in attempting to reopen
1145 * zsb, so just return as the properties had already been
1147 * unregistered and cached data had been evicted before.
1149 if (zsb
->z_os
== NULL
)
1153 * Unregister properties.
1155 zfs_unregister_callbacks(zsb
);
1160 if (dmu_objset_is_dirty_anywhere(zsb
->z_os
))
1161 if (!(zsb
->z_vfs
->mnt_flags
& MNT_READONLY
))
1162 txg_wait_synced(dmu_objset_pool(zsb
->z_os
), 0);
1163 (void) dmu_objset_evict_dbufs(zsb
->z_os
);
1169 zfs_domount(struct super_block
*sb
, void *data
, int silent
)
1171 zpl_mount_data_t
*zmd
= data
;
1172 const char *osname
= zmd
->z_osname
;
1174 struct inode
*root_inode
;
1175 uint64_t recordsize
;
1179 * Linux allows multiple vfs mounts per super block. However, the
1180 * zfs_sb_t only contains a pointer for a single vfs mount. This
1181 * back reference in the long term could be extended to a list of
1182 * vfs mounts if a hook were added to the kernel to notify us when
1183 * a vfsmount is destroyed. Until then we must limit the number
1184 * of mounts per super block to one.
1186 if (atomic_read(&sb
->s_active
) > 1)
1189 error
= zfs_sb_create(osname
, &zsb
);
1193 if ((error
= dsl_prop_get_integer(osname
, "recordsize",
1194 &recordsize
, NULL
)))
1198 zsb
->z_vfs
= zmd
->z_vfs
;
1199 sb
->s_fs_info
= zsb
;
1200 sb
->s_magic
= ZFS_SUPER_MAGIC
;
1201 sb
->s_maxbytes
= MAX_LFS_FILESIZE
;
1202 sb
->s_time_gran
= 1;
1203 sb
->s_blocksize
= recordsize
;
1204 sb
->s_blocksize_bits
= ilog2(recordsize
);
1206 /* Set callback operations for the file system. */
1207 sb
->s_op
= &zpl_super_operations
;
1208 sb
->s_xattr
= zpl_xattr_handlers
;
1209 sb
->s_export_op
= &zpl_export_operations
;
1211 /* Set features for file system. */
1212 zfs_set_fuid_feature(zsb
);
1214 if (dmu_objset_is_snapshot(zsb
->z_os
)) {
1217 atime_changed_cb(zsb
, B_FALSE
);
1218 readonly_changed_cb(zsb
, B_TRUE
);
1219 if ((error
= dsl_prop_get_integer(osname
,"xattr",&pval
,NULL
)))
1221 xattr_changed_cb(zsb
, pval
);
1222 zsb
->z_issnap
= B_TRUE
;
1223 zsb
->z_os
->os_sync
= ZFS_SYNC_DISABLED
;
1225 mutex_enter(&zsb
->z_os
->os_user_ptr_lock
);
1226 dmu_objset_set_user(zsb
->z_os
, zsb
);
1227 mutex_exit(&zsb
->z_os
->os_user_ptr_lock
);
1229 error
= zfs_sb_setup(zsb
, B_TRUE
);
1230 #ifdef HAVE_SNAPSHOT
1231 (void) zfs_snap_create(zsb
);
1232 #endif /* HAVE_SNAPSHOT */
1235 /* Allocate a root inode for the filesystem. */
1236 error
= zfs_root(zsb
, &root_inode
);
1238 (void) zfs_umount(sb
);
1242 /* Allocate a root dentry for the filesystem */
1243 sb
->s_root
= d_alloc_root(root_inode
);
1244 if (sb
->s_root
== NULL
) {
1245 (void) zfs_umount(sb
);
1251 dmu_objset_disown(zsb
->z_os
, zsb
);
1257 EXPORT_SYMBOL(zfs_domount
);
1261 zfs_umount(struct super_block
*sb
)
1263 zfs_sb_t
*zsb
= sb
->s_fs_info
;
1266 VERIFY(zfsvfs_teardown(zsb
, B_TRUE
) == 0);
1270 * z_os will be NULL if there was an error in
1271 * attempting to reopen zsb.
1275 * Unset the objset user_ptr.
1277 mutex_enter(&os
->os_user_ptr_lock
);
1278 dmu_objset_set_user(os
, NULL
);
1279 mutex_exit(&os
->os_user_ptr_lock
);
1282 * Finally release the objset
1284 dmu_objset_disown(os
, zsb
);
1290 EXPORT_SYMBOL(zfs_umount
);
1293 zfs_remount(struct super_block
*sb
, int *flags
, char *data
)
1295 zfs_sb_t
*zsb
= sb
->s_fs_info
;
1296 boolean_t readonly
= B_FALSE
;
1297 boolean_t setuid
= B_TRUE
;
1298 boolean_t exec
= B_TRUE
;
1299 boolean_t devices
= B_TRUE
;
1300 boolean_t atime
= B_TRUE
;
1302 if (*flags
& MS_RDONLY
)
1305 if (*flags
& MS_NOSUID
) {
1309 if (*flags
& MS_NODEV
)
1313 if (*flags
& MS_NOEXEC
)
1316 if (*flags
& MS_NOATIME
)
1320 * Invoke our callbacks to set required flags.
1322 readonly_changed_cb(zsb
, readonly
);
1323 setuid_changed_cb(zsb
, setuid
);
1324 exec_changed_cb(zsb
, exec
);
1325 devices_changed_cb(zsb
, devices
);
1326 atime_changed_cb(zsb
, atime
);
1330 EXPORT_SYMBOL(zfs_remount
);
1333 zfs_vget(struct vfsmount
*vfsp
, struct inode
**ipp
, fid_t
*fidp
)
1335 zfs_sb_t
*zsb
= VTOZSB(vfsp
);
1337 uint64_t object
= 0;
1338 uint64_t fid_gen
= 0;
1347 if (fidp
->fid_len
== LONG_FID_LEN
) {
1348 zfid_long_t
*zlfid
= (zfid_long_t
*)fidp
;
1349 uint64_t objsetid
= 0;
1350 uint64_t setgen
= 0;
1352 for (i
= 0; i
< sizeof (zlfid
->zf_setid
); i
++)
1353 objsetid
|= ((uint64_t)zlfid
->zf_setid
[i
]) << (8 * i
);
1355 for (i
= 0; i
< sizeof (zlfid
->zf_setgen
); i
++)
1356 setgen
|= ((uint64_t)zlfid
->zf_setgen
[i
]) << (8 * i
);
1360 #ifdef HAVE_SNAPSHOT
1361 err
= zfsctl_lookup_objset(vfsp
, objsetid
, &zsb
);
1364 #endif /* HAVE_SNAPSHOT */
1368 if (fidp
->fid_len
== SHORT_FID_LEN
|| fidp
->fid_len
== LONG_FID_LEN
) {
1369 zfid_short_t
*zfid
= (zfid_short_t
*)fidp
;
1371 for (i
= 0; i
< sizeof (zfid
->zf_object
); i
++)
1372 object
|= ((uint64_t)zfid
->zf_object
[i
]) << (8 * i
);
1374 for (i
= 0; i
< sizeof (zfid
->zf_gen
); i
++)
1375 fid_gen
|= ((uint64_t)zfid
->zf_gen
[i
]) << (8 * i
);
1381 #ifdef HAVE_SNAPSHOT
1382 /* A zero fid_gen means we are in the .zfs control directories */
1384 (object
== ZFSCTL_INO_ROOT
|| object
== ZFSCTL_INO_SNAPDIR
)) {
1385 *ipp
= zsb
->z_ctldir
;
1386 ASSERT(*ipp
!= NULL
);
1387 if (object
== ZFSCTL_INO_SNAPDIR
) {
1388 VERIFY(zfsctl_root_lookup(*ipp
, "snapshot", ipp
, NULL
,
1389 0, NULL
, NULL
, NULL
, NULL
, NULL
) == 0);
1396 #endif /* HAVE_SNAPSHOT */
1398 gen_mask
= -1ULL >> (64 - 8 * i
);
1400 dprintf("getting %llu [%u mask %llx]\n", object
, fid_gen
, gen_mask
);
1401 if ((err
= zfs_zget(zsb
, object
, &zp
))) {
1405 (void) sa_lookup(zp
->z_sa_hdl
, SA_ZPL_GEN(zsb
), &zp_gen
,
1407 zp_gen
= zp_gen
& gen_mask
;
1410 if (zp
->z_unlinked
|| zp_gen
!= fid_gen
) {
1411 dprintf("znode gen (%u) != fid gen (%u)\n", zp_gen
, fid_gen
);
1419 zfs_inode_update(ITOZ(*ipp
));
1424 EXPORT_SYMBOL(zfs_vget
);
1427 * Block out VOPs and close zfs_sb_t::z_os
1429 * Note, if successful, then we return with the 'z_teardown_lock' and
1430 * 'z_teardown_inactive_lock' write held.
1433 zfs_suspend_fs(zfs_sb_t
*zsb
)
1437 if ((error
= zfsvfs_teardown(zsb
, B_FALSE
)) != 0)
1439 dmu_objset_disown(zsb
->z_os
, zsb
);
1443 EXPORT_SYMBOL(zfs_suspend_fs
);
1446 * Reopen zfs_sb_t::z_os and release VOPs.
1449 zfs_resume_fs(zfs_sb_t
*zsb
, const char *osname
)
1453 ASSERT(RRW_WRITE_HELD(&zsb
->z_teardown_lock
));
1454 ASSERT(RW_WRITE_HELD(&zsb
->z_teardown_inactive_lock
));
1456 err
= dmu_objset_own(osname
, DMU_OST_ZFS
, B_FALSE
, zsb
, &zsb
->z_os
);
1461 uint64_t sa_obj
= 0;
1463 err2
= zap_lookup(zsb
->z_os
, MASTER_NODE_OBJ
,
1464 ZFS_SA_ATTRS
, 8, 1, &sa_obj
);
1466 if ((err
|| err2
) && zsb
->z_version
>= ZPL_VERSION_SA
)
1470 if ((err
= sa_setup(zsb
->z_os
, sa_obj
,
1471 zfs_attr_table
, ZPL_END
, &zsb
->z_attr_table
)) != 0)
1474 VERIFY(zfs_sb_setup(zsb
, B_FALSE
) == 0);
1477 * Attempt to re-establish all the active znodes with
1478 * their dbufs. If a zfs_rezget() fails, then we'll let
1479 * any potential callers discover that via ZFS_ENTER_VERIFY_VP
1480 * when they try to use their znode.
1482 mutex_enter(&zsb
->z_znodes_lock
);
1483 for (zp
= list_head(&zsb
->z_all_znodes
); zp
;
1484 zp
= list_next(&zsb
->z_all_znodes
, zp
)) {
1485 (void) zfs_rezget(zp
);
1487 mutex_exit(&zsb
->z_znodes_lock
);
1492 /* release the VOPs */
1493 rw_exit(&zsb
->z_teardown_inactive_lock
);
1494 rrw_exit(&zsb
->z_teardown_lock
, FTAG
);
1498 * Since we couldn't reopen zfs_sb_t::z_os, force
1499 * unmount this file system.
1501 (void) zfs_umount(zsb
->z_sb
);
1505 EXPORT_SYMBOL(zfs_resume_fs
);
1508 zfs_set_version(zfs_sb_t
*zsb
, uint64_t newvers
)
1511 objset_t
*os
= zsb
->z_os
;
1514 if (newvers
< ZPL_VERSION_INITIAL
|| newvers
> ZPL_VERSION
)
1517 if (newvers
< zsb
->z_version
)
1520 if (zfs_spa_version_map(newvers
) >
1521 spa_version(dmu_objset_spa(zsb
->z_os
)))
1524 tx
= dmu_tx_create(os
);
1525 dmu_tx_hold_zap(tx
, MASTER_NODE_OBJ
, B_FALSE
, ZPL_VERSION_STR
);
1526 if (newvers
>= ZPL_VERSION_SA
&& !zsb
->z_use_sa
) {
1527 dmu_tx_hold_zap(tx
, MASTER_NODE_OBJ
, B_TRUE
,
1529 dmu_tx_hold_zap(tx
, DMU_NEW_OBJECT
, FALSE
, NULL
);
1531 error
= dmu_tx_assign(tx
, TXG_WAIT
);
1537 error
= zap_update(os
, MASTER_NODE_OBJ
, ZPL_VERSION_STR
,
1538 8, 1, &newvers
, tx
);
1545 if (newvers
>= ZPL_VERSION_SA
&& !zsb
->z_use_sa
) {
1548 ASSERT3U(spa_version(dmu_objset_spa(zsb
->z_os
)), >=,
1550 sa_obj
= zap_create(os
, DMU_OT_SA_MASTER_NODE
,
1551 DMU_OT_NONE
, 0, tx
);
1553 error
= zap_add(os
, MASTER_NODE_OBJ
,
1554 ZFS_SA_ATTRS
, 8, 1, &sa_obj
, tx
);
1555 ASSERT3U(error
, ==, 0);
1557 VERIFY(0 == sa_set_sa_object(os
, sa_obj
));
1558 sa_register_update_callback(os
, zfs_sa_upgrade
);
1561 spa_history_log_internal(LOG_DS_UPGRADE
,
1562 dmu_objset_spa(os
), tx
, "oldver=%llu newver=%llu dataset = %llu",
1563 zsb
->z_version
, newvers
, dmu_objset_id(os
));
1567 zsb
->z_version
= newvers
;
1569 if (zsb
->z_version
>= ZPL_VERSION_FUID
)
1570 zfs_set_fuid_feature(zsb
);
1574 EXPORT_SYMBOL(zfs_set_version
);
1577 * Read a property stored within the master node.
1580 zfs_get_zplprop(objset_t
*os
, zfs_prop_t prop
, uint64_t *value
)
1586 * Look up the file system's value for the property. For the
1587 * version property, we look up a slightly different string.
1589 if (prop
== ZFS_PROP_VERSION
)
1590 pname
= ZPL_VERSION_STR
;
1592 pname
= zfs_prop_to_name(prop
);
1595 error
= zap_lookup(os
, MASTER_NODE_OBJ
, pname
, 8, 1, value
);
1597 if (error
== ENOENT
) {
1598 /* No value set, use the default value */
1600 case ZFS_PROP_VERSION
:
1601 *value
= ZPL_VERSION
;
1603 case ZFS_PROP_NORMALIZE
:
1604 case ZFS_PROP_UTF8ONLY
:
1608 *value
= ZFS_CASE_SENSITIVE
;
1622 dmu_objset_register_type(DMU_OST_ZFS
, zfs_space_delta_cb
);
1623 register_filesystem(&zpl_fs_type
);
1629 unregister_filesystem(&zpl_fs_type
);