Date: Mon, 17 Nov 2008 20:49:30 +0000 (UTC) From: Pawel Jakub Dawidek <pjd@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r185029 - in head: cddl/compat/opensolaris/include cddl/compat/opensolaris/misc cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zfs cddl/contrib/opensolaris/cmd/zinject cd... Message-ID: <200811172049.mAHKnUDw092510@svn.freebsd.org>
next in thread | raw e-mail | index | archive | help
Author: pjd Date: Mon Nov 17 20:49:29 2008 New Revision: 185029 URL: http://svn.freebsd.org/changeset/base/185029 Log: Update ZFS from version 6 to 13 and bring some FreeBSD-specific changes. This bring huge amount of changes, I'll enumerate only user-visible changes: - Delegated Administration Allows regular users to perform ZFS operations, like file system creation, snapshot creation, etc. - L2ARC Level 2 cache for ZFS - allows to use additional disks for cache. Huge performance improvements mostly for random read of mostly static content. - slog Allow to use additional disks for ZFS Intent Log to speed up operations like fsync(2). - vfs.zfs.super_owner Allows regular users to perform privileged operations on files stored on ZFS file systems owned by him. Very careful with this one. - chflags(2) Not all the flags are supported. This still needs work. - ZFSBoot Support to boot off of ZFS pool. Not finished, AFAIK. Submitted by: dfr - Snapshot properties - New failure modes Before if write requested failed, system paniced. Now one can select from one of three failure modes: - panic - panic on write error - wait - wait for disk to reappear - continue - serve read requests if possible, block write requests - Refquota, refreservation properties Just quota and reservation properties, but don't count space consumed by children file systems, clones and snapshots. - Sparse volumes ZVOLs that don't reserve space in the pool. - External attributes Compatible with extattr(2). - NFSv4-ACLs Not sure about the status, might not be complete yet. Submitted by: trasz - Creation-time properties - Regression tests for zpool(8) command. Obtained from: OpenSolaris Added: head/cddl/compat/opensolaris/include/libshare.h (contents, props changed) head/cddl/contrib/opensolaris/cmd/zinject/ head/cddl/contrib/opensolaris/cmd/zinject/translate.c (contents, props changed) head/cddl/contrib/opensolaris/cmd/zinject/zinject.c (contents, props changed) head/cddl/contrib/opensolaris/cmd/zinject/zinject.h (contents, props changed) head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_sendrecv.c (contents, props changed) head/cddl/usr.bin/zinject/ head/cddl/usr.bin/zinject/Makefile (contents, props changed) head/sys/boot/i386/zfsboot/ head/sys/boot/i386/zfsboot/Makefile (contents, props changed) head/sys/boot/i386/zfsboot/zfsboot.c (contents, props changed) head/sys/boot/i386/zfsboot/zfsldr.S (contents, props changed) head/sys/boot/zfs/ head/sys/boot/zfs/Makefile (contents, props changed) head/sys/boot/zfs/zfs.c (contents, props changed) head/sys/boot/zfs/zfsimpl.c (contents, props changed) head/sys/cddl/boot/ head/sys/cddl/boot/zfs/ head/sys/cddl/boot/zfs/README (contents, props changed) head/sys/cddl/boot/zfs/fletcher.c (contents, props changed) head/sys/cddl/boot/zfs/lzjb.c (contents, props changed) head/sys/cddl/boot/zfs/sha256.c (contents, props changed) head/sys/cddl/boot/zfs/zfsimpl.h (contents, props changed) head/sys/cddl/boot/zfs/zfssubr.c (contents, props changed) head/sys/cddl/compat/opensolaris/kern/opensolaris_lookup.c (contents, props changed) head/sys/cddl/compat/opensolaris/sys/file.h (contents, props changed) head/sys/cddl/compat/opensolaris/sys/kidmap.h (contents, props changed) head/sys/cddl/compat/opensolaris/sys/pathname.h (contents, props changed) head/sys/cddl/compat/opensolaris/sys/refstr.h (contents, props changed) head/sys/cddl/compat/opensolaris/sys/sid.h (contents, props changed) head/sys/cddl/compat/opensolaris/sys/sig.h (contents, props changed) head/sys/cddl/contrib/opensolaris/common/unicode/ head/sys/cddl/contrib/opensolaris/common/unicode/u8_textprep.c (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.c (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zfs_comutil.h (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.c (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zfs_deleg.h (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zpool_prop.c (contents, props changed) head/sys/cddl/contrib/opensolaris/common/zfs/zprop_common.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/vnode.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_deleg.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_scrub.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/rrwlock.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_deleg.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/rrwlock.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_boot.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_fuid.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fuid.c (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/acl.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/acl_impl.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/extdirent.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/idmap.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/ head/sys/cddl/contrib/opensolaris/uts/common/sys/sysevent/eventdefs.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/u8_textprep.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/u8_textprep_data.h (contents, props changed) head/sys/cddl/contrib/opensolaris/uts/common/sys/vnode.h (contents, props changed) head/sys/kern/kern_osd.c (contents, props changed) head/sys/sys/osd.h (contents, props changed) head/tools/regression/zfs/ head/tools/regression/zfs/LICENSE (contents, props changed) head/tools/regression/zfs/misc.sh (contents, props changed) head/tools/regression/zfs/zpool/ head/tools/regression/zfs/zpool/add/ head/tools/regression/zfs/zpool/add/cache.t (contents, props changed) head/tools/regression/zfs/zpool/add/disks.t (contents, props changed) head/tools/regression/zfs/zpool/add/doesnt_exist.t (contents, props changed) head/tools/regression/zfs/zpool/add/files.t (contents, props changed) head/tools/regression/zfs/zpool/add/log.t (contents, props changed) head/tools/regression/zfs/zpool/add/mirror.t (contents, props changed) head/tools/regression/zfs/zpool/add/option-f_inuse.t (contents, props changed) head/tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_0.t (contents, props changed) head/tools/regression/zfs/zpool/add/option-f_replication_level_mismatch_1.t (contents, props changed) head/tools/regression/zfs/zpool/add/option-f_size_mismatch.t (contents, props changed) head/tools/regression/zfs/zpool/add/option-f_type_mismatch.t (contents, props changed) head/tools/regression/zfs/zpool/add/option-n.t (contents, props changed) head/tools/regression/zfs/zpool/add/raidz1.t (contents, props changed) head/tools/regression/zfs/zpool/add/raidz2.t (contents, props changed) head/tools/regression/zfs/zpool/add/spare.t (contents, props changed) head/tools/regression/zfs/zpool/attach/ head/tools/regression/zfs/zpool/attach/log.t (contents, props changed) head/tools/regression/zfs/zpool/attach/mirror.t (contents, props changed) head/tools/regression/zfs/zpool/attach/option-f_inuse.t (contents, props changed) head/tools/regression/zfs/zpool/create/ head/tools/regression/zfs/zpool/create/already_exists.t (contents, props changed) head/tools/regression/zfs/zpool/create/automount.t (contents, props changed) head/tools/regression/zfs/zpool/create/cache.t (contents, props changed) head/tools/regression/zfs/zpool/create/disks.t (contents, props changed) head/tools/regression/zfs/zpool/create/files.t (contents, props changed) head/tools/regression/zfs/zpool/create/log.t (contents, props changed) head/tools/regression/zfs/zpool/create/mirror.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-R.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-f_inuse.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_0.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-f_replication_level_mismatch_1.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-f_size_mismatch.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-f_type_mismatch.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-m.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-n.t (contents, props changed) head/tools/regression/zfs/zpool/create/option-o.t (contents, props changed) head/tools/regression/zfs/zpool/create/raidz1.t (contents, props changed) head/tools/regression/zfs/zpool/create/raidz2.t (contents, props changed) head/tools/regression/zfs/zpool/create/spare.t (contents, props changed) head/tools/regression/zfs/zpool/offline/ head/tools/regression/zfs/zpool/offline/io.t (contents, props changed) head/tools/regression/zfs/zpool/offline/log.t (contents, props changed) head/tools/regression/zfs/zpool/offline/mirror.t (contents, props changed) head/tools/regression/zfs/zpool/offline/option-t.t (contents, props changed) head/tools/regression/zfs/zpool/offline/raidz1.t (contents, props changed) head/tools/regression/zfs/zpool/offline/raidz2.t (contents, props changed) head/tools/regression/zfs/zpool/remove/ head/tools/regression/zfs/zpool/remove/cache.t (contents, props changed) head/tools/regression/zfs/zpool/remove/spare.t (contents, props changed) head/tools/regression/zfs/zpool/replace/ head/tools/regression/zfs/zpool/replace/cache.t (contents, props changed) head/tools/regression/zfs/zpool/replace/disk.t (contents, props changed) head/tools/regression/zfs/zpool/replace/log.t (contents, props changed) head/tools/regression/zfs/zpool/replace/mirror.t (contents, props changed) head/tools/regression/zfs/zpool/replace/raidz1.t (contents, props changed) head/tools/regression/zfs/zpool/replace/raidz2.t (contents, props changed) head/tools/regression/zfs/zpool/replace/spare.t (contents, props changed) Deleted: head/sys/cddl/compat/opensolaris/sys/acl.h head/sys/cddl/compat/opensolaris/sys/callb.h Modified: head/cddl/compat/opensolaris/include/mnttab.h head/cddl/compat/opensolaris/misc/mnttab.c head/cddl/compat/opensolaris/misc/zmount.c head/cddl/compat/opensolaris/misc/zone.c head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 head/cddl/contrib/opensolaris/cmd/zdb/zdb.c head/cddl/contrib/opensolaris/cmd/zdb/zdb_il.c head/cddl/contrib/opensolaris/cmd/zfs/zfs.8 head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.c head/cddl/contrib/opensolaris/cmd/zfs/zfs_iter.h head/cddl/contrib/opensolaris/cmd/zfs/zfs_main.c head/cddl/contrib/opensolaris/cmd/zpool/zpool.8 head/cddl/contrib/opensolaris/cmd/zpool/zpool_iter.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_main.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_util.c head/cddl/contrib/opensolaris/cmd/zpool/zpool_util.h head/cddl/contrib/opensolaris/cmd/zpool/zpool_vdev.c head/cddl/contrib/opensolaris/cmd/ztest/ztest.c head/cddl/contrib/opensolaris/head/assert.h head/cddl/contrib/opensolaris/head/libintl.h head/cddl/contrib/opensolaris/head/synch.h head/cddl/contrib/opensolaris/head/thread.h head/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.c head/cddl/contrib/opensolaris/lib/libnvpair/libnvpair.h head/cddl/contrib/opensolaris/lib/libuutil/common/libuutil.h head/cddl/contrib/opensolaris/lib/libuutil/common/libuutil_common.h head/cddl/contrib/opensolaris/lib/libuutil/common/uu_alloc.c head/cddl/contrib/opensolaris/lib/libuutil/common/uu_avl.c head/cddl/contrib/opensolaris/lib/libuutil/common/uu_dprintf.c head/cddl/contrib/opensolaris/lib/libuutil/common/uu_list.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_changelist.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_dataset.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_graph.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_impl.h head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_import.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_mount.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_pool.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_status.c head/cddl/contrib/opensolaris/lib/libzfs/common/libzfs_util.c head/cddl/contrib/opensolaris/lib/libzpool/common/kernel.c head/cddl/contrib/opensolaris/lib/libzpool/common/sys/zfs_context.h head/cddl/contrib/opensolaris/lib/libzpool/common/taskq.c head/cddl/contrib/opensolaris/lib/libzpool/common/util.c head/cddl/lib/libzfs/Makefile head/cddl/lib/libzpool/Makefile head/cddl/sbin/zpool/Makefile head/cddl/usr.bin/Makefile head/cddl/usr.bin/ztest/Makefile head/cddl/usr.sbin/zdb/Makefile head/lib/libc/gen/getvfsbyname.3 head/share/man/man9/VFS_SET.9 head/sys/boot/Makefile head/sys/boot/common/bootstrap.h head/sys/boot/i386/Makefile head/sys/boot/i386/libi386/bootinfo32.c head/sys/boot/i386/libi386/devicename.c head/sys/boot/i386/loader/Makefile head/sys/boot/i386/loader/conf.c head/sys/boot/i386/loader/main.c head/sys/cddl/compat/opensolaris/kern/opensolaris_atomic.c head/sys/cddl/compat/opensolaris/kern/opensolaris_kmem.c head/sys/cddl/compat/opensolaris/kern/opensolaris_misc.c head/sys/cddl/compat/opensolaris/kern/opensolaris_policy.c head/sys/cddl/compat/opensolaris/kern/opensolaris_vfs.c head/sys/cddl/compat/opensolaris/kern/opensolaris_zone.c head/sys/cddl/compat/opensolaris/sys/atomic.h head/sys/cddl/compat/opensolaris/sys/cred.h head/sys/cddl/compat/opensolaris/sys/dnlc.h head/sys/cddl/compat/opensolaris/sys/kmem.h head/sys/cddl/compat/opensolaris/sys/misc.h head/sys/cddl/compat/opensolaris/sys/mntent.h head/sys/cddl/compat/opensolaris/sys/param.h head/sys/cddl/compat/opensolaris/sys/policy.h head/sys/cddl/compat/opensolaris/sys/proc.h head/sys/cddl/compat/opensolaris/sys/sunddi.h head/sys/cddl/compat/opensolaris/sys/sysmacros.h head/sys/cddl/compat/opensolaris/sys/time.h head/sys/cddl/compat/opensolaris/sys/types.h head/sys/cddl/compat/opensolaris/sys/uio.h head/sys/cddl/compat/opensolaris/sys/vfs.h head/sys/cddl/compat/opensolaris/sys/vnode.h head/sys/cddl/compat/opensolaris/sys/zone.h head/sys/cddl/contrib/opensolaris/common/acl/acl_common.c head/sys/cddl/contrib/opensolaris/common/acl/acl_common.h head/sys/cddl/contrib/opensolaris/common/atomic/amd64/atomic.S head/sys/cddl/contrib/opensolaris/common/atomic/i386/atomic.S head/sys/cddl/contrib/opensolaris/common/avl/avl.c head/sys/cddl/contrib/opensolaris/common/nvpair/nvpair.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_namecheck.h head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.c head/sys/cddl/contrib/opensolaris/common/zfs/zfs_prop.h head/sys/cddl/contrib/opensolaris/uts/common/Makefile.files head/sys/cddl/contrib/opensolaris/uts/common/fs/gfs.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/bplist.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dbuf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_object.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_objset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_send.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_traverse.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_tx.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu_zfetch.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode_sync.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dataset.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_prop.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_synctask.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/refcount.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sha256.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_config.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_errlog.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_history.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/arc.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/bplist.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dbuf.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_objset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_traverse.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu_tx.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dnode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dataset.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_dir.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_pool.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_prop.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dsl_synctask.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/refcount.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/spa_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/txg_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/uberblock_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/unique.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_disk.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zap_leaf.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_acl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_context.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ctldir.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_dir.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_ioctl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_vfsops.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfs_znode.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zil_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_checksum.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zio_impl.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zvol.h head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/txg.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/unique.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_cache.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_disk.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_file.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_geom.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_mirror.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_missing.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_queue.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_raidz.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_root.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_leaf.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zap_micro.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_byteswap.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ctldir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_fm.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_ioctl.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_log.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_replay.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_rlock.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zil.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_checksum.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio_inject.c head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zvol.c head/sys/cddl/contrib/opensolaris/uts/common/os/callb.c head/sys/cddl/contrib/opensolaris/uts/common/os/list.c head/sys/cddl/contrib/opensolaris/uts/common/os/taskq.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.c head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr.h head/sys/cddl/contrib/opensolaris/uts/common/rpc/xdr_array.c head/sys/cddl/contrib/opensolaris/uts/common/sys/avl.h head/sys/cddl/contrib/opensolaris/uts/common/sys/byteorder.h head/sys/cddl/contrib/opensolaris/uts/common/sys/callb.h head/sys/cddl/contrib/opensolaris/uts/common/sys/cpuvar.h head/sys/cddl/contrib/opensolaris/uts/common/sys/cred.h head/sys/cddl/contrib/opensolaris/uts/common/sys/dkio.h head/sys/cddl/contrib/opensolaris/uts/common/sys/dklabel.h head/sys/cddl/contrib/opensolaris/uts/common/sys/fm/fs/zfs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/fm/protocol.h head/sys/cddl/contrib/opensolaris/uts/common/sys/fm/util.h head/sys/cddl/contrib/opensolaris/uts/common/sys/fs/zfs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/gfs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/isa_defs.h head/sys/cddl/contrib/opensolaris/uts/common/sys/list.h head/sys/cddl/contrib/opensolaris/uts/common/sys/nvpair.h head/sys/cddl/contrib/opensolaris/uts/common/sys/processor.h head/sys/cddl/contrib/opensolaris/uts/common/sys/synch.h head/sys/cddl/contrib/opensolaris/uts/common/sys/sysmacros.h head/sys/cddl/contrib/opensolaris/uts/common/zmod/zmod.c head/sys/conf/files head/sys/kern/kern_jail.c head/sys/kern/kern_proc.c head/sys/kern/kern_thread.c head/sys/kern/vfs_lookup.c head/sys/kern/vfs_subr.c head/sys/modules/zfs/Makefile head/sys/sys/conf.h head/sys/sys/jail.h head/sys/sys/mount.h head/sys/sys/namei.h head/sys/sys/priv.h head/sys/sys/proc.h head/sys/sys/vnode.h head/usr.bin/lsvfs/lsvfs.c Added: head/cddl/compat/opensolaris/include/libshare.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/cddl/compat/opensolaris/include/libshare.h Mon Nov 17 20:49:29 2008 (r185029) @@ -0,0 +1,36 @@ +/*- + * Copyright (c) 2007 Pawel Jakub Dawidek <pjd@FreeBSD.org> + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHORS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _OPENSOLARIS_LIBSHARE_H_ +#define _OPENSOLARIS_LIBSHARE_H_ + +#define SA_OK 0 + +#define SA_INIT_CONTROL_API 0 + +#endif /* !_OPENSOLARIS_LIBSHARE_H_ */ Modified: head/cddl/compat/opensolaris/include/mnttab.h ============================================================================== --- head/cddl/compat/opensolaris/include/mnttab.h Mon Nov 17 20:33:13 2008 (r185028) +++ head/cddl/compat/opensolaris/include/mnttab.h Mon Nov 17 20:49:29 2008 (r185029) @@ -9,6 +9,8 @@ #define MNTTAB _PATH_DEVNULL #define MNT_LINE_MAX 1024 +#define umount2(p, f) unmount(p, f) + struct mnttab { char *mnt_special; char *mnt_mountp; Modified: head/cddl/compat/opensolaris/misc/mnttab.c ============================================================================== --- head/cddl/compat/opensolaris/misc/mnttab.c Mon Nov 17 20:33:13 2008 (r185028) +++ head/cddl/compat/opensolaris/misc/mnttab.c Mon Nov 17 20:49:29 2008 (r185029) @@ -37,6 +37,8 @@ __FBSDID("$FreeBSD$"); #include <sys/mntent.h> #include <sys/mnttab.h> #include <stdio.h> +#include <stdlib.h> +#include <string.h> static char * mntopt(char **p) Modified: head/cddl/compat/opensolaris/misc/zmount.c ============================================================================== --- head/cddl/compat/opensolaris/misc/zmount.c Mon Nov 17 20:33:13 2008 (r185028) +++ head/cddl/compat/opensolaris/misc/zmount.c Mon Nov 17 20:49:29 2008 (r185029) @@ -35,9 +35,10 @@ __FBSDID("$FreeBSD$"); #include <sys/mount.h> #include <sys/uio.h> #include <sys/mntent.h> +#include <assert.h> #include <stdio.h> #include <stdlib.h> -#include <assert.h> +#include <string.h> static void build_iovec(struct iovec **iov, int *iovlen, const char *name, void *val, @@ -86,7 +87,7 @@ zmount(const char *spec, const char *dir assert(optlen > 0); optstr = strdup(optptr); - assert(optptr != NULL); + assert(optstr != NULL); iov = NULL; iovlen = 0; Modified: head/cddl/compat/opensolaris/misc/zone.c ============================================================================== --- head/cddl/compat/opensolaris/misc/zone.c Mon Nov 17 20:33:13 2008 (r185028) +++ head/cddl/compat/opensolaris/misc/zone.c Mon Nov 17 20:49:29 2008 (r185029) @@ -32,7 +32,7 @@ #include <sys/sysctl.h> #include <sys/zone.h> -int +zoneid_t getzoneid(void) { size_t size; @@ -42,5 +42,5 @@ getzoneid(void) size = sizeof(jailid); if (sysctlbyname("security.jail.jailed", &jailid, &size, NULL, 0) == -1) assert(!"No security.jail.jailed sysctl!"); - return (jailid); + return ((zoneid_t)jailid); } Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Mon Nov 17 20:33:13 2008 (r185028) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.8 Mon Nov 17 20:49:29 2008 (r185029) @@ -28,13 +28,17 @@ zdb \- ZFS debugger .fi .SH DESCRIPTION +.sp .LP The \fBzdb\fR command is used by support engineers to diagnose failures and gather statistics. Since the \fBZFS\fR file system is always consistent on disk and is self-repairing, \fBzdb\fR should only be run under the direction by a support engineer. +.sp .LP If no arguments are specified, \fBzdb\fR, performs basic consistency checks on the pool and associated datasets, and report any problems detected. +.sp .LP Any options supported by this command are internal to Sun and subject to change at any time. .SH EXIT STATUS +.sp .LP The following exit values are returned: .sp @@ -71,6 +75,7 @@ Invalid command line options were specif .RE .SH ATTRIBUTES +.sp .LP See \fBattributes\fR(5) for descriptions of the following attributes: .sp @@ -89,5 +94,6 @@ Interface StabilityUnstable .TE .SH SEE ALSO +.sp .LP \fBzfs\fR(1M), \fBzpool\fR(1M), \fBattributes\fR(5) Modified: head/cddl/contrib/opensolaris/cmd/zdb/zdb.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Nov 17 20:33:13 2008 (r185028) +++ head/cddl/contrib/opensolaris/cmd/zdb/zdb.c Mon Nov 17 20:49:29 2008 (r185029) @@ -19,12 +19,10 @@ * CDDL HEADER END */ /* - * Copyright 2007 Sun Microsystems, Inc. All rights reserved. + * Copyright 2008 Sun Microsystems, Inc. All rights reserved. * Use is subject to license terms. */ -#pragma ident "%Z%%M% %I% %E% SMI" - #include <stdio.h> #include <stdio_ext.h> #include <stdlib.h> @@ -51,6 +49,10 @@ #include <sys/dmu_traverse.h> #include <sys/zio_checksum.h> #include <sys/zio_compress.h> +#include <sys/zfs_fuid.h> +#undef ZFS_MAXNAMELEN +#undef verify +#include <libzfs.h> const char cmdname[] = "zdb"; uint8_t dump_opt[256]; @@ -62,6 +64,9 @@ uint64_t *zopt_object = NULL; int zopt_objects = 0; int zdb_advance = ADVANCE_PRE; zbookmark_t zdb_noread = { 0, 0, ZB_NO_LEVEL, 0 }; +libzfs_handle_t *g_zfs; +boolean_t zdb_sig_user_data = B_TRUE; +int zdb_sig_cksumalg = ZIO_CHECKSUM_SHA256; /* * These libumem hooks provide a reasonable set of defaults for the allocator's @@ -83,12 +88,15 @@ static void usage(void) { (void) fprintf(stderr, - "Usage: %s [-udibcsvLU] [-O order] [-B os:obj:level:blkid] " + "Usage: %s [-udibcsvL] [-U cachefile_path] [-O order] " + "[-B os:obj:level:blkid] [-S user:cksumalg] " "dataset [object...]\n" " %s -C [pool]\n" " %s -l dev\n" - " %s -R vdev:offset:size:flags\n", - cmdname, cmdname, cmdname, cmdname); + " %s -R pool:vdev:offset:size:flags\n" + " %s [-p path_to_vdev_dir]\n" + " %s -e pool | GUID | devid ...\n", + cmdname, cmdname, cmdname, cmdname, cmdname, cmdname); (void) fprintf(stderr, " -u uberblock\n"); (void) fprintf(stderr, " -d datasets\n"); @@ -97,16 +105,22 @@ usage(void) (void) fprintf(stderr, " -b block statistics\n"); (void) fprintf(stderr, " -c checksum all data blocks\n"); (void) fprintf(stderr, " -s report stats on zdb's I/O\n"); + (void) fprintf(stderr, " -S <user|all>:<cksum_alg|all> -- " + "dump blkptr signatures\n"); (void) fprintf(stderr, " -v verbose (applies to all others)\n"); (void) fprintf(stderr, " -l dump label contents\n"); (void) fprintf(stderr, " -L live pool (allows some errors)\n"); (void) fprintf(stderr, " -O [!]<pre|post|prune|data|holes> " "visitation order\n"); - (void) fprintf(stderr, " -U use zpool.cache in /tmp\n"); + (void) fprintf(stderr, " -U cachefile_path -- use alternate " + "cachefile\n"); (void) fprintf(stderr, " -B objset:object:level:blkid -- " "simulate bad block\n"); - (void) fprintf(stderr, " -R read and display block from a" + (void) fprintf(stderr, " -R read and display block from a " "device\n"); + (void) fprintf(stderr, " -e Pool is exported/destroyed/" + "has altroot\n"); + (void) fprintf(stderr, " -p <Path to vdev dir> (use with -e)\n"); (void) fprintf(stderr, "Specify an option more than once (e.g. -bb) " "to make only that option verbose\n"); (void) fprintf(stderr, "Default is to dump everything non-verbosely\n"); @@ -367,6 +381,44 @@ dump_zap(objset_t *os, uint64_t object, zap_cursor_fini(&zc); } +/*ARGSUSED*/ +static void +dump_zpldir(objset_t *os, uint64_t object, void *data, size_t size) +{ + zap_cursor_t zc; + zap_attribute_t attr; + const char *typenames[] = { + /* 0 */ "not specified", + /* 1 */ "FIFO", + /* 2 */ "Character Device", + /* 3 */ "3 (invalid)", + /* 4 */ "Directory", + /* 5 */ "5 (invalid)", + /* 6 */ "Block Device", + /* 7 */ "7 (invalid)", + /* 8 */ "Regular File", + /* 9 */ "9 (invalid)", + /* 10 */ "Symbolic Link", + /* 11 */ "11 (invalid)", + /* 12 */ "Socket", + /* 13 */ "Door", + /* 14 */ "Event Port", + /* 15 */ "15 (invalid)", + }; + + dump_zap_stats(os, object); + (void) printf("\n"); + + for (zap_cursor_init(&zc, os, object); + zap_cursor_retrieve(&zc, &attr) == 0; + zap_cursor_advance(&zc)) { + (void) printf("\t\t%s = %lld (type: %s)\n", + attr.za_name, ZFS_DIRENT_OBJ(attr.za_first_integer), + typenames[ZFS_DIRENT_TYPE(attr.za_first_integer)]); + } + zap_cursor_fini(&zc); +} + static void dump_spacemap(objset_t *os, space_map_obj_t *smo, space_map_t *sm) { @@ -456,10 +508,7 @@ dump_metaslabs(spa_t *spa) for (c = 0; c < rvd->vdev_children; c++) { vd = rvd->vdev_child[c]; - spa_config_enter(spa, RW_READER, FTAG); - (void) printf("\n vdev %llu = %s\n\n", - (u_longlong_t)vd->vdev_id, vdev_description(vd)); - spa_config_exit(spa, FTAG); + (void) printf("\n vdev %llu\n\n", (u_longlong_t)vd->vdev_id); if (dump_opt['d'] <= 5) { (void) printf("\t%10s %10s %5s\n", @@ -477,7 +526,6 @@ static void dump_dtl(vdev_t *vd, int indent) { avl_tree_t *t = &vd->vdev_dtl_map.sm_root; - spa_t *spa = vd->vdev_spa; space_seg_t *ss; vdev_t *pvd; int c; @@ -485,9 +533,10 @@ dump_dtl(vdev_t *vd, int indent) if (indent == 0) (void) printf("\nDirty time logs:\n\n"); - spa_config_enter(spa, RW_READER, FTAG); - (void) printf("\t%*s%s\n", indent, "", vdev_description(vd)); - spa_config_exit(spa, FTAG); + (void) printf("\t%*s%s\n", indent, "", + vd->vdev_path ? vd->vdev_path : + vd->vdev_parent ? vd->vdev_ops->vdev_op_type : + spa_name(vd->vdev_spa)); for (ss = avl_first(t); ss; ss = AVL_NEXT(t, ss)) { /* @@ -670,36 +719,49 @@ dump_dsl_dir(objset_t *os, uint64_t obje { dsl_dir_phys_t *dd = data; time_t crtime; - char used[6], compressed[6], uncompressed[6], quota[6], resv[6]; + char nice[6]; if (dd == NULL) return; - ASSERT(size == sizeof (*dd)); + ASSERT3U(size, >=, sizeof (dsl_dir_phys_t)); crtime = dd->dd_creation_time; - nicenum(dd->dd_used_bytes, used); - nicenum(dd->dd_compressed_bytes, compressed); - nicenum(dd->dd_uncompressed_bytes, uncompressed); - nicenum(dd->dd_quota, quota); - nicenum(dd->dd_reserved, resv); - (void) printf("\t\tcreation_time = %s", ctime(&crtime)); (void) printf("\t\thead_dataset_obj = %llu\n", (u_longlong_t)dd->dd_head_dataset_obj); (void) printf("\t\tparent_dir_obj = %llu\n", (u_longlong_t)dd->dd_parent_obj); - (void) printf("\t\tclone_parent_obj = %llu\n", - (u_longlong_t)dd->dd_clone_parent_obj); + (void) printf("\t\torigin_obj = %llu\n", + (u_longlong_t)dd->dd_origin_obj); (void) printf("\t\tchild_dir_zapobj = %llu\n", (u_longlong_t)dd->dd_child_dir_zapobj); - (void) printf("\t\tused_bytes = %s\n", used); - (void) printf("\t\tcompressed_bytes = %s\n", compressed); - (void) printf("\t\tuncompressed_bytes = %s\n", uncompressed); - (void) printf("\t\tquota = %s\n", quota); - (void) printf("\t\treserved = %s\n", resv); + nicenum(dd->dd_used_bytes, nice); + (void) printf("\t\tused_bytes = %s\n", nice); + nicenum(dd->dd_compressed_bytes, nice); + (void) printf("\t\tcompressed_bytes = %s\n", nice); + nicenum(dd->dd_uncompressed_bytes, nice); + (void) printf("\t\tuncompressed_bytes = %s\n", nice); + nicenum(dd->dd_quota, nice); + (void) printf("\t\tquota = %s\n", nice); + nicenum(dd->dd_reserved, nice); + (void) printf("\t\treserved = %s\n", nice); (void) printf("\t\tprops_zapobj = %llu\n", (u_longlong_t)dd->dd_props_zapobj); + (void) printf("\t\tdeleg_zapobj = %llu\n", + (u_longlong_t)dd->dd_deleg_zapobj); + (void) printf("\t\tflags = %llx\n", + (u_longlong_t)dd->dd_flags); + +#define DO(which) \ + nicenum(dd->dd_used_breakdown[DD_USED_ ## which], nice); \ + (void) printf("\t\tused_breakdown[" #which "] = %s\n", nice) + DO(HEAD); + DO(SNAP); + DO(CHILD); + DO(CHILD_RSRV); + DO(REFRSRV); +#undef DO } /*ARGSUSED*/ @@ -722,7 +784,7 @@ dump_dsl_dataset(objset_t *os, uint64_t nicenum(ds->ds_unique_bytes, unique); sprintf_blkptr(blkbuf, BP_SPRINTF_LEN, &ds->ds_bp); - (void) printf("\t\tdataset_obj = %llu\n", + (void) printf("\t\tdir_obj = %llu\n", (u_longlong_t)ds->ds_dir_obj); (void) printf("\t\tprev_snap_obj = %llu\n", (u_longlong_t)ds->ds_prev_snap_obj); @@ -749,6 +811,10 @@ dump_dsl_dataset(objset_t *os, uint64_t (u_longlong_t)ds->ds_guid); (void) printf("\t\tflags = %llx\n", (u_longlong_t)ds->ds_flags); + (void) printf("\t\tnext_clones_obj = %llu\n", + (u_longlong_t)ds->ds_next_clones_obj); + (void) printf("\t\tprops_obj = %llu\n", + (u_longlong_t)ds->ds_props_obj); (void) printf("\t\tbp = %s\n", blkbuf); } @@ -765,9 +831,11 @@ dump_bplist(objset_t *mos, uint64_t obje if (dump_opt['d'] < 3) return; + mutex_init(&bpl.bpl_lock, NULL, MUTEX_DEFAULT, NULL); VERIFY(0 == bplist_open(&bpl, mos, object)); if (bplist_empty(&bpl)) { bplist_close(&bpl); + mutex_destroy(&bpl.bpl_lock); return; } @@ -785,6 +853,7 @@ dump_bplist(objset_t *mos, uint64_t obje if (dump_opt['d'] < 5) { bplist_close(&bpl); + mutex_destroy(&bpl.bpl_lock); return; } @@ -800,6 +869,65 @@ dump_bplist(objset_t *mos, uint64_t obje } bplist_close(&bpl); + mutex_destroy(&bpl.bpl_lock); +} + +static avl_tree_t idx_tree; +static avl_tree_t domain_tree; +static boolean_t fuid_table_loaded; + +static void +fuid_table_destroy() +{ + if (fuid_table_loaded) { + zfs_fuid_table_destroy(&idx_tree, &domain_tree); + fuid_table_loaded = B_FALSE; + } +} + +/* + * print uid or gid information. + * For normal POSIX id just the id is printed in decimal format. + * For CIFS files with FUID the fuid is printed in hex followed by + * the doman-rid string. + */ +static void +print_idstr(uint64_t id, const char *id_type) +{ + if (FUID_INDEX(id)) { + char *domain; + + domain = zfs_fuid_idx_domain(&idx_tree, FUID_INDEX(id)); + (void) printf("\t%s %llx [%s-%d]\n", id_type, + (u_longlong_t)id, domain, (int)FUID_RID(id)); + } else { + (void) printf("\t%s %llu\n", id_type, (u_longlong_t)id); + } + +} + +static void +dump_uidgid(objset_t *os, znode_phys_t *zp) +{ + uint32_t uid_idx, gid_idx; + + uid_idx = FUID_INDEX(zp->zp_uid); + gid_idx = FUID_INDEX(zp->zp_gid); + + /* Load domain table, if not already loaded */ + if (!fuid_table_loaded && (uid_idx || gid_idx)) { + uint64_t fuid_obj; + + /* first find the fuid object. It lives in the master node */ + VERIFY(zap_lookup(os, MASTER_NODE_OBJ, ZFS_FUID_TABLES, + 8, 1, &fuid_obj) == 0); + (void) zfs_fuid_table_load(os, fuid_obj, + &idx_tree, &domain_tree); + fuid_table_loaded = B_TRUE; + } + + print_idstr(zp->zp_uid, "uid"); + print_idstr(zp->zp_gid, "gid"); } /*ARGSUSED*/ @@ -830,6 +958,7 @@ dump_znode(objset_t *os, uint64_t object z_ctime = (time_t)zp->zp_ctime[0]; (void) printf("\tpath %s\n", path); + dump_uidgid(os, zp); (void) printf("\tatime %s", ctime(&z_atime)); (void) printf("\tmtime %s", ctime(&z_mtime)); (void) printf("\tctime %s", ctime(&z_ctime)); @@ -874,9 +1003,9 @@ static object_viewer_t *object_viewer[DM dump_zap, /* DSL props */ dump_dsl_dataset, /* DSL dataset */ dump_znode, /* ZFS znode */ - dump_acl, /* ZFS ACL */ + dump_acl, /* ZFS V0 ACL */ dump_uint8, /* ZFS plain file */ - dump_zap, /* ZFS directory */ + dump_zpldir, /* ZFS directory */ dump_zap, /* ZFS master node */ dump_zap, /* ZFS delete queue */ dump_uint8, /* zvol object */ @@ -888,6 +1017,13 @@ static object_viewer_t *object_viewer[DM dump_uint8, /* SPA history */ dump_uint64, /* SPA history offsets */ dump_zap, /* Pool properties */ + dump_zap, /* DSL permissions */ + dump_acl, /* ZFS ACL */ + dump_uint8, /* ZFS SYSACL */ + dump_none, /* FUID nvlist */ + dump_packed_nvlist, /* FUID nvlist size */ + dump_zap, /* DSL dataset next clones */ + dump_zap, /* DSL scrub queue */ }; static void @@ -930,13 +1066,15 @@ dump_object(objset_t *os, uint64_t objec aux[0] = '\0'; - if (doi.doi_checksum != ZIO_CHECKSUM_INHERIT || verbosity >= 6) + if (doi.doi_checksum != ZIO_CHECKSUM_INHERIT || verbosity >= 6) { (void) snprintf(aux + strlen(aux), sizeof (aux), " (K=%s)", - zio_checksum_table[doi.doi_checksum].ci_name); + zio_checksum_table[doi.doi_checksum].ci_name); + } - if (doi.doi_compress != ZIO_COMPRESS_INHERIT || verbosity >= 6) + if (doi.doi_compress != ZIO_COMPRESS_INHERIT || verbosity >= 6) { (void) snprintf(aux + strlen(aux), sizeof (aux), " (Z=%s)", - zio_compress_table[doi.doi_compress].ci_name); + zio_compress_table[doi.doi_compress].ci_name); + } (void) printf("%10lld %3u %5s %5s %5s %5s %s%s\n", (u_longlong_t)object, doi.doi_indirection, iblk, dblk, lsize, @@ -972,13 +1110,13 @@ dump_object(objset_t *os, uint64_t objec } for (;;) { - error = dnode_next_offset(dn, B_FALSE, &start, minlvl, - blkfill, 0); + error = dnode_next_offset(dn, + 0, &start, minlvl, blkfill, 0); if (error) break; end = start; - error = dnode_next_offset(dn, B_TRUE, &end, minlvl, - blkfill, 0); + error = dnode_next_offset(dn, + DNODE_FIND_HOLE, &end, minlvl, blkfill, 0); nicenum(end - start, segsize); (void) printf("\t\tsegment [%016llx, %016llx)" " size %5s\n", (u_longlong_t)start, @@ -996,7 +1134,6 @@ dump_object(objset_t *os, uint64_t objec static char *objset_types[DMU_OST_NUMTYPES] = { "NONE", "META", "ZPL", "ZVOL", "OTHER", "ANY" }; -/*ARGSUSED*/ static void dump_dir(objset_t *os) { @@ -1019,8 +1156,8 @@ dump_dir(objset_t *os) if (dds.dds_type == DMU_OST_META) { dds.dds_creation_txg = TXG_INITIAL; usedobjs = os->os->os_rootbp->blk_fill; - refdbytes = - os->os->os_spa->spa_dsl_pool->dp_mos_dir->dd_used_bytes; + refdbytes = os->os->os_spa->spa_dsl_pool-> + dp_mos_dir->dd_phys->dd_used_bytes; } else { dmu_objset_space(os, &refdbytes, &scratch, &usedobjs, &scratch); } @@ -1054,6 +1191,9 @@ dump_dir(objset_t *os) if (verbosity < 2) return; + if (os->os->os_rootbp->blk_birth == 0) + return; + if (zopt_objects != 0) { for (i = 0; i < zopt_objects; i++) dump_object(os, zopt_object[i], verbosity, @@ -1115,6 +1255,52 @@ dump_config(const char *pool) } static void +dump_cachefile(const char *cachefile) +{ + int fd; + struct stat64 statbuf; + char *buf; + nvlist_t *config; + + if ((fd = open64(cachefile, O_RDONLY)) < 0) { + (void) printf("cannot open '%s': %s\n", cachefile, + strerror(errno)); + exit(1); + } + + if (fstat64(fd, &statbuf) != 0) { + (void) printf("failed to stat '%s': %s\n", cachefile, + strerror(errno)); + exit(1); + } + + if ((buf = malloc(statbuf.st_size)) == NULL) { + (void) fprintf(stderr, "failed to allocate %llu bytes\n", + (u_longlong_t)statbuf.st_size); + exit(1); + } + + if (read(fd, buf, statbuf.st_size) != statbuf.st_size) { + (void) fprintf(stderr, "failed to read %llu bytes\n", + (u_longlong_t)statbuf.st_size); + exit(1); + } + + (void) close(fd); + + if (nvlist_unpack(buf, statbuf.st_size, &config, 0) != 0) { + (void) fprintf(stderr, "failed to unpack nvlist\n"); + exit(1); + } + + free(buf); + + dump_nvlist(config, 0); + + nvlist_free(config); +} + +static void dump_label(const char *dev) { int fd; @@ -1136,15 +1322,7 @@ dump_label(const char *dev) exit(1); } - if (S_ISCHR(statbuf.st_mode)) { - if (ioctl(fd, DIOCGMEDIASIZE, &psize) != 0) { - (void) printf("failed to get size '%s': %s\n", dev, - strerror(errno)); - exit(1); - } - } else - psize = statbuf.st_size; - + psize = statbuf.st_size; psize = P2ALIGN(psize, (uint64_t)sizeof (vdev_label_t)); for (l = 0; l < VDEV_LABELS; l++) { @@ -1178,170 +1356,84 @@ dump_one_dir(char *dsname, void *arg) objset_t *os; error = dmu_objset_open(dsname, DMU_OST_ANY, - DS_MODE_STANDARD | DS_MODE_READONLY, &os); + DS_MODE_USER | DS_MODE_READONLY, &os); if (error) { (void) printf("Could not open %s\n", dsname); return (0); } dump_dir(os); dmu_objset_close(os); + fuid_table_destroy(); return (0); } static void -zdb_space_map_load(spa_t *spa) +zdb_leak(space_map_t *sm, uint64_t start, uint64_t size) { - vdev_t *rvd = spa->spa_root_vdev; - vdev_t *vd; - int c, m, error; + vdev_t *vd = sm->sm_ppd; - for (c = 0; c < rvd->vdev_children; c++) { - vd = rvd->vdev_child[c]; - for (m = 0; m < vd->vdev_ms_count; m++) { - metaslab_t *msp = vd->vdev_ms[m]; - mutex_enter(&msp->ms_lock); - error = space_map_load(&msp->ms_allocmap[0], NULL, - SM_ALLOC, &msp->ms_smo, spa->spa_meta_objset); - mutex_exit(&msp->ms_lock); - if (error) - fatal("%s bad space map #%d, error %d", - spa->spa_name, c, error); - } - } + (void) printf("leaked space: vdev %llu, offset 0x%llx, size %llu\n", + (u_longlong_t)vd->vdev_id, (u_longlong_t)start, (u_longlong_t)size); } -static int -zdb_space_map_claim(spa_t *spa, blkptr_t *bp, zbookmark_t *zb) +/* ARGSUSED */ +static void +zdb_space_map_load(space_map_t *sm) { - dva_t *dva = bp->blk_dva; - vdev_t *vd; - metaslab_t *msp; - space_map_t *allocmap, *freemap; - int error; - int d; - blkptr_t blk = *bp; - - for (d = 0; d < BP_GET_NDVAS(bp); d++) { - uint64_t vdev = DVA_GET_VDEV(&dva[d]); - uint64_t offset = DVA_GET_OFFSET(&dva[d]); - uint64_t size = DVA_GET_ASIZE(&dva[d]); - - if ((vd = vdev_lookup_top(spa, vdev)) == NULL) - return (ENXIO); - - if ((offset >> vd->vdev_ms_shift) >= vd->vdev_ms_count) - return (ENXIO); - - msp = vd->vdev_ms[offset >> vd->vdev_ms_shift]; - allocmap = &msp->ms_allocmap[0]; - freemap = &msp->ms_freemap[0]; - - /* Prepare our copy of the bp in case we need to read GBHs */ - if (DVA_GET_GANG(&dva[d])) { - size = vdev_psize_to_asize(vd, SPA_GANGBLOCKSIZE); - DVA_SET_ASIZE(&blk.blk_dva[d], size); - DVA_SET_GANG(&blk.blk_dva[d], 0); - } - - mutex_enter(&msp->ms_lock); - if (space_map_contains(freemap, offset, size)) { - mutex_exit(&msp->ms_lock); - return (EAGAIN); /* allocated more than once */ - } - - if (!space_map_contains(allocmap, offset, size)) { - mutex_exit(&msp->ms_lock); - return (ESTALE); /* not allocated at all */ - } - - space_map_remove(allocmap, offset, size); - space_map_add(freemap, offset, size); - - mutex_exit(&msp->ms_lock); - } - - if (BP_IS_GANG(bp)) { - zio_gbh_phys_t gbh; - int g; - - /* LINTED - compile time assert */ - ASSERT(sizeof (zio_gbh_phys_t) == SPA_GANGBLOCKSIZE); - - BP_SET_CHECKSUM(&blk, ZIO_CHECKSUM_GANG_HEADER); - BP_SET_PSIZE(&blk, SPA_GANGBLOCKSIZE); - BP_SET_LSIZE(&blk, SPA_GANGBLOCKSIZE); - BP_SET_COMPRESS(&blk, ZIO_COMPRESS_OFF); - error = zio_wait(zio_read(NULL, spa, &blk, &gbh, - SPA_GANGBLOCKSIZE, NULL, NULL, ZIO_PRIORITY_SYNC_READ, - ZIO_FLAG_CANFAIL | ZIO_FLAG_CONFIG_HELD, zb)); - if (error) - return (error); - if (BP_SHOULD_BYTESWAP(&blk)) - byteswap_uint64_array(&gbh, SPA_GANGBLOCKSIZE); - for (g = 0; g < SPA_GBH_NBLKPTRS; g++) { - if (BP_IS_HOLE(&gbh.zg_blkptr[g])) - break; - error = zdb_space_map_claim(spa, &gbh.zg_blkptr[g], zb); - if (error) - return (error); - } - } - - return (0); } static void -zdb_leak(space_map_t *sm, uint64_t start, uint64_t size) +zdb_space_map_unload(space_map_t *sm) { - metaslab_t *msp; - - /* LINTED */ - msp = (metaslab_t *)((char *)sm - offsetof(metaslab_t, ms_allocmap[0])); + space_map_vacate(sm, zdb_leak, sm); +} - (void) printf("leaked space: vdev %llu, offset 0x%llx, size %llu\n", - (u_longlong_t)msp->ms_group->mg_vd->vdev_id, - (u_longlong_t)start, - (u_longlong_t)size); +/* ARGSUSED */ +static void +zdb_space_map_claim(space_map_t *sm, uint64_t start, uint64_t size) +{ } +static space_map_ops_t zdb_space_map_ops = { + zdb_space_map_load, + zdb_space_map_unload, + NULL, /* alloc */ + zdb_space_map_claim, + NULL /* free */ +}; + static void -zdb_space_map_unload(spa_t *spa) +zdb_leak_init(spa_t *spa) { vdev_t *rvd = spa->spa_root_vdev; - vdev_t *vd; - int c, m; - for (c = 0; c < rvd->vdev_children; c++) { - vd = rvd->vdev_child[c]; - for (m = 0; m < vd->vdev_ms_count; m++) { + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *vd = rvd->vdev_child[c]; + for (int m = 0; m < vd->vdev_ms_count; m++) { metaslab_t *msp = vd->vdev_ms[m]; mutex_enter(&msp->ms_lock); - space_map_vacate(&msp->ms_allocmap[0], zdb_leak, - &msp->ms_allocmap[0]); - space_map_unload(&msp->ms_allocmap[0]); - space_map_vacate(&msp->ms_freemap[0], NULL, NULL); + VERIFY(space_map_load(&msp->ms_map, &zdb_space_map_ops, + SM_ALLOC, &msp->ms_smo, spa->spa_meta_objset) == 0); + msp->ms_map.sm_ppd = vd; mutex_exit(&msp->ms_lock); } } } static void -zdb_refresh_ubsync(spa_t *spa) +zdb_leak_fini(spa_t *spa) { - uberblock_t ub = { 0 }; vdev_t *rvd = spa->spa_root_vdev; - zio_t *zio; - /* - * Reload the uberblock. - */ - zio = zio_root(spa, NULL, NULL, - ZIO_FLAG_CANFAIL | ZIO_FLAG_SPECULATIVE); - vdev_uberblock_load(zio, rvd, &ub); - (void) zio_wait(zio); - - if (ub.ub_txg != 0) - spa->spa_ubsync = ub; + for (int c = 0; c < rvd->vdev_children; c++) { + vdev_t *vd = rvd->vdev_child[c]; + for (int m = 0; m < vd->vdev_ms_count; m++) { + metaslab_t *msp = vd->vdev_ms[m]; + mutex_enter(&msp->ms_lock); + space_map_unload(&msp->ms_map); + mutex_exit(&msp->ms_lock); + } + } } /* @@ -1371,9 +1463,7 @@ typedef struct zdb_cb { static void zdb_count_block(spa_t *spa, zdb_cb_t *zcb, blkptr_t *bp, int type) { - int i, error; - - for (i = 0; i < 4; i++) { + for (int i = 0; i < 4; i++) { int l = (i < 2) ? BP_GET_LEVEL(bp) : ZB_TOTAL; int t = (i & 1) ? type : DMU_OT_TOTAL; zdb_blkstats_t *zb = &zcb->zcb_type[l][t]; @@ -1384,21 +1474,34 @@ zdb_count_block(spa_t *spa, zdb_cb_t *zc zb->zb_count++; } - if (dump_opt['L']) - return; + if (dump_opt['S']) { + boolean_t print_sig; - error = zdb_space_map_claim(spa, bp, &zcb->zcb_cache->bc_bookmark); - - if (error == 0) - return; + print_sig = !zdb_sig_user_data || (BP_GET_LEVEL(bp) == 0 && + BP_GET_TYPE(bp) == DMU_OT_PLAIN_FILE_CONTENTS); - if (error == EAGAIN) - (void) fatal("double-allocation, bp=%p", bp); + if (BP_GET_CHECKSUM(bp) < zdb_sig_cksumalg) + print_sig = B_FALSE; - if (error == ESTALE) - (void) fatal("reference to freed block, bp=%p", bp); + if (print_sig) { + (void) printf("%llu\t%lld\t%lld\t%s\t%s\t%s\t" + "%llx:%llx:%llx:%llx\n", + (u_longlong_t)BP_GET_LEVEL(bp), + (longlong_t)BP_GET_PSIZE(bp), + (longlong_t)BP_GET_NDVAS(bp), + dmu_ot[BP_GET_TYPE(bp)].ot_name, + zio_checksum_table[BP_GET_CHECKSUM(bp)].ci_name, + zio_compress_table[BP_GET_COMPRESS(bp)].ci_name, + (u_longlong_t)bp->blk_cksum.zc_word[0], + (u_longlong_t)bp->blk_cksum.zc_word[1], + (u_longlong_t)bp->blk_cksum.zc_word[2], + (u_longlong_t)bp->blk_cksum.zc_word[3]); + } + } - (void) fatal("fatal error %d in bp %p", error, bp); + if (!dump_opt['L']) + VERIFY(zio_wait(zio_claim(NULL, spa, spa_first_txg(spa), bp, + NULL, NULL, ZIO_FLAG_MUSTSUCCEED)) == 0); } static int @@ -1411,9 +1514,16 @@ zdb_blkptr_cb(traverse_blk_cache_t *bc, char blkbuf[BP_SPRINTF_LEN]; int error = 0; + ASSERT(!BP_IS_HOLE(bp)); + + zdb_count_block(spa, zcb, bp, type); + if (bc->bc_errno) { if (zcb->zcb_readfails++ < 10 && dump_opt['L']) { - zdb_refresh_ubsync(spa); + uberblock_t ub; + vdev_uberblock_load(NULL, spa->spa_root_vdev, &ub); + if (ub.ub_txg != 0) + spa->spa_ubsync = ub; error = EAGAIN; } else { zcb->zcb_haderrors = 1; @@ -1426,35 +1536,32 @@ zdb_blkptr_cb(traverse_blk_cache_t *bc, else blkbuf[0] = '\0'; - (void) printf("zdb_blkptr_cb: Got error %d reading " - "<%llu, %llu, %lld, %llx> %s -- %s\n", - bc->bc_errno, - (u_longlong_t)zb->zb_objset, - (u_longlong_t)zb->zb_object, - (u_longlong_t)zb->zb_level, - (u_longlong_t)zb->zb_blkid, - blkbuf, - error == EAGAIN ? "retrying" : "skipping"); + if (!dump_opt['S']) { + (void) printf("zdb_blkptr_cb: Got error %d reading " + "<%llu, %llu, %lld, %llx> %s -- %s\n", + bc->bc_errno, + (u_longlong_t)zb->zb_objset, + (u_longlong_t)zb->zb_object, + (u_longlong_t)zb->zb_level, + (u_longlong_t)zb->zb_blkid, + blkbuf, + error == EAGAIN ? "retrying" : "skipping"); + } return (error); } zcb->zcb_readfails = 0; - ASSERT(!BP_IS_HOLE(bp)); - if (dump_opt['b'] >= 4) { sprintf_blkptr(blkbuf, BP_SPRINTF_LEN, bp); (void) printf("objset %llu object %llu offset 0x%llx %s\n", (u_longlong_t)zb->zb_objset, (u_longlong_t)zb->zb_object, (u_longlong_t)blkid2offset(bc->bc_dnode, - zb->zb_level, zb->zb_blkid), - blkbuf); + zb->zb_level, zb->zb_blkid), blkbuf); } - zdb_count_block(spa, zcb, bp, type); - return (0); } @@ -1465,32 +1572,35 @@ dump_block_stats(spa_t *spa) zdb_cb_t zcb = { 0 }; traverse_blk_cache_t dummy_cache = { 0 }; zdb_blkstats_t *zb, *tzb; - uint64_t alloc, space; + uint64_t alloc, space, logalloc; + vdev_t *rvd = spa->spa_root_vdev; int leaks = 0; int advance = zdb_advance; - int flags; - int e; + int c, e, flags; zcb.zcb_cache = &dummy_cache; - if (dump_opt['c']) + if (dump_opt['c'] || dump_opt['S']) advance |= ADVANCE_DATA; advance |= ADVANCE_PRUNE | ADVANCE_ZIL; - (void) printf("\nTraversing all blocks to %sverify" - " nothing leaked ...\n", - dump_opt['c'] ? "verify checksums and " : ""); + if (!dump_opt['S']) { + (void) printf("\nTraversing all blocks to %sverify" *** DIFF OUTPUT TRUNCATED AT 1000 LINES ***
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200811172049.mAHKnUDw092510>