From: Aron Xu Date: Mon, 18 Dec 2017 14:04:57 +0000 (+0800) Subject: New upstream version 0.7.4 X-Git-Tag: debian/0.7.9-2~24^2 X-Git-Url: https://git.proxmox.com/?p=mirror_zfs-debian.git;a=commitdiff_plain;h=41d74433d66406d7efb19bb035450a60f7f51e72 New upstream version 0.7.4 --- diff --git a/META b/META index 49117257..3f3d7dc5 100644 --- a/META +++ b/META @@ -1,7 +1,7 @@ Meta: 1 Name: zfs Branch: 1.0 -Version: 0.7.3 +Version: 0.7.4 Release: 1 Release-Tags: relext License: CDDL diff --git a/cmd/arc_summary/arc_summary.py b/cmd/arc_summary/arc_summary.py index f5aac737..93918a08 100755 --- a/cmd/arc_summary/arc_summary.py +++ b/cmd/arc_summary/arc_summary.py @@ -185,7 +185,8 @@ def get_arc_summary(Kstat): # ARC Sizing arc_size = Kstat["kstat.zfs.misc.arcstats.size"] - mru_size = Kstat["kstat.zfs.misc.arcstats.p"] + mru_size = Kstat["kstat.zfs.misc.arcstats.mru_size"] + mfu_size = Kstat["kstat.zfs.misc.arcstats.mfu_size"] target_max_size = Kstat["kstat.zfs.misc.arcstats.c_max"] target_min_size = Kstat["kstat.zfs.misc.arcstats.c_min"] target_size = Kstat["kstat.zfs.misc.arcstats.c"] @@ -230,27 +231,14 @@ def get_arc_summary(Kstat): ] output['arc_size_break'] = {} - if arc_size > target_size: - mfu_size = (arc_size - mru_size) - output['arc_size_break']['recently_used_cache_size'] = { - 'per': fPerc(mru_size, arc_size), - 'num': fBytes(mru_size), - } - output['arc_size_break']['frequently_used_cache_size'] = { - 'per': fPerc(mfu_size, arc_size), - 'num': fBytes(mfu_size), - } - - elif arc_size < target_size: - mfu_size = (target_size - mru_size) - output['arc_size_break']['recently_used_cache_size'] = { - 'per': fPerc(mru_size, target_size), - 'num': fBytes(mru_size), - } - output['arc_size_break']['frequently_used_cache_size'] = { - 'per': fPerc(mfu_size, target_size), - 'num': fBytes(mfu_size), - } + output['arc_size_break']['recently_used_cache_size'] = { + 'per': fPerc(mru_size, mru_size + mfu_size), + 'num': fBytes(mru_size), + } + output['arc_size_break']['frequently_used_cache_size'] = { + 'per': fPerc(mfu_size, mru_size + mfu_size), + 'num': fBytes(mfu_size), + } # ARC Hash Breakdown hash_chain_max = Kstat["kstat.zfs.misc.arcstats.hash_chain_max"] diff --git a/cmd/arcstat/arcstat.py b/cmd/arcstat/arcstat.py index b743fd8b..aa54ee87 100755 --- a/cmd/arcstat/arcstat.py +++ b/cmd/arcstat/arcstat.py @@ -219,6 +219,7 @@ def print_values(): sep )) sys.stdout.write("\n") + sys.stdout.flush() def print_header(): @@ -238,7 +239,7 @@ def get_terminal_lines(): data = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234') sz = struct.unpack('hh', data) return sz[0] - except: + except Exception: pass diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c index f597109d..1cfff3ad 100644 --- a/cmd/zpool/zpool_main.c +++ b/cmd/zpool/zpool_main.c @@ -2211,7 +2211,8 @@ show_import(nvlist_t *config) (void) printf(gettext(" config:\n\n")); - cb.cb_namewidth = max_width(NULL, nvroot, 0, 0, VDEV_NAME_TYPE_ID); + cb.cb_namewidth = max_width(NULL, nvroot, 0, strlen(name), + VDEV_NAME_TYPE_ID); if (cb.cb_namewidth < 10) cb.cb_namewidth = 10; @@ -3901,7 +3902,7 @@ get_namewidth(zpool_handle_t *zhp, void *data) &nvroot) == 0); unsigned int poolname_len = strlen(zpool_get_name(zhp)); if (!cb->cb_verbose) - cb->cb_namewidth = poolname_len; + cb->cb_namewidth = MAX(poolname_len, cb->cb_namewidth); else cb->cb_namewidth = MAX(poolname_len, max_width(zhp, nvroot, 0, cb->cb_namewidth, diff --git a/cmd/zpool/zpool_vdev.c b/cmd/zpool/zpool_vdev.c index 4c3793d6..97faa5f9 100644 --- a/cmd/zpool/zpool_vdev.c +++ b/cmd/zpool/zpool_vdev.c @@ -800,8 +800,11 @@ get_replication(nvlist_t *nvroot, boolean_t fatal) if (is_log) continue; - verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, - &type) == 0); + /* Ignore holes introduced by removing aux devices */ + verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &type) == 0); + if (strcmp(type, VDEV_TYPE_HOLE) == 0) + continue; + if (nvlist_lookup_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, &child, &children) != 0) { /* diff --git a/config/kernel.m4 b/config/kernel.m4 index c3ed5cf3..b759ccd3 100644 --- a/config/kernel.m4 +++ b/config/kernel.m4 @@ -532,10 +532,10 @@ AC_DEFUN([ZFS_AC_QAT], [ AC_MSG_RESULT([$qatbuild]) QAT_OBJ=${qatbuild} - AS_IF([ ! test -e "$QAT_OBJ/icp_qa_al.ko"], [ + AS_IF([ ! test -e "$QAT_OBJ/icp_qa_al.ko" && ! test -e "$QAT_OBJ/qat_api.ko"], [ AC_MSG_ERROR([ *** Please make sure the qat driver is installed then try again. - *** Failed to find icp_qa_al.ko in: + *** Failed to find icp_qa_al.ko or qat_api.ko in: $QAT_OBJ]) ]) diff --git a/configure b/configure index 448e4821..3ad40649 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.63 for zfs 0.7.3. +# Generated by GNU Autoconf 2.63 for zfs 0.7.4. # # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, # 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. @@ -743,8 +743,8 @@ SHELL=${CONFIG_SHELL-/bin/sh} # Identity of this package. PACKAGE_NAME='zfs' PACKAGE_TARNAME='zfs' -PACKAGE_VERSION='0.7.3' -PACKAGE_STRING='zfs 0.7.3' +PACKAGE_VERSION='0.7.4' +PACKAGE_STRING='zfs 0.7.4' PACKAGE_BUGREPORT='' # Factoring default headers for most tests. @@ -1599,7 +1599,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures zfs 0.7.3 to adapt to many kinds of systems. +\`configure' configures zfs 0.7.4 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1670,7 +1670,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of zfs 0.7.3:";; + short | recursive ) echo "Configuration of zfs 0.7.4:";; esac cat <<\_ACEOF @@ -1804,7 +1804,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -zfs configure 0.7.3 +zfs configure 0.7.4 generated by GNU Autoconf 2.63 Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001, @@ -1818,7 +1818,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by zfs $as_me 0.7.3, which was +It was created by zfs $as_me 0.7.4, which was generated by GNU Autoconf 2.63. Invocation command line was $ $0 $@ @@ -2976,7 +2976,7 @@ fi # Define the identity of the package. PACKAGE='zfs' - VERSION='0.7.3' + VERSION='0.7.4' cat >>confdefs.h <<_ACEOF @@ -13903,15 +13903,15 @@ fi { $as_echo "$as_me:$LINENO: result: $qatbuild" >&5 $as_echo "$qatbuild" >&6; } QAT_OBJ=${qatbuild} - if ! test -e "$QAT_OBJ/icp_qa_al.ko"; then + if ! test -e "$QAT_OBJ/icp_qa_al.ko" && ! test -e "$QAT_OBJ/qat_api.ko"; then { { $as_echo "$as_me:$LINENO: error: *** Please make sure the qat driver is installed then try again. - *** Failed to find icp_qa_al.ko in: + *** Failed to find icp_qa_al.ko or qat_api.ko in: $QAT_OBJ" >&5 $as_echo "$as_me: error: *** Please make sure the qat driver is installed then try again. - *** Failed to find icp_qa_al.ko in: + *** Failed to find icp_qa_al.ko or qat_api.ko in: $QAT_OBJ" >&2;} { (exit 1); exit 1; }; } @@ -32205,15 +32205,15 @@ fi { $as_echo "$as_me:$LINENO: result: $qatbuild" >&5 $as_echo "$qatbuild" >&6; } QAT_OBJ=${qatbuild} - if ! test -e "$QAT_OBJ/icp_qa_al.ko"; then + if ! test -e "$QAT_OBJ/icp_qa_al.ko" && ! test -e "$QAT_OBJ/qat_api.ko"; then { { $as_echo "$as_me:$LINENO: error: *** Please make sure the qat driver is installed then try again. - *** Failed to find icp_qa_al.ko in: + *** Failed to find icp_qa_al.ko or qat_api.ko in: $QAT_OBJ" >&5 $as_echo "$as_me: error: *** Please make sure the qat driver is installed then try again. - *** Failed to find icp_qa_al.ko in: + *** Failed to find icp_qa_al.ko or qat_api.ko in: $QAT_OBJ" >&2;} { (exit 1); exit 1; }; } @@ -46174,7 +46174,7 @@ exec 6>&1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by zfs $as_me 0.7.3, which was +This file was extended by zfs $as_me 0.7.4, which was generated by GNU Autoconf 2.63. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -46237,7 +46237,7 @@ Report bugs to ." _ACEOF cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_version="\\ -zfs config.status 0.7.3 +zfs config.status 0.7.4 configured by $0, generated by GNU Autoconf 2.63, with options \\"`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\" diff --git a/contrib/initramfs/hooks/zfs b/contrib/initramfs/hooks/zfs index 26aaa6e1..31db67c2 100755 --- a/contrib/initramfs/hooks/zfs +++ b/contrib/initramfs/hooks/zfs @@ -15,7 +15,8 @@ COPY_FILE_LIST="$COPY_FILE_LIST /etc/zfs/zfs-functions /etc/zfs/vdev_id.conf" COPY_FILE_LIST="$COPY_FILE_LIST /lib/udev/rules.d/69-vdev.rules" # These prerequisites are provided by the base system. -COPY_EXEC_LIST="$COPY_EXEC_LIST /bin/hostname /sbin/blkid" +COPY_EXEC_LIST="$COPY_EXEC_LIST /usr/bin/dirname /bin/hostname /sbin/blkid" +COPY_EXEC_LIST="$COPY_EXEC_LIST /usr/bin/env" # Explicitly specify all kernel modules because automatic dependency resolution # is unreliable on many systems. diff --git a/contrib/initramfs/scripts/zfs b/contrib/initramfs/scripts/zfs index 4650c964..8770a2e8 100644 --- a/contrib/initramfs/scripts/zfs +++ b/contrib/initramfs/scripts/zfs @@ -150,7 +150,7 @@ get_pools() fi fi - # Filter out any exceptions... + # Filter out any exceptions... if [ -n "$ZFS_POOL_EXCEPTIONS" ] then local found="" @@ -317,6 +317,14 @@ mount_fs() "${ZFS}" list -oname -tfilesystem -H "${fs}" > /dev/null 2>&1 [ "$?" -ne 0 ] && return 1 + # Skip filesystems with canmount=off. The root fs should not have + # canmount=off, but ignore it for backwards compatibility just in case. + if [ "$fs" != "${ZFS_BOOTFS}" ] + then + canmount=$(get_fs_value "$fs" canmount) + [ "$canmount" = "off" ] && return 0 + fi + # Need the _original_ datasets mountpoint! mountpoint=$(get_fs_value "$fs" mountpoint) if [ "$mountpoint" = "legacy" -o "$mountpoint" = "none" ]; then @@ -329,11 +337,9 @@ mount_fs() "$mountpoint" = "-" ] then if [ "$fs" != "${ZFS_BOOTFS}" ]; then - # We don't have a proper mountpoint, this - # isn't the root fs. So extract the root fs - # value from the filesystem, and we should - # (hopefully!) have a mountpoint we can use. - mountpoint="${fs##$ZFS_BOOTFS}" + # We don't have a proper mountpoint and this + # isn't the root fs. + return 0 else # Last hail-mary: Hope 'rootmnt' is set! mountpoint="" @@ -883,6 +889,24 @@ mountroot() /bin/sh fi + # Set elevator=noop on the root pool's vdevs' disks. ZFS already + # does this for wholedisk vdevs (for all pools), so this is only + # important for partitions. + "${ZPOOL}" status -L "${ZFS_RPOOL}" 2> /dev/null | + awk '/^\t / && !/(mirror|raidz)/ { + dev=$1; + sub(/[0-9]+$/, "", dev); + print dev + }' | + while read i + do + if [ -e "/sys/block/$i/queue/scheduler" ] + then + echo noop > "/sys/block/$i/queue/scheduler" + fi + done + + # ---------------------------------------------------------------- # P R E P A R E R O O T F I L E S Y S T E M @@ -925,7 +949,7 @@ mountroot() # NOTE: Mounted in the order specified in the # ZFS_INITRD_ADDITIONAL_DATASETS variable so take care! - # Go through the complete list (recursivly) of all filesystems below + # Go through the complete list (recursively) of all filesystems below # the real root dataset filesystems=$("${ZFS}" list -oname -tfilesystem -H -r "${ZFS_BOOTFS}") for fs in $filesystems $ZFS_INITRD_ADDITIONAL_DATASETS diff --git a/etc/systemd/system/Makefile.am b/etc/systemd/system/Makefile.am index b097497e..1586209c 100644 --- a/etc/systemd/system/Makefile.am +++ b/etc/systemd/system/Makefile.am @@ -7,6 +7,7 @@ systemdunit_DATA = \ zfs-import-scan.service \ zfs-mount.service \ zfs-share.service \ + zfs-import.target \ zfs.target EXTRA_DIST = \ @@ -15,6 +16,7 @@ EXTRA_DIST = \ $(top_srcdir)/etc/systemd/system/zfs-import-scan.service.in \ $(top_srcdir)/etc/systemd/system/zfs-mount.service.in \ $(top_srcdir)/etc/systemd/system/zfs-share.service.in \ + $(top_srcdir)/etc/systemd/system/zfs-import.target.in \ $(top_srcdir)/etc/systemd/system/zfs.target.in \ $(top_srcdir)/etc/systemd/system/50-zfs.preset.in diff --git a/etc/systemd/system/Makefile.in b/etc/systemd/system/Makefile.in index 5db9b12c..f6528c77 100644 --- a/etc/systemd/system/Makefile.in +++ b/etc/systemd/system/Makefile.in @@ -396,6 +396,7 @@ systemdunit_DATA = \ zfs-import-scan.service \ zfs-mount.service \ zfs-share.service \ + zfs-import.target \ zfs.target EXTRA_DIST = \ @@ -404,6 +405,7 @@ EXTRA_DIST = \ $(top_srcdir)/etc/systemd/system/zfs-import-scan.service.in \ $(top_srcdir)/etc/systemd/system/zfs-mount.service.in \ $(top_srcdir)/etc/systemd/system/zfs-share.service.in \ + $(top_srcdir)/etc/systemd/system/zfs-import.target.in \ $(top_srcdir)/etc/systemd/system/zfs.target.in \ $(top_srcdir)/etc/systemd/system/50-zfs.preset.in diff --git a/etc/systemd/system/zfs-import-cache.service.in b/etc/systemd/system/zfs-import-cache.service.in index 02184a60..9d677f8d 100644 --- a/etc/systemd/system/zfs-import-cache.service.in +++ b/etc/systemd/system/zfs-import-cache.service.in @@ -6,6 +6,7 @@ After=systemd-udev-settle.service After=cryptsetup.target After=systemd-remount-fs.service Before=dracut-mount.service +Before=zfs-import.target ConditionPathExists=@sysconfdir@/zfs/zpool.cache [Service] @@ -15,5 +16,4 @@ ExecStartPre=/sbin/modprobe zfs ExecStart=@sbindir@/zpool import -c @sysconfdir@/zfs/zpool.cache -aN [Install] -WantedBy=zfs-mount.service -WantedBy=zfs.target +WantedBy=zfs-import.target diff --git a/etc/systemd/system/zfs-import-scan.service.in b/etc/systemd/system/zfs-import-scan.service.in index 625f3a95..227f5b74 100644 --- a/etc/systemd/system/zfs-import-scan.service.in +++ b/etc/systemd/system/zfs-import-scan.service.in @@ -5,6 +5,7 @@ Requires=systemd-udev-settle.service After=systemd-udev-settle.service After=cryptsetup.target Before=dracut-mount.service +Before=zfs-import.target ConditionPathExists=!@sysconfdir@/zfs/zpool.cache [Service] @@ -14,5 +15,4 @@ ExecStartPre=/sbin/modprobe zfs ExecStart=@sbindir@/zpool import -aN -o cachefile=none [Install] -WantedBy=zfs-mount.service -WantedBy=zfs.target +WantedBy=zfs-import.target diff --git a/etc/systemd/system/zfs-import.target.in b/etc/systemd/system/zfs-import.target.in new file mode 100644 index 00000000..ef25679a --- /dev/null +++ b/etc/systemd/system/zfs-import.target.in @@ -0,0 +1,6 @@ +[Unit] +Description=ZFS pool import target + +[Install] +WantedBy=zfs-mount.service +WantedBy=zfs.target diff --git a/etc/systemd/system/zfs-mount.service.in b/etc/systemd/system/zfs-mount.service.in index 0664fd9e..728fc630 100644 --- a/etc/systemd/system/zfs-mount.service.in +++ b/etc/systemd/system/zfs-mount.service.in @@ -2,8 +2,7 @@ Description=Mount ZFS filesystems DefaultDependencies=no After=systemd-udev-settle.service -After=zfs-import-cache.service -After=zfs-import-scan.service +After=zfs-import.target After=systemd-remount-fs.service Before=local-fs.target diff --git a/include/sys/dbuf.h b/include/sys/dbuf.h index 6262f012..f3f2007d 100644 --- a/include/sys/dbuf.h +++ b/include/sys/dbuf.h @@ -348,6 +348,12 @@ boolean_t dbuf_is_metadata(dmu_buf_impl_t *db); (dbuf_is_metadata(_db) && \ ((_db)->db_objset->os_secondary_cache == ZFS_CACHE_METADATA))) +#define DNODE_LEVEL_IS_L2CACHEABLE(_dn, _level) \ + ((_dn)->dn_objset->os_secondary_cache == ZFS_CACHE_ALL || \ + (((_level) > 0 || \ + DMU_OT_IS_METADATA((_dn)->dn_handle->dnh_dnode->dn_type)) && \ + ((_dn)->dn_objset->os_secondary_cache == ZFS_CACHE_METADATA))) + #ifdef ZFS_DEBUG /* diff --git a/include/sys/spa.h b/include/sys/spa.h index de942ad2..67235871 100644 --- a/include/sys/spa.h +++ b/include/sys/spa.h @@ -876,7 +876,8 @@ extern int spa_history_get(spa_t *spa, uint64_t *offset, uint64_t *len_read, char *his_buf); extern int spa_history_log(spa_t *spa, const char *his_buf); extern int spa_history_log_nvl(spa_t *spa, nvlist_t *nvl); -extern void spa_history_log_version(spa_t *spa, const char *operation); +extern void spa_history_log_version(spa_t *spa, const char *operation, + dmu_tx_t *tx); extern void spa_history_log_internal(spa_t *spa, const char *operation, dmu_tx_t *tx, const char *fmt, ...); extern void spa_history_log_internal_ds(struct dsl_dataset *ds, const char *op, diff --git a/include/sys/sysevent/eventdefs.h b/include/sys/sysevent/eventdefs.h index fc268784..825d88a7 100644 --- a/include/sys/sysevent/eventdefs.h +++ b/include/sys/sysevent/eventdefs.h @@ -101,6 +101,7 @@ extern "C" { #define ESC_ZFS_POOL_CREATE "pool_create" #define ESC_ZFS_POOL_DESTROY "pool_destroy" #define ESC_ZFS_POOL_IMPORT "pool_import" +#define ESC_ZFS_POOL_EXPORT "pool_export" #define ESC_ZFS_VDEV_ADD "vdev_add" #define ESC_ZFS_VDEV_ATTACH "vdev_attach" #define ESC_ZFS_VDEV_CLEAR "vdev_clear" diff --git a/include/sys/zil.h b/include/sys/zil.h index 95fd324b..020a0b10 100644 --- a/include/sys/zil.h +++ b/include/sys/zil.h @@ -394,6 +394,7 @@ typedef struct itx { uint8_t itx_sync; /* synchronous transaction */ zil_callback_t itx_callback; /* Called when the itx is persistent */ void *itx_callback_data; /* User data for the callback */ + size_t itx_size; /* allocated itx structure size */ uint64_t itx_oid; /* object id */ lr_t itx_lr; /* common part of log record */ /* followed by type-specific part of lr_xx_t and its immediate data */ diff --git a/lib/libzfs/libzfs.pc b/lib/libzfs/libzfs.pc index c5190f78..3dedae48 100644 --- a/lib/libzfs/libzfs.pc +++ b/lib/libzfs/libzfs.pc @@ -5,7 +5,7 @@ includedir=${prefix}/include Name: libzfs Description: LibZFS library -Version: 0.7.3 +Version: 0.7.4 URL: http://zfsonlinux.org Requires: libzfs_core Cflags: -I${includedir}/libzfs -I${includedir}/libspl diff --git a/lib/libzfs/libzfs_core.pc b/lib/libzfs/libzfs_core.pc index 30fe3745..76068104 100644 --- a/lib/libzfs/libzfs_core.pc +++ b/lib/libzfs/libzfs_core.pc @@ -5,7 +5,7 @@ includedir=${prefix}/include Name: libzfs_core Description: LibZFS core library -Version: 0.7.3 +Version: 0.7.4 URL: http://zfsonlinux.org Cflags: -I${includedir}/libzfs -I${includedir}/libspl Libs: -L${libdir} -lzfs_core diff --git a/lib/libzfs/libzfs_pool.c b/lib/libzfs/libzfs_pool.c index 73af75f9..e00d5f51 100644 --- a/lib/libzfs/libzfs_pool.c +++ b/lib/libzfs/libzfs_pool.c @@ -3560,6 +3560,14 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv, char buf[PATH_BUF_LEN]; char tmpbuf[PATH_BUF_LEN]; + /* + * vdev_name will be "root"/"root-0" for the root vdev, but it is the + * zpool name that will be displayed to the user. + */ + verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &type) == 0); + if (zhp != NULL && strcmp(type, "root") == 0) + return (zfs_strdup(hdl, zpool_get_name(zhp))); + env = getenv("ZPOOL_VDEV_NAME_PATH"); if (env && (strtoul(env, NULL, 0) > 0 || !strncasecmp(env, "YES", 3) || !strncasecmp(env, "ON", 2))) @@ -3641,7 +3649,6 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv, /* * For a block device only use the name. */ - verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &type) == 0); if ((strcmp(type, VDEV_TYPE_DISK) == 0) && !(name_flags & VDEV_NAME_PATH)) { path = strrchr(path, '/'); @@ -3656,7 +3663,7 @@ zpool_vdev_name(libzfs_handle_t *hdl, zpool_handle_t *zhp, nvlist_t *nv, return (zfs_strip_partition(path)); } } else { - verify(nvlist_lookup_string(nv, ZPOOL_CONFIG_TYPE, &path) == 0); + path = type; /* * If it's a raidz device, we need to stick in the parity level. diff --git a/man/man5/zfs-module-parameters.5 b/man/man5/zfs-module-parameters.5 index 6e04b497..4c957029 100644 --- a/man/man5/zfs-module-parameters.5 +++ b/man/man5/zfs-module-parameters.5 @@ -12,7 +12,7 @@ .\" CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your .\" own identifying information: .\" Portions Copyright [yyyy] [name of copyright owner] -.TH ZFS-MODULE-PARAMETERS 5 "Nov 16, 2013" +.TH ZFS-MODULE-PARAMETERS 5 "Oct 28, 2017" .SH NAME zfs\-module\-parameters \- ZFS module parameters .SH DESCRIPTION @@ -486,10 +486,11 @@ Default value: \fB10\fR. \fBzfs_arc_grow_retry\fR (int) .ad .RS 12n -After a memory pressure event the ARC will wait this many seconds before trying -to resume growth +If set to a non zero value, it will replace the arc_grow_retry value with this value. +The arc_grow_retry value (default 5) is the number of seconds the ARC will wait before +trying to resume growth after a memory pressure event. .sp -Default value: \fB5\fR. +Default value: \fB0\fR. .RE .sp @@ -520,6 +521,20 @@ the ARC to shrink without memory pressure to induce shrinking. Default value: \fB0\fR. .RE +.sp +.ne 2 +.na +\fBzfs_arc_meta_adjust_restarts\fR (ulong) +.ad +.RS 12n +The number of restart passes to make while scanning the ARC attempting +the free buffers in order to stay below the \fBzfs_arc_meta_limit\fR. +This value should not need to be tuned but is available to facilitate +performance analysis. +.sp +Default value: \fB4096\fR. +.RE + .sp .ne 2 .na @@ -585,15 +600,15 @@ Default value: \fB10,000\fR. .sp .ne 2 .na -\fBzfs_arc_meta_adjust_restarts\fR (ulong) +\fBzfs_arc_meta_strategy\fR (int) .ad .RS 12n -The number of restart passes to make while scanning the ARC attempting -the free buffers in order to stay below the \fBzfs_arc_meta_limit\fR. -This value should not need to be tuned but is available to facilitate -performance analysis. +Define the strategy for ARC meta data buffer eviction (meta reclaim strategy). +A value of 0 (META_ONLY) will evict only the ARC meta data buffers. +A value of 1 (BALANCED) indicates that additional data buffers may be evicted if +that is required to in order to evict the required number of meta data buffers. .sp -Default value: \fB4096\fR. +Default value: \fB1\fR. .RE .sp @@ -602,9 +617,10 @@ Default value: \fB4096\fR. \fBzfs_arc_min\fR (ulong) .ad .RS 12n -Min arc size +Min arc size of ARC in bytes. If set to 0 then arc_c_min will default to +consuming the larger of 32M or 1/32 of total system memory. .sp -Default value: \fB100\fR. +Default value: \fB0\fR. .RE .sp @@ -661,9 +677,12 @@ Default value: \fB8\fR. \fBzfs_arc_p_min_shift\fR (int) .ad .RS 12n -arc_c shift to calc min/max arc_p +If set to a non zero value, this will update arc_p_min_shift (default 4) +with the new value. +arc_p_min_shift is used to shift of arc_c for calculating both min and max +max arc_p .sp -Default value: \fB4\fR. +Default value: \fB0\fR. .RE .sp @@ -694,9 +713,10 @@ Use \fB1\fR for yes (default) and \fB0\fR to disable. \fBzfs_arc_shrink_shift\fR (int) .ad .RS 12n -log2(fraction of arc to reclaim) +If set to a non zero value, this will update arc_shrink_shift (default 7) +with the new value. .sp -Default value: \fB5\fR. +Default value: \fB0\fR. .RE .sp @@ -1808,8 +1828,8 @@ Default value: \fB16\fR (effectively 65536). \fBzfs_vdev_cache_max\fR (int) .ad .RS 12n -Inflate reads small than this value to meet the \fBzfs_vdev_cache_bshift\fR -size. +Inflate reads smaller than this value to meet the \fBzfs_vdev_cache_bshift\fR +size (default 64k). .sp Default value: \fB16384\fR. .RE @@ -1916,7 +1936,8 @@ Default value: \fB32,768\fR. \fBzfs_vdev_scheduler\fR (charp) .ad .RS 12n -Set the Linux I/O scheduler on whole disk vdevs to this scheduler +Set the Linux I/O scheduler on whole disk vdevs to this scheduler. Valid options +are noop, cfq, bfq & deadline .sp Default value: \fBnoop\fR. .RE diff --git a/man/man8/zfs.8 b/man/man8/zfs.8 index 44180d60..48a5e6ea 100644 --- a/man/man8/zfs.8 +++ b/man/man8/zfs.8 @@ -440,7 +440,16 @@ If needed, ZFS file systems can also be managed with traditional tools If a file system's mount point is set to .Sy legacy , ZFS makes no attempt to manage the file system, and the administrator is -responsible for mounting and unmounting the file system. +responsible for mounting and unmounting the file system. Because pools must +be imported before a legacy mount can succeed, administrators should ensure +that legacy mounts are only attempted after the zpool import process +finishes at boot time. For example, on machines using systemd, the mount +option +.Pp +.Nm x-systemd.requires=zfs-import.target +.Pp +will ensure that the zfs-import completes before systemd attempts mounting +the filesystem. See systemd.mount(5) for details. .Ss Deduplication Deduplication is the process for removing redundant data at the block level, reducing the total amount of data stored. If a file system has the diff --git a/man/man8/zpool.8 b/man/man8/zpool.8 index 5814b412..328ba3dc 100644 --- a/man/man8/zpool.8 +++ b/man/man8/zpool.8 @@ -1412,7 +1412,7 @@ about pool recovery mode, see the .Fl X option, above. WARNING: This option can be extremely hazardous to the health of your pool and should only be used as a last resort. -.It Fl s +.It Fl t Used with .Sy newpool . Specifies that @@ -1950,9 +1950,10 @@ Display real paths for vdevs resolving all symbolic links. This can be used to look up the current block device name regardless of the .Pa /dev/disk/ path used to open it. -.It Fl p -Display numbers in parsable (exact) values. Time values are in -nanoseconds. +.It Fl P +Display full paths for vdevs instead of only the last component of +the path. This can be used in conjunction with the +.Fl L flag. .It Fl D Display a histogram of deduplication statistics, showing the allocated .Pq physically present on disk diff --git a/module/icp/io/aes.c b/module/icp/io/aes.c index 12d57ed7..c15931c6 100644 --- a/module/icp/io/aes.c +++ b/module/icp/io/aes.c @@ -132,16 +132,16 @@ static int aes_decrypt_atomic(crypto_provider_handle_t, crypto_session_id_t, crypto_data_t *, crypto_spi_ctx_template_t, crypto_req_handle_t); static crypto_cipher_ops_t aes_cipher_ops = { - aes_encrypt_init, - aes_encrypt, - aes_encrypt_update, - aes_encrypt_final, - aes_encrypt_atomic, - aes_decrypt_init, - aes_decrypt, - aes_decrypt_update, - aes_decrypt_final, - aes_decrypt_atomic + .encrypt_init = aes_encrypt_init, + .encrypt = aes_encrypt, + .encrypt_update = aes_encrypt_update, + .encrypt_final = aes_encrypt_final, + .encrypt_atomic = aes_encrypt_atomic, + .decrypt_init = aes_decrypt_init, + .decrypt = aes_decrypt, + .decrypt_update = aes_decrypt_update, + .decrypt_final = aes_decrypt_final, + .decrypt_atomic = aes_decrypt_atomic }; static int aes_mac_atomic(crypto_provider_handle_t, crypto_session_id_t, @@ -152,12 +152,12 @@ static int aes_mac_verify_atomic(crypto_provider_handle_t, crypto_session_id_t, crypto_spi_ctx_template_t, crypto_req_handle_t); static crypto_mac_ops_t aes_mac_ops = { - NULL, - NULL, - NULL, - NULL, - aes_mac_atomic, - aes_mac_verify_atomic + .mac_init = NULL, + .mac = NULL, + .mac_update = NULL, + .mac_final = NULL, + .mac_atomic = aes_mac_atomic, + .mac_verify_atomic = aes_mac_verify_atomic }; static int aes_create_ctx_template(crypto_provider_handle_t, @@ -166,8 +166,8 @@ static int aes_create_ctx_template(crypto_provider_handle_t, static int aes_free_context(crypto_ctx_t *); static crypto_ctx_ops_t aes_ctx_ops = { - aes_create_ctx_template, - aes_free_context + .create_ctx_template = aes_create_ctx_template, + .free_context = aes_free_context }; static crypto_ops_t aes_crypto_ops = {{{{{ diff --git a/module/icp/io/sha1_mod.c b/module/icp/io/sha1_mod.c index a278dac7..a6f4e421 100644 --- a/module/icp/io/sha1_mod.c +++ b/module/icp/io/sha1_mod.c @@ -115,12 +115,12 @@ static int sha1_digest_atomic(crypto_provider_handle_t, crypto_session_id_t, crypto_req_handle_t); static crypto_digest_ops_t sha1_digest_ops = { - sha1_digest_init, - sha1_digest, - sha1_digest_update, - NULL, - sha1_digest_final, - sha1_digest_atomic + .digest_init = sha1_digest_init, + .digest = sha1_digest, + .digest_update = sha1_digest_update, + .digest_key = NULL, + .digest_final = sha1_digest_final, + .digest_atomic = sha1_digest_atomic }; static int sha1_mac_init(crypto_ctx_t *, crypto_mechanism_t *, crypto_key_t *, @@ -136,12 +136,12 @@ static int sha1_mac_verify_atomic(crypto_provider_handle_t, crypto_session_id_t, crypto_spi_ctx_template_t, crypto_req_handle_t); static crypto_mac_ops_t sha1_mac_ops = { - sha1_mac_init, - NULL, - sha1_mac_update, - sha1_mac_final, - sha1_mac_atomic, - sha1_mac_verify_atomic + .mac_init = sha1_mac_init, + .mac = NULL, + .mac_update = sha1_mac_update, + .mac_final = sha1_mac_final, + .mac_atomic = sha1_mac_atomic, + .mac_verify_atomic = sha1_mac_verify_atomic }; static int sha1_create_ctx_template(crypto_provider_handle_t, @@ -150,8 +150,8 @@ static int sha1_create_ctx_template(crypto_provider_handle_t, static int sha1_free_context(crypto_ctx_t *); static crypto_ctx_ops_t sha1_ctx_ops = { - sha1_create_ctx_template, - sha1_free_context + .create_ctx_template = sha1_create_ctx_template, + .free_context = sha1_free_context }; static crypto_ops_t sha1_crypto_ops = {{{{{ diff --git a/module/icp/io/sha2_mod.c b/module/icp/io/sha2_mod.c index 8a3514c8..20674049 100644 --- a/module/icp/io/sha2_mod.c +++ b/module/icp/io/sha2_mod.c @@ -143,12 +143,12 @@ static int sha2_digest_atomic(crypto_provider_handle_t, crypto_session_id_t, crypto_req_handle_t); static crypto_digest_ops_t sha2_digest_ops = { - sha2_digest_init, - sha2_digest, - sha2_digest_update, - NULL, - sha2_digest_final, - sha2_digest_atomic + .digest_init = sha2_digest_init, + .digest = sha2_digest, + .digest_update = sha2_digest_update, + .digest_key = NULL, + .digest_final = sha2_digest_final, + .digest_atomic = sha2_digest_atomic }; static int sha2_mac_init(crypto_ctx_t *, crypto_mechanism_t *, crypto_key_t *, @@ -164,12 +164,12 @@ static int sha2_mac_verify_atomic(crypto_provider_handle_t, crypto_session_id_t, crypto_spi_ctx_template_t, crypto_req_handle_t); static crypto_mac_ops_t sha2_mac_ops = { - sha2_mac_init, - NULL, - sha2_mac_update, - sha2_mac_final, - sha2_mac_atomic, - sha2_mac_verify_atomic + .mac_init = sha2_mac_init, + .mac = NULL, + .mac_update = sha2_mac_update, + .mac_final = sha2_mac_final, + .mac_atomic = sha2_mac_atomic, + .mac_verify_atomic = sha2_mac_verify_atomic }; static int sha2_create_ctx_template(crypto_provider_handle_t, @@ -178,8 +178,8 @@ static int sha2_create_ctx_template(crypto_provider_handle_t, static int sha2_free_context(crypto_ctx_t *); static crypto_ctx_ops_t sha2_ctx_ops = { - sha2_create_ctx_template, - sha2_free_context + .create_ctx_template = sha2_create_ctx_template, + .free_context = sha2_free_context }; static crypto_ops_t sha2_crypto_ops = {{{{{ diff --git a/module/icp/io/skein_mod.c b/module/icp/io/skein_mod.c index 6db31c35..90e8a6a0 100644 --- a/module/icp/io/skein_mod.c +++ b/module/icp/io/skein_mod.c @@ -88,12 +88,12 @@ static int skein_digest_atomic(crypto_provider_handle_t, crypto_session_id_t, crypto_req_handle_t); static crypto_digest_ops_t skein_digest_ops = { - skein_digest_init, - skein_digest, - skein_update, - NULL, - skein_final, - skein_digest_atomic + .digest_init = skein_digest_init, + .digest = skein_digest, + .digest_update = skein_update, + .digest_key = NULL, + .digest_final = skein_final, + .digest_atomic = skein_digest_atomic }; static int skein_mac_init(crypto_ctx_t *, crypto_mechanism_t *, crypto_key_t *, @@ -103,12 +103,12 @@ static int skein_mac_atomic(crypto_provider_handle_t, crypto_session_id_t, crypto_spi_ctx_template_t, crypto_req_handle_t); static crypto_mac_ops_t skein_mac_ops = { - skein_mac_init, - NULL, - skein_update, /* using regular digest update is OK here */ - skein_final, /* using regular digest final is OK here */ - skein_mac_atomic, - NULL + .mac_init = skein_mac_init, + .mac = NULL, + .mac_update = skein_update, /* using regular digest update is OK here */ + .mac_final = skein_final, /* using regular digest final is OK here */ + .mac_atomic = skein_mac_atomic, + .mac_verify_atomic = NULL }; static int skein_create_ctx_template(crypto_provider_handle_t, @@ -117,8 +117,8 @@ static int skein_create_ctx_template(crypto_provider_handle_t, static int skein_free_context(crypto_ctx_t *); static crypto_ctx_ops_t skein_ctx_ops = { - skein_create_ctx_template, - skein_free_context + .create_ctx_template = skein_create_ctx_template, + .free_context = skein_free_context }; static crypto_ops_t skein_crypto_ops = {{{{{ diff --git a/module/icp/os/modconf.c b/module/icp/os/modconf.c index eb50767b..3743416e 100644 --- a/module/icp/os/modconf.c +++ b/module/icp/os/modconf.c @@ -36,7 +36,9 @@ static int mod_infonull(void *, struct modlinkage *, int *); * Cryptographic Modules */ struct mod_ops mod_cryptoops = { - mod_null, mod_null, mod_infonull + .modm_install = mod_null, + .modm_remove = mod_null, + .modm_info = mod_infonull }; /* diff --git a/module/nvpair/nvpair.c b/module/nvpair/nvpair.c index 2e382098..249b7c94 100644 --- a/module/nvpair/nvpair.c +++ b/module/nvpair/nvpair.c @@ -2801,11 +2801,11 @@ nvs_native_nvpair(nvstream_t *nvs, nvpair_t *nvp, size_t *size) } static const nvs_ops_t nvs_native_ops = { - nvs_native_nvlist, - nvs_native_nvpair, - nvs_native_nvp_op, - nvs_native_nvp_size, - nvs_native_nvl_fini + .nvs_nvlist = nvs_native_nvlist, + .nvs_nvpair = nvs_native_nvpair, + .nvs_nvp_op = nvs_native_nvp_op, + .nvs_nvp_size = nvs_native_nvp_size, + .nvs_nvl_fini = nvs_native_nvl_fini }; static int @@ -3288,11 +3288,11 @@ nvs_xdr_nvpair(nvstream_t *nvs, nvpair_t *nvp, size_t *size) } static const struct nvs_ops nvs_xdr_ops = { - nvs_xdr_nvlist, - nvs_xdr_nvpair, - nvs_xdr_nvp_op, - nvs_xdr_nvp_size, - nvs_xdr_nvl_fini + .nvs_nvlist = nvs_xdr_nvlist, + .nvs_nvpair = nvs_xdr_nvpair, + .nvs_nvp_op = nvs_xdr_nvp_op, + .nvs_nvp_size = nvs_xdr_nvp_size, + .nvs_nvl_fini = nvs_xdr_nvl_fini }; static int diff --git a/module/nvpair/nvpair_alloc_fixed.c b/module/nvpair/nvpair_alloc_fixed.c index e3ac1293..0d4e12b9 100644 --- a/module/nvpair/nvpair_alloc_fixed.c +++ b/module/nvpair/nvpair_alloc_fixed.c @@ -110,11 +110,11 @@ nv_fixed_reset(nv_alloc_t *nva) } const nv_alloc_ops_t nv_fixed_ops_def = { - nv_fixed_init, /* nv_ao_init() */ - NULL, /* nv_ao_fini() */ - nv_fixed_alloc, /* nv_ao_alloc() */ - nv_fixed_free, /* nv_ao_free() */ - nv_fixed_reset /* nv_ao_reset() */ + .nv_ao_init = nv_fixed_init, + .nv_ao_fini = NULL, + .nv_ao_alloc = nv_fixed_alloc, + .nv_ao_free = nv_fixed_free, + .nv_ao_reset = nv_fixed_reset }; const nv_alloc_ops_t *nv_fixed_ops = &nv_fixed_ops_def; diff --git a/module/nvpair/nvpair_alloc_spl.c b/module/nvpair/nvpair_alloc_spl.c index bc377ab6..ed8fa4d0 100644 --- a/module/nvpair/nvpair_alloc_spl.c +++ b/module/nvpair/nvpair_alloc_spl.c @@ -53,27 +53,27 @@ nv_free_spl(nv_alloc_t *nva, void *buf, size_t size) } const nv_alloc_ops_t spl_sleep_ops_def = { - NULL, /* nv_ao_init() */ - NULL, /* nv_ao_fini() */ - nv_alloc_sleep_spl, /* nv_ao_alloc() */ - nv_free_spl, /* nv_ao_free() */ - NULL /* nv_ao_reset() */ + .nv_ao_init = NULL, + .nv_ao_fini = NULL, + .nv_ao_alloc = nv_alloc_sleep_spl, + .nv_ao_free = nv_free_spl, + .nv_ao_reset = NULL }; const nv_alloc_ops_t spl_pushpage_ops_def = { - NULL, /* nv_ao_init() */ - NULL, /* nv_ao_fini() */ - nv_alloc_pushpage_spl, /* nv_ao_alloc() */ - nv_free_spl, /* nv_ao_free() */ - NULL /* nv_ao_reset() */ + .nv_ao_init = NULL, + .nv_ao_fini = NULL, + .nv_ao_alloc = nv_alloc_pushpage_spl, + .nv_ao_free = nv_free_spl, + .nv_ao_reset = NULL }; const nv_alloc_ops_t spl_nosleep_ops_def = { - NULL, /* nv_ao_init() */ - NULL, /* nv_ao_fini() */ - nv_alloc_nosleep_spl, /* nv_ao_alloc() */ - nv_free_spl, /* nv_ao_free() */ - NULL /* nv_ao_reset() */ + .nv_ao_init = NULL, + .nv_ao_fini = NULL, + .nv_ao_alloc = nv_alloc_nosleep_spl, + .nv_ao_free = nv_free_spl, + .nv_ao_reset = NULL }; nv_alloc_t nv_alloc_sleep_def = { diff --git a/module/zfs/arc.c b/module/zfs/arc.c index 48950245..2b0a78d4 100644 --- a/module/zfs/arc.c +++ b/module/zfs/arc.c @@ -6087,6 +6087,10 @@ arc_write(zio_t *pio, spa_t *spa, uint64_t txg, VERIFY3P(buf->b_data, !=, NULL); arc_hdr_set_compress(hdr, ZIO_COMPRESS_OFF); } + + if (!(zio_flags & ZIO_FLAG_RAW)) + arc_hdr_set_compress(hdr, ZIO_COMPRESS_OFF); + ASSERT(!arc_buf_is_shared(buf)); ASSERT3P(hdr->b_l1hdr.b_pabd, ==, NULL); diff --git a/module/zfs/dbuf.c b/module/zfs/dbuf.c index 62340469..60f52d29 100644 --- a/module/zfs/dbuf.c +++ b/module/zfs/dbuf.c @@ -63,7 +63,6 @@ struct dbuf_hold_impl_data { blkptr_t *dh_bp; int dh_err; dbuf_dirty_record_t *dh_dr; - arc_buf_contents_t dh_type; int dh_depth; }; @@ -2484,6 +2483,10 @@ dbuf_prefetch_indirect_done(zio_t *zio, arc_buf_t *abuf, void *private) arc_flags_t iter_aflags = ARC_FLAG_NOWAIT; zbookmark_phys_t zb; + /* flag if L2ARC eligible, l2arc_noprefetch then decides */ + if (dpa->dpa_aflags & ARC_FLAG_L2CACHE) + iter_aflags |= ARC_FLAG_L2CACHE; + ASSERT3U(dpa->dpa_curlevel, ==, BP_GET_LEVEL(bp)); SET_BOOKMARK(&zb, dpa->dpa_zb.zb_objset, @@ -2597,6 +2600,10 @@ dbuf_prefetch(dnode_t *dn, int64_t level, uint64_t blkid, zio_priority_t prio, dpa->dpa_epbs = epbs; dpa->dpa_zio = pio; + /* flag if L2ARC eligible, l2arc_noprefetch then decides */ + if (DNODE_LEVEL_IS_L2CACHEABLE(dn, level)) + dpa->dpa_aflags |= ARC_FLAG_L2CACHE; + /* * If we have the indirect just above us, no need to do the asynchronous * prefetch chain; we'll just run the last step ourselves. If we're at @@ -2612,6 +2619,10 @@ dbuf_prefetch(dnode_t *dn, int64_t level, uint64_t blkid, zio_priority_t prio, arc_flags_t iter_aflags = ARC_FLAG_NOWAIT; zbookmark_phys_t zb; + /* flag if L2ARC eligible, l2arc_noprefetch then decides */ + if (DNODE_LEVEL_IS_L2CACHEABLE(dn, level)) + iter_aflags |= ARC_FLAG_L2CACHE; + SET_BOOKMARK(&zb, ds != NULL ? ds->ds_object : DMU_META_OBJSET, dn->dn_object, curlevel, curblkid); (void) arc_read(dpa->dpa_zio, dpa->dpa_spa, @@ -2628,6 +2639,36 @@ dbuf_prefetch(dnode_t *dn, int64_t level, uint64_t blkid, zio_priority_t prio, #define DBUF_HOLD_IMPL_MAX_DEPTH 20 +/* + * Helper function for __dbuf_hold_impl() to copy a buffer. Handles + * the case of compressed and uncompressed buffers by allocating the + * new buffer, respectively, with arc_alloc_raw_buf(), + * arc_alloc_compressed_buf() or arc_alloc_buf().* + * + * NOTE: Declared noinline to avoid stack bloat in __dbuf_hold_impl(). + */ +noinline static void +dbuf_hold_copy(struct dbuf_hold_impl_data *dh) +{ + dnode_t *dn = dh->dh_dn; + dmu_buf_impl_t *db = dh->dh_db; + dbuf_dirty_record_t *dr = dh->dh_dr; + arc_buf_t *data = dr->dt.dl.dr_data; + + enum zio_compress compress_type = arc_get_compression(data); + + if (compress_type != ZIO_COMPRESS_OFF) { + dbuf_set_data(db, arc_alloc_compressed_buf( + dn->dn_objset->os_spa, db, arc_buf_size(data), + arc_buf_lsize(data), compress_type)); + } else { + dbuf_set_data(db, arc_alloc_buf(dn->dn_objset->os_spa, db, + DBUF_GET_BUFC_TYPE(db), db->db.db_size)); + } + + bcopy(data->b_data, db->db.db_data, arc_buf_size(data)); +} + /* * Returns with db_holds incremented, and db_mtx not held. * Note: dn_struct_rwlock must be held. @@ -2693,16 +2734,8 @@ __dbuf_hold_impl(struct dbuf_hold_impl_data *dh) dh->dh_dn->dn_object != DMU_META_DNODE_OBJECT && dh->dh_db->db_state == DB_CACHED && dh->dh_db->db_data_pending) { dh->dh_dr = dh->dh_db->db_data_pending; - - if (dh->dh_dr->dt.dl.dr_data == dh->dh_db->db_buf) { - dh->dh_type = DBUF_GET_BUFC_TYPE(dh->dh_db); - - dbuf_set_data(dh->dh_db, - arc_alloc_buf(dh->dh_dn->dn_objset->os_spa, - dh->dh_db, dh->dh_type, dh->dh_db->db.db_size)); - bcopy(dh->dh_dr->dt.dl.dr_data->b_data, - dh->dh_db->db.db_data, dh->dh_db->db.db_size); - } + if (dh->dh_dr->dt.dl.dr_data == dh->dh_db->db_buf) + dbuf_hold_copy(dh); } if (multilist_link_active(&dh->dh_db->db_cache_link)) { @@ -2775,7 +2808,6 @@ __dbuf_hold_impl_init(struct dbuf_hold_impl_data *dh, dh->dh_bp = NULL; dh->dh_err = 0; dh->dh_dr = NULL; - dh->dh_type = 0; dh->dh_depth = depth; } diff --git a/module/zfs/dmu.c b/module/zfs/dmu.c index 44705006..6f09aa2f 100644 --- a/module/zfs/dmu.c +++ b/module/zfs/dmu.c @@ -2043,12 +2043,10 @@ dmu_offset_next(objset_t *os, uint64_t object, boolean_t hole, uint64_t *off) /* * Check if dnode is dirty */ - if (dn->dn_dirtyctx != DN_UNDIRTIED) { - for (i = 0; i < TXG_SIZE; i++) { - if (!list_is_empty(&dn->dn_dirty_records[i])) { - clean = B_FALSE; - break; - } + for (i = 0; i < TXG_SIZE; i++) { + if (list_link_active(&dn->dn_dirty_link[i])) { + clean = B_FALSE; + break; } } diff --git a/module/zfs/fm.c b/module/zfs/fm.c index f6ae1628..cb148149 100644 --- a/module/zfs/fm.c +++ b/module/zfs/fm.c @@ -794,11 +794,11 @@ i_fm_free(nv_alloc_t *nva, void *buf, size_t size) } const nv_alloc_ops_t fm_mem_alloc_ops = { - NULL, - NULL, - i_fm_alloc, - i_fm_free, - NULL + .nv_ao_init = NULL, + .nv_ao_fini = NULL, + .nv_ao_alloc = i_fm_alloc, + .nv_ao_free = i_fm_free, + .nv_ao_reset = NULL }; /* diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c index 00478a39..6f2aa3f5 100644 --- a/module/zfs/mmp.c +++ b/module/zfs/mmp.c @@ -198,50 +198,40 @@ mmp_thread_stop(spa_t *spa) } /* - * Randomly choose a leaf vdev, to write an MMP block to. It must be - * writable. It must not have an outstanding mmp write (if so then - * there is a problem, and a new write will also block). + * Choose a leaf vdev to write an MMP block to. It must not have an + * outstanding mmp write (if so then there is a problem, and a new write will + * also block). If there is no usable leaf in this subtree return NULL, + * otherwise return a pointer to the leaf. * - * We try 10 times to pick a random leaf without an outstanding write. - * If 90% of the leaves have pending writes, this gives us a >65% - * chance of finding one we can write to. There will be at least - * (zfs_multihost_fail_intervals) tries before the inability to write an MMP - * block causes serious problems. + * When walking the subtree, a random child is chosen as the starting point so + * that when the tree is healthy, the leaf chosen will be random with even + * distribution. If there are unhealthy vdevs in the tree, the distribution + * will be really poor only if a large proportion of the vdevs are unhealthy, + * in which case there are other more pressing problems. */ static vdev_t * -vdev_random_leaf(spa_t *spa) +mmp_random_leaf(vdev_t *vd) { - vdev_t *vd, *child; - int pending_writes = 10; + int child_idx; - ASSERT(spa); - ASSERT(spa_config_held(spa, SCL_STATE, RW_READER) == SCL_STATE); - - /* - * Since we hold SCL_STATE, neither pool nor vdev state can - * change. Therefore, if the root is not dead, there is a - * child that is not dead, and so on down to a leaf. - */ - if (!vdev_writeable(spa->spa_root_vdev)) + if (!vdev_writeable(vd)) return (NULL); - vd = spa->spa_root_vdev; - while (!vd->vdev_ops->vdev_op_leaf) { - child = vd->vdev_child[spa_get_random(vd->vdev_children)]; + if (vd->vdev_ops->vdev_op_leaf) + return (vd->vdev_mmp_pending == 0 ? vd : NULL); - if (!vdev_writeable(child)) - continue; + child_idx = spa_get_random(vd->vdev_children); + for (int offset = vd->vdev_children; offset > 0; offset--) { + vdev_t *leaf; + vdev_t *child = vd->vdev_child[(child_idx + offset) % + vd->vdev_children]; - if (child->vdev_ops->vdev_op_leaf && child->vdev_mmp_pending) { - if (pending_writes-- > 0) - continue; - else - return (NULL); - } - - vd = child; + leaf = mmp_random_leaf(child); + if (leaf) + return (leaf); } - return (vd); + + return (NULL); } static void @@ -324,8 +314,8 @@ mmp_write_uberblock(spa_t *spa) uint64_t offset; spa_config_enter(spa, SCL_STATE, FTAG, RW_READER); - vd = vdev_random_leaf(spa); - if (vd == NULL || !vdev_writeable(vd)) { + vd = mmp_random_leaf(spa->spa_root_vdev); + if (vd == NULL) { spa_config_exit(spa, SCL_STATE, FTAG); return; } diff --git a/module/zfs/qat_compress.c b/module/zfs/qat_compress.c index 99d1c9a1..4d17d7ac 100644 --- a/module/zfs/qat_compress.c +++ b/module/zfs/qat_compress.c @@ -34,9 +34,11 @@ /* * Max instances in QAT device, each instance is a channel to submit - * jobs to QAT hardware + * jobs to QAT hardware, this is only for pre-allocating instance, + * and session arrays, the actual number of instances are defined in + * the QAT driver's configure file. */ -#define MAX_INSTANCES 6 +#define MAX_INSTANCES 48 /* * ZLIB head and foot size @@ -104,7 +106,7 @@ static kstat_t *qat_ksp; static CpaInstanceHandle dc_inst_handles[MAX_INSTANCES]; static CpaDcSessionHandle session_handles[MAX_INSTANCES]; static CpaBufferList **buffer_array[MAX_INSTANCES]; -static Cpa32U num_inst = 0; +static Cpa16U num_inst = 0; static Cpa32U inst_num = 0; static boolean_t qat_init_done = B_FALSE; int zfs_qat_disable = 0; @@ -491,7 +493,10 @@ qat_compress(qat_compress_dir_t dir, char *src, int src_len, + ZLIB_FOOT_SZ > PAGE_SIZE) goto fail; - flat_buf_dst->pData += (compressed_sz + hdr_sz) % PAGE_SIZE; + /* jump to the end of the buffer and append footer */ + flat_buf_dst->pData = + (char *)((unsigned long)flat_buf_dst->pData & PAGE_MASK) + + ((compressed_sz + hdr_sz) % PAGE_SIZE); flat_buf_dst->dataLenInBytes = ZLIB_FOOT_SZ; dc_results.produced = 0; @@ -503,9 +508,6 @@ qat_compress(qat_compress_dir_t dir, char *src, int src_len, *c_len = compressed_sz + dc_results.produced + hdr_sz; - if (*c_len < PAGE_SIZE) - *c_len = 8 * PAGE_SIZE; - QAT_STAT_INCR(comp_total_out_bytes, *c_len); ret = 0; diff --git a/module/zfs/spa.c b/module/zfs/spa.c index f1f1444f..771f4c8d 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -3257,7 +3257,7 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config, * Log the fact that we booted up (so that we can detect if * we rebooted in the middle of an operation). */ - spa_history_log_version(spa, "open"); + spa_history_log_version(spa, "open", NULL); /* * Delete any inconsistent datasets. @@ -4139,6 +4139,15 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props, tx = dmu_tx_create_assigned(dp, txg); + /* + * Create the pool's history object. + */ + if (version >= SPA_VERSION_ZPOOL_HISTORY && !spa->spa_history) + spa_history_create_obj(spa, tx); + + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_CREATE); + spa_history_log_version(spa, "create", tx); + /* * Create the pool config object. */ @@ -4187,12 +4196,6 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props, VERIFY3U(0, ==, bpobj_open(&spa->spa_deferred_bpobj, spa->spa_meta_objset, obj)); - /* - * Create the pool's history object. - */ - if (version >= SPA_VERSION_ZPOOL_HISTORY) - spa_history_create_obj(spa, tx); - /* * Generate some random noise for salted checksums to operate on. */ @@ -4226,9 +4229,6 @@ spa_create(const char *pool, nvlist_t *nvroot, nvlist_t *props, txg_wait_synced(spa->spa_dsl_pool, txg); spa_config_sync(spa, B_FALSE, B_TRUE); - spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_CREATE); - - spa_history_log_version(spa, "create"); /* * Don't count references from objsets that are already closed @@ -4415,7 +4415,7 @@ spa_import(char *pool, nvlist_t *config, nvlist_t *props, uint64_t flags) */ spa_async_request(spa, SPA_ASYNC_AUTOEXPAND); - spa_history_log_version(spa, "import"); + spa_history_log_version(spa, "import", NULL); spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_IMPORT); @@ -4618,7 +4618,10 @@ spa_export_common(char *pool, int new_state, nvlist_t **oldconfig, } export_spa: - spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_DESTROY); + if (new_state == POOL_STATE_DESTROYED) + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_DESTROY); + else if (new_state == POOL_STATE_EXPORTED) + spa_event_notify(spa, NULL, NULL, ESC_ZFS_POOL_EXPORT); if (spa->spa_state != POOL_STATE_UNINITIALIZED) { spa_unload(spa); diff --git a/module/zfs/spa_history.c b/module/zfs/spa_history.c index 73571c03..b6a32b31 100644 --- a/module/zfs/spa_history.c +++ b/module/zfs/spa_history.c @@ -89,17 +89,17 @@ spa_history_create_obj(spa_t *spa, dmu_tx_t *tx) spa_history_phys_t *shpp; objset_t *mos = spa->spa_meta_objset; - ASSERT(spa->spa_history == 0); + ASSERT0(spa->spa_history); spa->spa_history = dmu_object_alloc(mos, DMU_OT_SPA_HISTORY, SPA_OLD_MAXBLOCKSIZE, DMU_OT_SPA_HISTORY_OFFSETS, sizeof (spa_history_phys_t), tx); - VERIFY(zap_add(mos, DMU_POOL_DIRECTORY_OBJECT, + VERIFY0(zap_add(mos, DMU_POOL_DIRECTORY_OBJECT, DMU_POOL_HISTORY, sizeof (uint64_t), 1, - &spa->spa_history, tx) == 0); + &spa->spa_history, tx)); - VERIFY(0 == dmu_bonus_hold(mos, spa->spa_history, FTAG, &dbp)); - ASSERT(dbp->db_size >= sizeof (spa_history_phys_t)); + VERIFY0(dmu_bonus_hold(mos, spa->spa_history, FTAG, &dbp)); + ASSERT3U(dbp->db_size, >=, sizeof (spa_history_phys_t)); shpp = dbp->db_data; dmu_buf_will_dirty(dbp, tx); @@ -525,7 +525,7 @@ log_internal(nvlist_t *nvl, const char *operation, spa_t *spa, * initialized yet, so don't bother logging the internal events. * Likewise if the pool is not writeable. */ - if (tx->tx_txg == TXG_INITIAL || !spa_writeable(spa)) { + if (spa_is_initializing(spa) || !spa_writeable(spa)) { fnvlist_free(nvl); return; } @@ -611,11 +611,11 @@ spa_history_log_internal_dd(dsl_dir_t *dd, const char *operation, } void -spa_history_log_version(spa_t *spa, const char *operation) +spa_history_log_version(spa_t *spa, const char *operation, dmu_tx_t *tx) { utsname_t *u = utsname(); - spa_history_log_internal(spa, operation, NULL, + spa_history_log_internal(spa, operation, tx, "pool version %llu; software version %llu/%llu; uts %s %s %s %s", (u_longlong_t)spa_version(spa), SPA_VERSION, ZPL_VERSION, u->nodename, u->release, u->version, u->machine); diff --git a/module/zfs/vdev_mirror.c b/module/zfs/vdev_mirror.c index 15d1f204..0439e4b4 100644 --- a/module/zfs/vdev_mirror.c +++ b/module/zfs/vdev_mirror.c @@ -109,8 +109,8 @@ vdev_mirror_map_free(zio_t *zio) } static const zio_vsd_ops_t vdev_mirror_vsd_ops = { - vdev_mirror_map_free, - zio_vsd_default_cksum_report + .vsd_free = vdev_mirror_map_free, + .vsd_cksum_report = zio_vsd_default_cksum_report }; static int diff --git a/module/zfs/vdev_raidz.c b/module/zfs/vdev_raidz.c index ba850b4f..3077e09b 100644 --- a/module/zfs/vdev_raidz.c +++ b/module/zfs/vdev_raidz.c @@ -318,8 +318,8 @@ vdev_raidz_cksum_report(zio_t *zio, zio_cksum_report_t *zcr, void *arg) } static const zio_vsd_ops_t vdev_raidz_vsd_ops = { - vdev_raidz_map_free_vsd, - vdev_raidz_cksum_report + .vsd_free = vdev_raidz_map_free_vsd, + .vsd_cksum_report = vdev_raidz_cksum_report }; /* diff --git a/module/zfs/zfs_acl.c b/module/zfs/zfs_acl.c index 0e7203ea..7ddedeaa 100644 --- a/module/zfs/zfs_acl.c +++ b/module/zfs/zfs_acl.c @@ -174,18 +174,18 @@ zfs_ace_v0_data(void *acep, void **datap) } static acl_ops_t zfs_acl_v0_ops = { - zfs_ace_v0_get_mask, - zfs_ace_v0_set_mask, - zfs_ace_v0_get_flags, - zfs_ace_v0_set_flags, - zfs_ace_v0_get_type, - zfs_ace_v0_set_type, - zfs_ace_v0_get_who, - zfs_ace_v0_set_who, - zfs_ace_v0_size, - zfs_ace_v0_abstract_size, - zfs_ace_v0_mask_off, - zfs_ace_v0_data + .ace_mask_get = zfs_ace_v0_get_mask, + .ace_mask_set = zfs_ace_v0_set_mask, + .ace_flags_get = zfs_ace_v0_get_flags, + .ace_flags_set = zfs_ace_v0_set_flags, + .ace_type_get = zfs_ace_v0_get_type, + .ace_type_set = zfs_ace_v0_set_type, + .ace_who_get = zfs_ace_v0_get_who, + .ace_who_set = zfs_ace_v0_set_who, + .ace_size = zfs_ace_v0_size, + .ace_abstract_size = zfs_ace_v0_abstract_size, + .ace_mask_off = zfs_ace_v0_mask_off, + .ace_data = zfs_ace_v0_data }; static uint16_t @@ -310,18 +310,18 @@ zfs_ace_fuid_data(void *acep, void **datap) } static acl_ops_t zfs_acl_fuid_ops = { - zfs_ace_fuid_get_mask, - zfs_ace_fuid_set_mask, - zfs_ace_fuid_get_flags, - zfs_ace_fuid_set_flags, - zfs_ace_fuid_get_type, - zfs_ace_fuid_set_type, - zfs_ace_fuid_get_who, - zfs_ace_fuid_set_who, - zfs_ace_fuid_size, - zfs_ace_fuid_abstract_size, - zfs_ace_fuid_mask_off, - zfs_ace_fuid_data + .ace_mask_get = zfs_ace_fuid_get_mask, + .ace_mask_set = zfs_ace_fuid_set_mask, + .ace_flags_get = zfs_ace_fuid_get_flags, + .ace_flags_set = zfs_ace_fuid_set_flags, + .ace_type_get = zfs_ace_fuid_get_type, + .ace_type_set = zfs_ace_fuid_set_type, + .ace_who_get = zfs_ace_fuid_get_who, + .ace_who_set = zfs_ace_fuid_set_who, + .ace_size = zfs_ace_fuid_size, + .ace_abstract_size = zfs_ace_fuid_abstract_size, + .ace_mask_off = zfs_ace_fuid_mask_off, + .ace_data = zfs_ace_fuid_data }; /* diff --git a/module/zfs/zfs_dir.c b/module/zfs/zfs_dir.c index 1fcc69fd..c6ee3029 100644 --- a/module/zfs/zfs_dir.c +++ b/module/zfs/zfs_dir.c @@ -1126,7 +1126,7 @@ top: * * you own the directory, * you own the entry, - * the entry is a plain file and you have write access, + * you have write access to the entry, * or you are privileged (checked in secpolicy...). * * The function returns 0 if remove access is granted. @@ -1151,8 +1151,7 @@ zfs_sticky_remove_access(znode_t *zdp, znode_t *zp, cred_t *cr) cr, ZFS_OWNER); if ((uid = crgetuid(cr)) == downer || uid == fowner || - (S_ISDIR(ZTOI(zp)->i_mode) && - zfs_zaccess(zp, ACE_WRITE_DATA, 0, B_FALSE, cr) == 0)) + zfs_zaccess(zp, ACE_WRITE_DATA, 0, B_FALSE, cr) == 0) return (0); else return (secpolicy_vnode_remove(cr)); diff --git a/module/zfs/zfs_vfsops.c b/module/zfs/zfs_vfsops.c index f97660f3..76113393 100644 --- a/module/zfs/zfs_vfsops.c +++ b/module/zfs/zfs_vfsops.c @@ -740,7 +740,7 @@ zfs_userspace_one(zfsvfs_t *zfsvfs, zfs_userquota_prop_t type, return (0); if (type == ZFS_PROP_USEROBJUSED || type == ZFS_PROP_GROUPOBJUSED) { - strlcpy(buf, DMU_OBJACCT_PREFIX, DMU_OBJACCT_PREFIX_LEN); + strlcpy(buf, DMU_OBJACCT_PREFIX, DMU_OBJACCT_PREFIX_LEN + 1); offset = DMU_OBJACCT_PREFIX_LEN; } diff --git a/module/zfs/zfs_vnops.c b/module/zfs/zfs_vnops.c index a88f2482..6a1dab5c 100644 --- a/module/zfs/zfs_vnops.c +++ b/module/zfs/zfs_vnops.c @@ -3155,7 +3155,7 @@ top: &atime, sizeof (atime)); } - if (mask & ATTR_MTIME) { + if (mask & (ATTR_MTIME | ATTR_SIZE)) { ZFS_TIME_ENCODE(&vap->va_mtime, mtime); ZTOI(zp)->i_mtime = timespec_trunc(vap->va_mtime, ZTOI(zp)->i_sb->s_time_gran); @@ -3164,7 +3164,7 @@ top: mtime, sizeof (mtime)); } - if (mask & ATTR_CTIME) { + if (mask & (ATTR_CTIME | ATTR_SIZE)) { ZFS_TIME_ENCODE(&vap->va_ctime, ctime); ZTOI(zp)->i_ctime = timespec_trunc(vap->va_ctime, ZTOI(zp)->i_sb->s_time_gran); diff --git a/module/zfs/zil.c b/module/zfs/zil.c index 6a1f190f..4d714cef 100644 --- a/module/zfs/zil.c +++ b/module/zfs/zil.c @@ -1214,17 +1214,20 @@ cont: itx_t * zil_itx_create(uint64_t txtype, size_t lrsize) { + size_t itxsize; itx_t *itx; lrsize = P2ROUNDUP_TYPED(lrsize, sizeof (uint64_t), size_t); + itxsize = offsetof(itx_t, itx_lr) + lrsize; - itx = zio_data_buf_alloc(offsetof(itx_t, itx_lr) + lrsize); + itx = zio_data_buf_alloc(itxsize); itx->itx_lr.lrc_txtype = txtype; itx->itx_lr.lrc_reclen = lrsize; itx->itx_lr.lrc_seq = 0; /* defensive */ itx->itx_sync = B_TRUE; /* default is synchronous */ itx->itx_callback = NULL; itx->itx_callback_data = NULL; + itx->itx_size = itxsize; return (itx); } @@ -1232,7 +1235,7 @@ zil_itx_create(uint64_t txtype, size_t lrsize) void zil_itx_destroy(itx_t *itx) { - zio_data_buf_free(itx, offsetof(itx_t, itx_lr)+itx->itx_lr.lrc_reclen); + zio_data_buf_free(itx, itx->itx_size); } /* diff --git a/rpm/generic/zfs-dkms.spec.in b/rpm/generic/zfs-dkms.spec.in index f6de4929..58cbce47 100644 --- a/rpm/generic/zfs-dkms.spec.in +++ b/rpm/generic/zfs-dkms.spec.in @@ -27,6 +27,7 @@ Requires: gcc, make, perl Requires: kernel-devel %endif Provides: %{module}-kmod = %{version} +AutoReqProv: no %description This package contains the dkms ZFS kernel modules. diff --git a/rpm/generic/zfs-kmod.spec.in b/rpm/generic/zfs-kmod.spec.in index bf887cf5..9d054256 100644 --- a/rpm/generic/zfs-kmod.spec.in +++ b/rpm/generic/zfs-kmod.spec.in @@ -191,6 +191,9 @@ chmod u+x ${RPM_BUILD_ROOT}%{kmodinstdir_prefix}/*/extra/*/*/* rm -rf $RPM_BUILD_ROOT %changelog +* Thu Dec 07 2017 Tony Hutter - 0.7.4-1 +- Released 0.7.4-1, detailed release notes are available at: +- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.4 * Wed Oct 18 2017 Tony Hutter - 0.7.3-1 - Released 0.7.3-1, detailed release notes are available at: - https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.3 diff --git a/rpm/generic/zfs.spec.in b/rpm/generic/zfs.spec.in index f61cfd28..be883d5b 100644 --- a/rpm/generic/zfs.spec.in +++ b/rpm/generic/zfs.spec.in @@ -39,7 +39,6 @@ # Generic enable switch for systemd %if %{with systemd} %define _systemd 1 -%define systemd_svcs zfs-import-cache.service zfs-import-scan.service zfs-mount.service zfs-share.service zfs-zed.service zfs.target %endif # RHEL >= 7 comes with systemd @@ -179,10 +178,12 @@ Requires: lsscsi Requires: mdadm Requires: bc Requires: ksh -Requires: fio -Requires: acl -Requires: sudo -Requires: sysstat +Requires: fio +Requires: acl +Requires: sudo +Requires: sysstat +Requires: rng-tools +AutoReqProv: no %description test This package contains test infrastructure and support scripts for @@ -219,6 +220,7 @@ image which is ZFS aware. %endif %if 0%{?_systemd} %define systemd --enable-systemd --with-systemdunitdir=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --disable-sysvinit + %define systemd_svcs zfs-import-cache.service zfs-import-scan.service zfs-mount.service zfs-share.service zfs-zed.service zfs.target %else %define systemd --enable-sysvinit --disable-systemd %endif @@ -331,6 +333,9 @@ exit 0 %endif %changelog +* Thu Dec 07 2017 Tony Hutter - 0.7.4-1 +- Released 0.7.4-1, detailed release notes are available at: +- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.4 * Wed Oct 18 2017 Tony Hutter - 0.7.3-1 - Released 0.7.3-1, detailed release notes are available at: - https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.3 diff --git a/rpm/redhat/zfs-dkms.spec.in b/rpm/redhat/zfs-dkms.spec.in index f6de4929..58cbce47 100644 --- a/rpm/redhat/zfs-dkms.spec.in +++ b/rpm/redhat/zfs-dkms.spec.in @@ -27,6 +27,7 @@ Requires: gcc, make, perl Requires: kernel-devel %endif Provides: %{module}-kmod = %{version} +AutoReqProv: no %description This package contains the dkms ZFS kernel modules. diff --git a/rpm/redhat/zfs.spec.in b/rpm/redhat/zfs.spec.in index f61cfd28..be883d5b 100644 --- a/rpm/redhat/zfs.spec.in +++ b/rpm/redhat/zfs.spec.in @@ -39,7 +39,6 @@ # Generic enable switch for systemd %if %{with systemd} %define _systemd 1 -%define systemd_svcs zfs-import-cache.service zfs-import-scan.service zfs-mount.service zfs-share.service zfs-zed.service zfs.target %endif # RHEL >= 7 comes with systemd @@ -179,10 +178,12 @@ Requires: lsscsi Requires: mdadm Requires: bc Requires: ksh -Requires: fio -Requires: acl -Requires: sudo -Requires: sysstat +Requires: fio +Requires: acl +Requires: sudo +Requires: sysstat +Requires: rng-tools +AutoReqProv: no %description test This package contains test infrastructure and support scripts for @@ -219,6 +220,7 @@ image which is ZFS aware. %endif %if 0%{?_systemd} %define systemd --enable-systemd --with-systemdunitdir=%{_unitdir} --with-systemdpresetdir=%{_presetdir} --disable-sysvinit + %define systemd_svcs zfs-import-cache.service zfs-import-scan.service zfs-mount.service zfs-share.service zfs-zed.service zfs.target %else %define systemd --enable-sysvinit --disable-systemd %endif @@ -331,6 +333,9 @@ exit 0 %endif %changelog +* Thu Dec 07 2017 Tony Hutter - 0.7.4-1 +- Released 0.7.4-1, detailed release notes are available at: +- https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.4 * Wed Oct 18 2017 Tony Hutter - 0.7.3-1 - Released 0.7.3-1, detailed release notes are available at: - https://github.com/zfsonlinux/zfs/releases/tag/zfs-0.7.3 diff --git a/scripts/zfs-tests.sh b/scripts/zfs-tests.sh index 1d959ae3..147abee0 100755 --- a/scripts/zfs-tests.sh +++ b/scripts/zfs-tests.sh @@ -41,6 +41,8 @@ FILEDIR=${FILEDIR:-/var/tmp} DISKS=${DISKS:-""} SINGLETEST=() SINGLETESTUSER="root" +TAGS="functional" +ITERATIONS=1 ZFS_DBGMSG="$STF_SUITE/callbacks/zfs_dbgmsg.ksh" ZFS_DMESG="$STF_SUITE/callbacks/zfs_dmesg.ksh" ZFS_MMP="$STF_SUITE/callbacks/zfs_mmp.ksh" @@ -250,10 +252,13 @@ OPTIONS: -x Remove all testpools, dm, lo, and files (unsafe) -k Disable cleanup after test failure -f Use files only, disables block device tests + -c Only create and populate constrained path + -I NUM Number of iterations -d DIR Use DIR for files and loopback devices -s SIZE Use vdevs of SIZE (default: 4G) -r RUNFILE Run tests in RUNFILE (default: linux.run) -t PATH Run single test at PATH relative to test suite + -T TAGS Comma separated list of tags -u USER Run single test as USER (default: root) EXAMPLES: @@ -270,7 +275,7 @@ $0 -x EOF } -while getopts 'hvqxkfd:s:r:?t:u:' OPTION; do +while getopts 'hvqxkfcd:s:r:?t:T:u:I:' OPTION; do case $OPTION in h) usage @@ -295,6 +300,12 @@ while getopts 'hvqxkfd:s:r:?t:u:' OPTION; do d) FILEDIR="$OPTARG" ;; + I) + ITERATIONS="$OPTARG" + if [ "$ITERATIONS" -le 0 ]; then + fail "Iterations must be greater than 0." + fi + ;; s) FILESIZE="$OPTARG" ;; @@ -307,6 +318,9 @@ while getopts 'hvqxkfd:s:r:?t:u:' OPTION; do fi SINGLETEST+=("$OPTARG") ;; + T) + TAGS="$OPTARG" + ;; u) SINGLETESTUSER="$OPTARG" ;; @@ -496,6 +510,8 @@ msg "LOOPBACKS: $LOOPBACKS" msg "DISKS: $DISKS" msg "NUM_DISKS: $NUM_DISKS" msg "FILESIZE: $FILESIZE" +msg "ITERATIONS: $ITERATIONS" +msg "TAGS: $TAGS" msg "Keep pool(s): $KEEP" msg "Missing util(s): $STF_MISSING_BIN" msg "" @@ -509,8 +525,10 @@ export __ZFS_POOL_EXCLUDE export TESTFAIL_CALLBACKS export PATH=$STF_PATH -msg "${TEST_RUNNER} ${QUIET} -c ${RUNFILE} -i ${STF_SUITE}" -${TEST_RUNNER} ${QUIET} -c "${RUNFILE}" -i "${STF_SUITE}" +msg "${TEST_RUNNER} ${QUIET} -c ${RUNFILE} -T ${TAGS} -i ${STF_SUITE}" \ + "-I ${ITERATIONS}" +${TEST_RUNNER} ${QUIET} -c "${RUNFILE}" -T "${TAGS}" -i "${STF_SUITE}" \ + -I "${ITERATIONS}" RESULT=$? echo diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run index 5583a255..10bd110a 100644 --- a/tests/runfiles/linux.run +++ b/tests/runfiles/linux.run @@ -18,29 +18,35 @@ timeout = 600 post_user = root post = cleanup outputdir = /var/tmp/test_results +tags = ['functional'] # Update to use ZFS_ACL_* variables and user_run helper. # posix_001_pos # posix_002_pos [tests/functional/acl/posix] tests = ['posix_003_pos'] +tags = ['functional', 'acl', 'posix'] [tests/functional/atime] tests = ['atime_001_pos', 'atime_002_neg', 'atime_003_pos'] +tags = ['functional', 'atime'] [tests/functional/bootfs] tests = ['bootfs_001_pos', 'bootfs_002_neg', 'bootfs_003_pos', 'bootfs_004_neg', 'bootfs_005_neg', 'bootfs_006_pos', 'bootfs_007_pos', 'bootfs_008_pos'] +tags = ['functional', 'bootfs'] [tests/functional/cache] tests = ['cache_001_pos', 'cache_002_pos', 'cache_003_pos', 'cache_004_neg', 'cache_005_neg', 'cache_006_pos', 'cache_007_neg', 'cache_008_neg', 'cache_009_pos', 'cache_010_neg', 'cache_011_pos'] +tags = ['functional', 'cache'] [tests/functional/cachefile] tests = ['cachefile_001_pos', 'cachefile_002_pos', 'cachefile_003_pos', 'cachefile_004_pos'] +tags = ['functional', 'cachefile'] # 'sensitive_none_lookup', 'sensitive_none_delete', # 'sensitive_formd_lookup', 'sensitive_formd_delete', @@ -50,35 +56,43 @@ tests = ['cachefile_001_pos', 'cachefile_002_pos', 'cachefile_003_pos', # 'mixed_formd_lookup', 'mixed_formd_lookup_ci', 'mixed_formd_delete'] [tests/functional/casenorm] tests = ['case_all_values', 'norm_all_values'] +tags = ['functional', 'casenorm'] [tests/functional/chattr] tests = ['chattr_001_pos', 'chattr_002_neg'] +tags = ['functional', 'chattr'] [tests/functional/checksum] tests = ['run_edonr_test', 'run_sha2_test', 'run_skein_test', 'filetest_001_pos'] +tags = ['functional', 'checksum'] [tests/functional/clean_mirror] tests = [ 'clean_mirror_001_pos', 'clean_mirror_002_pos', 'clean_mirror_003_pos', 'clean_mirror_004_pos'] +tags = ['functional', 'clean_mirror'] [tests/functional/cli_root/zdb] tests = ['zdb_001_neg', 'zdb_002_pos', 'zdb_003_pos', 'zdb_004_pos', 'zdb_005_pos'] pre = post = +tags = ['functional', 'cli_root', 'zdb'] [tests/functional/cli_root/zfs] tests = ['zfs_001_neg', 'zfs_002_pos', 'zfs_003_neg'] +tags = ['functional', 'cli_root', 'zfs'] [tests/functional/cli_root/zfs_clone] tests = ['zfs_clone_001_neg', 'zfs_clone_002_pos', 'zfs_clone_003_pos', 'zfs_clone_004_pos', 'zfs_clone_005_pos', 'zfs_clone_006_pos', 'zfs_clone_007_pos', 'zfs_clone_008_neg', 'zfs_clone_009_neg', 'zfs_clone_010_pos'] +tags = ['functional', 'cli_root', 'zfs_clone'] [tests/functional/cli_root/zfs_copies] tests = ['zfs_copies_001_pos', 'zfs_copies_002_pos', 'zfs_copies_003_pos', 'zfs_copies_004_neg', 'zfs_copies_005_neg', 'zfs_copies_006_pos'] +tags = ['functional', 'cli_root', 'zfs_copies'] [tests/functional/cli_root/zfs_create] tests = ['zfs_create_001_pos', 'zfs_create_002_pos', 'zfs_create_003_pos', @@ -86,6 +100,7 @@ tests = ['zfs_create_001_pos', 'zfs_create_002_pos', 'zfs_create_003_pos', 'zfs_create_007_pos', 'zfs_create_008_neg', 'zfs_create_009_neg', 'zfs_create_010_neg', 'zfs_create_011_pos', 'zfs_create_012_pos', 'zfs_create_013_pos', 'zfs_create_014_pos'] +tags = ['functional', 'cli_root', 'zfs_create'] [tests/functional/cli_root/zfs_destroy] tests = ['zfs_destroy_001_pos', 'zfs_destroy_002_pos', 'zfs_destroy_003_pos', @@ -94,14 +109,17 @@ tests = ['zfs_destroy_001_pos', 'zfs_destroy_002_pos', 'zfs_destroy_003_pos', 'zfs_destroy_010_pos', 'zfs_destroy_011_pos', 'zfs_destroy_012_pos', 'zfs_destroy_013_neg', 'zfs_destroy_014_pos', 'zfs_destroy_015_pos', 'zfs_destroy_016_pos'] +tags = ['functional', 'cli_root', 'zfs_destroy'] [tests/functional/cli_root/zfs_get] tests = ['zfs_get_001_pos', 'zfs_get_002_pos', 'zfs_get_003_pos', 'zfs_get_004_pos', 'zfs_get_005_neg', 'zfs_get_006_neg', 'zfs_get_007_neg', 'zfs_get_008_pos', 'zfs_get_009_pos', 'zfs_get_010_neg'] +tags = ['functional', 'cli_root', 'zfs_get'] [tests/functional/cli_root/zfs_inherit] tests = ['zfs_inherit_001_neg', 'zfs_inherit_002_neg', 'zfs_inherit_003_pos'] +tags = ['functional', 'cli_root', 'zfs_inherit'] # zfs_mount_006_pos - https://github.com/zfsonlinux/zfs/issues/4990 [tests/functional/cli_root/zfs_mount] @@ -110,14 +128,17 @@ tests = ['zfs_mount_001_pos', 'zfs_mount_002_pos', 'zfs_mount_003_pos', 'zfs_mount_008_pos', 'zfs_mount_009_neg', 'zfs_mount_010_neg', 'zfs_mount_011_neg', 'zfs_mount_012_neg', 'zfs_mount_all_001_pos', 'zfs_mount_remount'] +tags = ['functional', 'cli_root', 'zfs_mount'] [tests/functional/cli_root/zfs_promote] tests = ['zfs_promote_001_pos', 'zfs_promote_002_pos', 'zfs_promote_003_pos', 'zfs_promote_004_pos', 'zfs_promote_005_pos', 'zfs_promote_006_neg', 'zfs_promote_007_neg', 'zfs_promote_008_pos'] +tags = ['functional', 'cli_root', 'zfs_promote'] [tests/functional/cli_root/zfs_property] tests = ['zfs_written_property_001_pos'] +tags = ['functional', 'cli_root', 'zfs_property'] # zfs_receive_004_neg - Fails for OpenZFS on illumos [tests/functional/cli_root/zfs_receive] @@ -127,6 +148,7 @@ tests = ['zfs_receive_001_pos', 'zfs_receive_002_pos', 'zfs_receive_003_pos', 'zfs_receive_010_pos', 'zfs_receive_011_pos', 'zfs_receive_012_pos', 'zfs_receive_013_pos', 'zfs_receive_014_pos', 'zfs_receive_015_pos', 'receive-o-x_props_override'] +tags = ['functional', 'cli_root', 'zfs_receive'] # zfs_rename_006_pos - https://github.com/zfsonlinux/zfs/issues/5647 # zfs_rename_009_neg - https://github.com/zfsonlinux/zfs/issues/5648 @@ -136,18 +158,22 @@ tests = ['zfs_rename_001_pos', 'zfs_rename_002_pos', 'zfs_rename_003_pos', 'zfs_rename_007_pos', 'zfs_rename_008_pos', 'zfs_rename_010_neg', 'zfs_rename_011_pos', 'zfs_rename_012_neg', 'zfs_rename_013_pos'] +tags = ['functional', 'cli_root', 'zfs_rename'] [tests/functional/cli_root/zfs_reservation] tests = ['zfs_reservation_001_pos', 'zfs_reservation_002_pos'] +tags = ['functional', 'cli_root', 'zfs_reservation'] [tests/functional/cli_root/zfs_rollback] tests = ['zfs_rollback_001_pos', 'zfs_rollback_002_pos', 'zfs_rollback_003_neg', 'zfs_rollback_004_neg'] +tags = ['functional', 'cli_root', 'zfs_rollback'] [tests/functional/cli_root/zfs_send] tests = ['zfs_send_001_pos', 'zfs_send_002_pos', 'zfs_send_003_pos', 'zfs_send_004_neg', 'zfs_send_005_pos', 'zfs_send_006_pos', 'zfs_send_007_pos'] +tags = ['functional', 'cli_root', 'zfs_send'] [tests/functional/cli_root/zfs_set] tests = ['cache_001_pos', 'cache_002_neg', 'canmount_001_pos', @@ -159,36 +185,43 @@ tests = ['cache_001_pos', 'cache_002_neg', 'canmount_001_pos', 'user_property_004_pos', 'version_001_neg', 'zfs_set_001_neg', 'zfs_set_002_neg', 'zfs_set_003_neg', 'property_alias_001_pos', 'mountpoint_003_pos', 'ro_props_001_pos'] +tags = ['functional', 'cli_root', 'zfs_set'] [tests/functional/cli_root/zfs_share] tests = ['zfs_share_001_pos', 'zfs_share_002_pos', 'zfs_share_003_pos', 'zfs_share_004_pos', 'zfs_share_005_pos', 'zfs_share_006_pos', 'zfs_share_007_neg', 'zfs_share_008_neg', 'zfs_share_009_neg', 'zfs_share_010_neg', 'zfs_share_011_pos'] +tags = ['functional', 'cli_root', 'zfs_share'] [tests/functional/cli_root/zfs_snapshot] tests = ['zfs_snapshot_001_neg', 'zfs_snapshot_002_neg', 'zfs_snapshot_003_neg', 'zfs_snapshot_004_neg', 'zfs_snapshot_005_neg', 'zfs_snapshot_006_pos', 'zfs_snapshot_007_neg', 'zfs_snapshot_008_neg', 'zfs_snapshot_009_pos'] +tags = ['functional', 'cli_root', 'zfs_snapshot'] [tests/functional/cli_root/zfs_unmount] tests = ['zfs_unmount_001_pos', 'zfs_unmount_002_pos', 'zfs_unmount_003_pos', 'zfs_unmount_004_pos', 'zfs_unmount_005_pos', 'zfs_unmount_006_pos', 'zfs_unmount_007_neg', 'zfs_unmount_008_neg', 'zfs_unmount_009_pos', 'zfs_unmount_all_001_pos'] +tags = ['functional', 'cli_root', 'zfs_unmount'] [tests/functional/cli_root/zfs_unshare] tests = ['zfs_unshare_001_pos', 'zfs_unshare_002_pos', 'zfs_unshare_003_pos', 'zfs_unshare_004_neg', 'zfs_unshare_005_neg', 'zfs_unshare_006_pos'] +tags = ['functional', 'cli_root', 'zfs_unshare'] [tests/functional/cli_root/zfs_upgrade] tests = ['zfs_upgrade_001_pos', 'zfs_upgrade_002_pos', 'zfs_upgrade_003_pos', 'zfs_upgrade_004_pos', 'zfs_upgrade_005_pos', 'zfs_upgrade_006_neg', 'zfs_upgrade_007_neg'] +tags = ['functional', 'cli_root', 'zfs_upgrade'] [tests/functional/cli_root/zpool] tests = ['zpool_001_neg', 'zpool_002_pos', 'zpool_003_pos'] +tags = ['functional', 'cli_root', 'zpool'] [tests/functional/cli_root/zpool_add] tests = ['zpool_add_001_pos', 'zpool_add_002_pos', 'zpool_add_003_pos', @@ -196,13 +229,16 @@ tests = ['zpool_add_001_pos', 'zpool_add_002_pos', 'zpool_add_003_pos', 'zpool_add_007_neg', 'zpool_add_008_neg', 'zpool_add_009_neg', 'zpool_add_010_pos', 'add-o_ashift', 'add_prop_ashift'] +tags = ['functional', 'cli_root', 'zpool_add'] [tests/functional/cli_root/zpool_attach] tests = ['zpool_attach_001_neg', 'attach-o_ashift'] +tags = ['functional', 'cli_root', 'zpool_attach'] [tests/functional/cli_root/zpool_clear] tests = ['zpool_clear_001_pos', 'zpool_clear_002_neg', 'zpool_clear_003_neg', 'zpool_clear_readonly'] +tags = ['functional', 'cli_root', 'zpool_clear'] [tests/functional/cli_root/zpool_create] tests = ['zpool_create_001_pos', 'zpool_create_002_pos', @@ -218,30 +254,37 @@ tests = ['zpool_create_001_pos', 'zpool_create_002_pos', 'zpool_create_features_003_pos', 'zpool_create_features_004_neg', 'zpool_create_features_005_pos', 'create-o_ashift'] +tags = ['functional', 'cli_root', 'zpool_create'] [tests/functional/cli_root/zpool_destroy] tests = ['zpool_destroy_001_pos', 'zpool_destroy_002_pos', 'zpool_destroy_003_neg'] pre = post = +tags = ['functional', 'cli_root', 'zpool_destroy'] [tests/functional/cli_root/zpool_detach] tests = ['zpool_detach_001_neg'] +tags = ['functional', 'cli_root', 'zpool_detach'] [tests/functional/cli_root/zpool_expand] tests = ['zpool_expand_001_pos', 'zpool_expand_002_pos', 'zpool_expand_003_neg', 'zpool_expand_004_pos'] +tags = ['functional', 'cli_root', 'zpool_expand'] [tests/functional/cli_root/zpool_export] tests = ['zpool_export_001_pos', 'zpool_export_002_pos', 'zpool_export_003_neg', 'zpool_export_004_pos'] +tags = ['functional', 'cli_root', 'zpool_export'] [tests/functional/cli_root/zpool_get] tests = ['zpool_get_001_pos', 'zpool_get_002_pos', 'zpool_get_003_pos', 'zpool_get_004_neg'] +tags = ['functional', 'cli_root', 'zpool_get'] [tests/functional/cli_root/zpool_history] tests = ['zpool_history_001_neg', 'zpool_history_002_pos'] +tags = ['functional', 'cli_root', 'zpool_history'] [tests/functional/cli_root/zpool_import] tests = ['zpool_import_001_pos', 'zpool_import_002_pos', @@ -253,42 +296,52 @@ tests = ['zpool_import_001_pos', 'zpool_import_002_pos', 'zpool_import_features_003_pos','zpool_import_missing_001_pos', 'zpool_import_missing_002_pos', 'zpool_import_missing_003_pos', 'zpool_import_rename_001_pos', 'zpool_import_all_001_pos'] +tags = ['functional', 'cli_root', 'zpool_import'] [tests/functional/cli_root/zpool_labelclear] tests = ['zpool_labelclear_active', 'zpool_labelclear_exported'] pre = post = +tags = ['functional', 'cli_root', 'zpool_labelclear'] [tests/functional/cli_root/zpool_offline] tests = ['zpool_offline_001_pos', 'zpool_offline_002_neg', 'zpool_offline_003_pos'] +tags = ['functional', 'cli_root', 'zpool_offline'] [tests/functional/cli_root/zpool_online] tests = ['zpool_online_001_pos', 'zpool_online_002_neg'] +tags = ['functional', 'cli_root', 'zpool_online'] [tests/functional/cli_root/zpool_remove] tests = ['zpool_remove_001_neg', 'zpool_remove_002_pos', 'zpool_remove_003_pos'] +tags = ['functional', 'cli_root', 'zpool_remove'] [tests/functional/cli_root/zpool_replace] tests = ['zpool_replace_001_neg', 'replace-o_ashift', 'replace_prop_ashift'] +tags = ['functional', 'cli_root', 'zpool_replace'] [tests/functional/cli_root/zpool_scrub] tests = ['zpool_scrub_001_neg', 'zpool_scrub_002_pos', 'zpool_scrub_003_pos', 'zpool_scrub_004_pos', 'zpool_scrub_005_pos'] +tags = ['functional', 'cli_root', 'zpool_scrub'] [tests/functional/cli_root/zpool_set] tests = ['zpool_set_001_pos', 'zpool_set_002_neg', 'zpool_set_003_neg'] pre = post = +tags = ['functional', 'cli_root', 'zpool_set'] [tests/functional/cli_root/zpool_status] tests = ['zpool_status_001_pos', 'zpool_status_002_pos','zpool_status_003_pos', 'zpool_status_-c_disable', 'zpool_status_-c_homedir', 'zpool_status_-c_searchpath'] user = +tags = ['functional', 'cli_root', 'zpool_status'] [tests/functional/cli_root/zpool_sync] tests = ['zpool_sync_001_pos', 'zpool_sync_002_neg'] +tags = ['functional', 'cli_root', 'zpool_sync'] [tests/functional/cli_root/zpool_upgrade] tests = ['zpool_upgrade_001_pos', 'zpool_upgrade_002_pos', @@ -296,6 +349,7 @@ tests = ['zpool_upgrade_001_pos', 'zpool_upgrade_002_pos', 'zpool_upgrade_005_neg', 'zpool_upgrade_006_neg', 'zpool_upgrade_007_pos', 'zpool_upgrade_008_pos', 'zpool_upgrade_009_neg'] +tags = ['functional', 'cli_root', 'zpool_upgrade'] [tests/functional/cli_user/misc] tests = ['zdb_001_neg', 'zfs_001_neg', 'zfs_allow_001_neg', @@ -314,11 +368,13 @@ tests = ['zdb_001_neg', 'zfs_001_neg', 'zfs_allow_001_neg', 'zpool_status_001_neg', 'zpool_upgrade_001_neg', 'arcstat_001_pos', 'arc_summary_001_pos', 'dbufstat_001_pos'] user = +tags = ['functional', 'cli_user', 'misc'] [tests/functional/cli_user/zfs_list] tests = ['zfs_list_001_pos', 'zfs_list_002_pos', 'zfs_list_003_pos', 'zfs_list_004_neg', 'zfs_list_007_pos', 'zfs_list_008_neg'] user = +tags = ['functional', 'cli_user', 'zfs_list'] [tests/functional/cli_user/zpool_iostat] tests = ['zpool_iostat_001_neg', 'zpool_iostat_002_pos', @@ -326,17 +382,21 @@ tests = ['zpool_iostat_001_neg', 'zpool_iostat_002_pos', 'zpool_iostat_005_pos', 'zpool_iostat_-c_disable', 'zpool_iostat_-c_homedir', 'zpool_iostat_-c_searchpath'] user = +tags = ['functional', 'cli_user', 'zpool_iostat'] [tests/functional/cli_user/zpool_list] tests = ['zpool_list_001_pos', 'zpool_list_002_neg'] user = +tags = ['functional', 'cli_user', 'zpool_list'] [tests/functional/compression] tests = ['compress_001_pos', 'compress_002_pos', 'compress_003_pos', 'compress_004_pos'] +tags = ['functional', 'compression'] [tests/functional/ctime] tests = ['ctime_001_pos' ] +tags = ['functional', 'ctime'] [tests/functional/delegate] tests = ['zfs_allow_001_pos', 'zfs_allow_002_pos', @@ -346,133 +406,167 @@ tests = ['zfs_allow_001_pos', 'zfs_allow_002_pos', 'zfs_unallow_001_pos', 'zfs_unallow_002_pos', 'zfs_unallow_003_pos', 'zfs_unallow_004_pos', 'zfs_unallow_005_pos', 'zfs_unallow_006_pos', 'zfs_unallow_007_neg', 'zfs_unallow_008_neg'] +tags = ['functional', 'delegate'] [tests/functional/devices] tests = ['devices_001_pos', 'devices_002_neg', 'devices_003_pos'] +tags = ['functional', 'devices'] [tests/functional/events] tests = ['events_001_pos', 'events_002_pos'] +tags = ['functional', 'events'] [tests/functional/exec] tests = ['exec_001_pos', 'exec_002_neg'] +tags = ['functional', 'exec'] [tests/functional/fault] tests = ['auto_online_001_pos', 'auto_replace_001_pos'] +tags = ['functional', 'fault'] [tests/functional/features/async_destroy] tests = ['async_destroy_001_pos'] +tags = ['functional', 'features', 'async_destroy'] [tests/functional/features/large_dnode] tests = ['large_dnode_001_pos', 'large_dnode_002_pos', 'large_dnode_003_pos', 'large_dnode_004_neg', 'large_dnode_005_pos', 'large_dnode_006_pos', 'large_dnode_007_neg', 'large_dnode_008_pos', 'large_dnode_009_pos'] +tags = ['functional', 'features', 'large_dnode'] [tests/functional/grow_pool] tests = ['grow_pool_001_pos'] +tags = ['functional', 'grow_pool'] [tests/functional/grow_replicas] tests = ['grow_replicas_001_pos'] pre = post = +tags = ['functional', 'grow_replicas'] [tests/functional/history] tests = ['history_001_pos', 'history_002_pos', 'history_003_pos', 'history_004_pos', 'history_005_neg', 'history_006_neg', 'history_007_pos', 'history_008_pos', 'history_009_pos', 'history_010_pos'] +tags = ['functional', 'history'] [tests/functional/inheritance] tests = ['inherit_001_pos'] pre = +tags = ['functional', 'inheritance'] [tests/functional/inuse] tests = ['inuse_001_pos', 'inuse_003_pos', 'inuse_004_pos', 'inuse_005_pos', 'inuse_006_pos', 'inuse_007_pos', 'inuse_008_pos', 'inuse_009_pos'] post = +tags = ['functional', 'inuse'] [tests/functional/large_files] tests = ['large_files_001_pos', 'large_files_002_pos'] +tags = ['functional', 'large_files'] [tests/functional/largest_pool] tests = ['largest_pool_001_pos'] pre = post = +tags = ['functional', 'largest_pool'] [tests/functional/link_count] tests = ['link_count_001'] +tags = ['functional', 'link_count'] [tests/functional/migration] tests = ['migration_001_pos', 'migration_002_pos', 'migration_003_pos', 'migration_004_pos', 'migration_005_pos', 'migration_006_pos', 'migration_007_pos', 'migration_008_pos', 'migration_009_pos', 'migration_010_pos', 'migration_011_pos', 'migration_012_pos'] +tags = ['functional', 'migration'] [tests/functional/mmap] tests = ['mmap_write_001_pos', 'mmap_read_001_pos'] +tags = ['functional', 'mmap'] [tests/functional/mmp] tests = ['mmp_on_thread', 'mmp_on_uberblocks', 'mmp_on_off', 'mmp_interval', 'mmp_active_import', 'mmp_inactive_import', 'mmp_exported_import', 'mmp_write_uberblocks', 'mmp_reset_interval'] +tags = ['functional', 'mmp'] [tests/functional/mount] tests = ['umount_001', 'umountall_001'] +tags = ['functional', 'mount'] [tests/functional/mv_files] tests = ['mv_files_001_pos', 'mv_files_002_pos'] +tags = ['functional', 'mv_files'] [tests/functional/nestedfs] tests = ['nestedfs_001_pos'] +tags = ['functional', 'nestedfs'] [tests/functional/no_space] tests = ['enospc_001_pos', 'enospc_002_pos', 'enospc_003_pos'] +tags = ['functional', 'no_space'] [tests/functional/nopwrite] tests = ['nopwrite_copies', 'nopwrite_mtime', 'nopwrite_negative', 'nopwrite_promoted_clone', 'nopwrite_recsize', 'nopwrite_sync', 'nopwrite_varying_compression', 'nopwrite_volume'] +tags = ['functional', 'nopwrite'] [tests/functional/online_offline] tests = ['online_offline_001_pos', 'online_offline_002_neg', 'online_offline_003_neg'] +tags = ['functional', 'online_offline'] [tests/functional/pool_names] tests = ['pool_names_001_pos', 'pool_names_002_neg'] pre = post = +tags = ['functional', 'pool_names'] [tests/functional/poolversion] tests = ['poolversion_001_pos', 'poolversion_002_pos'] +tags = ['functional', 'poolversion'] [tests/functional/privilege] tests = ['privilege_001_pos', 'privilege_002_pos'] +tags = ['functional', 'privilege'] [tests/functional/quota] tests = ['quota_001_pos', 'quota_002_pos', 'quota_003_pos', 'quota_004_pos', 'quota_005_pos', 'quota_006_neg'] +tags = ['functional', 'quota'] [tests/functional/raidz] tests = ['raidz_001_neg', 'raidz_002_pos'] +tags = ['functional', 'raidz'] [tests/functional/redundancy] tests = ['redundancy_001_pos', 'redundancy_002_pos', 'redundancy_003_pos', 'redundancy_004_neg'] +tags = ['functional', 'redundancy'] [tests/functional/refquota] tests = ['refquota_001_pos', 'refquota_002_pos', 'refquota_003_pos', 'refquota_004_pos', 'refquota_005_pos', 'refquota_006_neg'] +tags = ['functional', 'refquota'] # refreserv_004_pos - Fails for OpenZFS on illumos [tests/functional/refreserv] tests = ['refreserv_001_pos', 'refreserv_002_pos', 'refreserv_003_pos', 'refreserv_005_pos'] +tags = ['functional', 'refreserv'] [tests/functional/rename_dirs] tests = ['rename_dirs_001_pos'] +tags = ['functional', 'rename_dirs'] [tests/functional/replacement] tests = ['replacement_001_pos', 'replacement_002_pos', 'replacement_003_pos'] +tags = ['functional', 'replacement'] # reservation_001_pos - https://github.com/zfsonlinux/zfs/issues/4445 # reservation_013_pos - https://github.com/zfsonlinux/zfs/issues/4444 @@ -484,9 +578,11 @@ tests = ['reservation_001_pos', 'reservation_002_pos', 'reservation_003_pos', 'reservation_010_pos', 'reservation_011_pos', 'reservation_012_pos', 'reservation_013_pos', 'reservation_014_pos', 'reservation_015_pos', 'reservation_016_pos', 'reservation_017_pos'] +tags = ['functional', 'reservation'] [tests/functional/rootpool] tests = ['rootpool_002_neg', 'rootpool_003_neg', 'rootpool_007_pos'] +tags = ['functional', 'rootpool'] # rsend_008_pos - https://github.com/zfsonlinux/zfs/issues/6066 [tests/functional/rsend] @@ -502,16 +598,19 @@ tests = ['rsend_001_pos', 'rsend_002_pos', 'rsend_003_pos', 'rsend_004_pos', 'send-c_mixed_compression', 'send-c_stream_size_estimate', 'send-cD', 'send-c_embedded_blocks', 'send-c_resume', 'send-cpL_varied_recsize', 'send-c_recv_dedup', 'send_freeobjects'] +tags = ['functional', 'rsend'] [tests/functional/scrub_mirror] tests = ['scrub_mirror_001_pos', 'scrub_mirror_002_pos', 'scrub_mirror_003_pos', 'scrub_mirror_004_pos'] +tags = ['functional', 'scrub_mirror'] [tests/functional/slog] tests = ['slog_001_pos', 'slog_002_pos', 'slog_003_pos', 'slog_004_pos', 'slog_005_pos', 'slog_006_pos', 'slog_007_pos', 'slog_008_neg', 'slog_009_neg', 'slog_010_neg', 'slog_011_neg', 'slog_012_neg', 'slog_013_pos', 'slog_014_pos', 'slog_replay_fs', 'slog_replay_volume'] +tags = ['functional', 'slog'] [tests/functional/snapshot] tests = ['clone_001_pos', 'rollback_001_pos', 'rollback_002_pos', @@ -521,26 +620,33 @@ tests = ['clone_001_pos', 'rollback_001_pos', 'rollback_002_pos', 'snapshot_009_pos', 'snapshot_010_pos', 'snapshot_011_pos', 'snapshot_012_pos', 'snapshot_013_pos', 'snapshot_014_pos', 'snapshot_015_pos', 'snapshot_016_pos', 'snapshot_017_pos'] +tags = ['functional', 'snapshot'] # snapused_004_pos - https://github.com/zfsonlinux/zfs/issues/5513 [tests/functional/snapused] tests = ['snapused_001_pos', 'snapused_002_pos', 'snapused_003_pos', 'snapused_005_pos'] +tags = ['functional', 'snapused'] [tests/functional/sparse] tests = ['sparse_001_pos'] +tags = ['functional', 'sparse'] [tests/functional/threadsappend] tests = ['threadsappend_001_pos'] +tags = ['functional', 'threadsappend'] [tests/functional/tmpfile] tests = ['tmpfile_001_pos', 'tmpfile_002_pos', 'tmpfile_003_pos'] +tags = ['functional', 'tmpfile'] [tests/functional/truncate] -tests = ['truncate_001_pos', 'truncate_002_pos'] +tests = ['truncate_001_pos', 'truncate_002_pos', 'truncate_timestamps'] +tags = ['functional', 'truncate'] [tests/functional/upgrade] tests = [ 'upgrade_userobj_001_pos' ] +tags = ['functional', 'upgrade'] [tests/functional/userquota] tests = [ @@ -551,35 +657,44 @@ tests = [ 'userquota_013_pos', 'userspace_001_pos', 'userspace_002_pos', 'userspace_003_pos', 'groupspace_001_pos', 'groupspace_002_pos', 'groupspace_003_pos' ] +tags = ['functional', 'userquota'] # vdev_zaps_007_pos -- fails due to a pre-existing issue with zpool split [tests/functional/vdev_zaps] tests = ['vdev_zaps_001_pos', 'vdev_zaps_002_pos', 'vdev_zaps_003_pos', 'vdev_zaps_004_pos', 'vdev_zaps_005_pos', 'vdev_zaps_006_pos'] +tags = ['functional', 'vdev_zaps'] [tests/functional/write_dirs] tests = ['write_dirs_001_pos', 'write_dirs_002_pos'] +tags = ['functional', 'write_dirs'] [tests/functional/xattr] tests = ['xattr_001_pos', 'xattr_002_neg', 'xattr_003_neg', 'xattr_004_pos', 'xattr_005_pos', 'xattr_006_pos', 'xattr_007_neg', 'xattr_008_pos', 'xattr_009_neg', 'xattr_010_neg', 'xattr_011_pos', 'xattr_012_pos', 'xattr_013_pos'] +tags = ['functional', 'xattr'] [tests/functional/zvol/zvol_ENOSPC] tests = ['zvol_ENOSPC_001_pos'] +tags = ['functional', 'zvol', 'zvol_ENOSPC'] [tests/functional/zvol/zvol_cli] tests = ['zvol_cli_001_pos', 'zvol_cli_002_pos', 'zvol_cli_003_neg'] +tags = ['functional', 'zvol', 'zvol_cli'] [tests/functional/zvol/zvol_misc] tests = ['zvol_misc_001_neg', 'zvol_misc_002_pos', 'zvol_misc_003_neg', 'zvol_misc_004_pos', 'zvol_misc_005_neg', 'zvol_misc_006_pos', 'zvol_misc_snapdev', 'zvol_misc_volmode', 'zvol_misc_zil'] +tags = ['functional', 'zvol', 'zvol_misc'] [tests/functional/zvol/zvol_swap] tests = ['zvol_swap_001_pos', 'zvol_swap_002_pos', 'zvol_swap_003_pos', 'zvol_swap_004_pos', 'zvol_swap_005_pos', 'zvol_swap_006_pos'] +tags = ['functional', 'zvol', 'zvol_swap'] [tests/functional/libzfs] tests = ['many_fds'] +tags = ['functional', 'libzfs'] diff --git a/tests/test-runner/cmd/test-runner.py b/tests/test-runner/cmd/test-runner.py index 4c53257d..a2b3830b 100755 --- a/tests/test-runner/cmd/test-runner.py +++ b/tests/test-runner/cmd/test-runner.py @@ -119,7 +119,8 @@ class Output(object): class Cmd(object): verified_users = [] - def __init__(self, pathname, outputdir=None, timeout=None, user=None): + def __init__(self, pathname, outputdir=None, timeout=None, user=None, + tags=None): self.pathname = pathname self.outputdir = outputdir or 'BASEDIR' self.timeout = timeout @@ -150,7 +151,7 @@ class Cmd(object): try: kp = Popen(cmd) kp.wait() - except: + except Exception: pass def update_cmd_privs(self, cmd, user): @@ -294,15 +295,17 @@ class Cmd(object): class Test(Cmd): props = ['outputdir', 'timeout', 'user', 'pre', 'pre_user', 'post', - 'post_user'] + 'post_user', 'tags'] def __init__(self, pathname, outputdir=None, timeout=None, user=None, - pre=None, pre_user=None, post=None, post_user=None): + pre=None, pre_user=None, post=None, post_user=None, + tags=None): super(Test, self).__init__(pathname, outputdir, timeout, user) self.pre = pre or '' self.pre_user = pre_user or '' self.post = post or '' self.post_user = post_user or '' + self.tags = tags or [] def __str__(self): post_user = pre_user = '' @@ -311,9 +314,9 @@ class Test(Cmd): if len(self.post_user): post_user = ' (as %s)' % (self.post_user) return "Pathname: %s\nOutputdir: %s\nTimeout: %d\nPre: %s%s\nPost: " \ - "%s%s\nUser: %s\n" % \ + "%s%s\nUser: %s\nTags: %s\n" % \ (self.pathname, self.outputdir, self.timeout, self.pre, - pre_user, self.post, post_user, self.user) + pre_user, self.post, post_user, self.user, self.tags) def verify(self, logger): """ @@ -374,9 +377,9 @@ class TestGroup(Test): def __init__(self, pathname, outputdir=None, timeout=None, user=None, pre=None, pre_user=None, post=None, post_user=None, - tests=None): + tests=None, tags=None): super(TestGroup, self).__init__(pathname, outputdir, timeout, user, - pre, pre_user, post, post_user) + pre, pre_user, post, post_user, tags) self.tests = tests or [] def __str__(self): @@ -385,10 +388,10 @@ class TestGroup(Test): pre_user = ' (as %s)' % (self.pre_user) if len(self.post_user): post_user = ' (as %s)' % (self.post_user) - return "Pathname: %s\nOutputdir: %s\nTests: %s\nTimeout: %d\n" \ - "Pre: %s%s\nPost: %s%s\nUser: %s\n" % \ + return "Pathname: %s\nOutputdir: %s\nTests: %s\nTimeout: %s\n" \ + "Pre: %s%s\nPost: %s%s\nUser: %s\nTags: %s\n" % \ (self.pathname, self.outputdir, self.tests, self.timeout, - self.pre, pre_user, self.post, post_user, self.user) + self.pre, pre_user, self.post, post_user, self.user, self.tags) def verify(self, logger): """ @@ -441,6 +444,10 @@ class TestGroup(Test): doesn't pass, skip all the tests in this TestGroup. Run the post script regardless. """ + # tags assigned to this test group also include the test names + if options.tags and not set(self.tags).intersection(set(options.tags)): + return + odir = os.path.join(self.outputdir, os.path.basename(self.pre)) pretest = Cmd(self.pre, outputdir=odir, timeout=self.timeout, user=self.pre_user) @@ -488,7 +495,8 @@ class TestRun(object): ('pre', ''), ('pre_user', ''), ('post', ''), - ('post_user', '') + ('post_user', ''), + ('tags', []) ] def __str__(self): @@ -566,7 +574,12 @@ class TestRun(object): for prop in TestGroup.props: for sect in ['DEFAULT', section]: if config.has_option(sect, prop): - setattr(testgroup, prop, config.get(sect, prop)) + if prop is "tags": + setattr(testgroup, prop, + eval(config.get(sect, prop))) + else: + setattr(testgroup, prop, + config.get(sect, prop)) # Repopulate tests using eval to convert the string to a list testgroup.tests = eval(config.get(section, 'tests')) @@ -629,16 +642,16 @@ class TestRun(object): base = self.outputdir while not done: - l = [] + paths = [] components -= 1 for testfile in tmp_dict.keys(): uniq = '/'.join(testfile.split('/')[components:]).lstrip('/') - if uniq not in l: - l.append(uniq) + if uniq not in paths: + paths.append(uniq) tmp_dict[testfile].outputdir = os.path.join(base, uniq) else: break - done = total == len(l) + done = total == len(paths) def setup_logging(self, options): """ @@ -696,10 +709,13 @@ class TestRun(object): else: print 'Could not make a symlink to directory %s' % ( self.outputdir) - for test in sorted(self.tests.keys()): - self.tests[test].run(self.logger, options) - for testgroup in sorted(self.testgroups.keys()): - self.testgroups[testgroup].run(self.logger, options) + iteration = 0 + while iteration < options.iterations: + for test in sorted(self.tests.keys()): + self.tests[test].run(self.logger, options) + for testgroup in sorted(self.testgroups.keys()): + self.testgroups[testgroup].run(self.logger, options) + iteration += 1 def summary(self): if Result.total is 0: @@ -806,6 +822,8 @@ def options_cb(option, opt_str, value, parser): parser.values.cmd = 'rdconfig' if option.dest is 'template': parser.values.cmd = 'wrconfig' + if option.dest is 'tags': + value = [x.strip() for x in value.split(',')] setattr(parser.values, option.dest, value) if option.dest in path_options: @@ -850,6 +868,12 @@ def parse_args(): parser.add_option('-X', action='callback', callback=options_cb, default='', dest='post_user', metavar='post_user', type='string', help='Specify a user to execute the post script.') + parser.add_option('-T', action='callback', callback=options_cb, default='', + dest='tags', metavar='tags', type='string', + help='Specify tags to execute specific test groups.') + parser.add_option('-I', action='callback', callback=options_cb, default=1, + dest='iterations', metavar='iterations', type='int', + help='Number of times to run the test run.') (options, pathnames) = parser.parse_args() if not options.runfile and not options.template: diff --git a/tests/zfs-tests/include/default.cfg b/tests/zfs-tests/include/default.cfg index e5c46da8..dbcb4ec1 100644 --- a/tests/zfs-tests/include/default.cfg +++ b/tests/zfs-tests/include/default.cfg @@ -177,6 +177,8 @@ if is_linux; then DEV_MPATHDIR="/dev/mapper" ZEDLET_DIR="/var/tmp/zed" + ZED_LOG="$ZEDLET_DIR/zed.log" + ZED_DEBUG_LOG="$ZEDLET_DIR/zed.debug.log" VDEVID_CONF="$ZEDLET_DIR/vdev_id.conf" VDEVID_CONF_ETC="/etc/zfs/vdev_id.conf" @@ -198,4 +200,4 @@ else fi export unpack_opts pack_opts verbose unpack_preserve pack_preserve \ ZVOL_DEVDIR ZVOL_RDEVDIR NEWFS_DEFAULT_FS DEV_RDSKDIR DEV_MPATHDIR \ - ZEDLET_DIR VDEVID_CONF VDEVID_CONF_ETC + ZEDLET_DIR ZED_LOG ZED_DEBUG_LOG VDEVID_CONF VDEVID_CONF_ETC diff --git a/tests/zfs-tests/include/default.cfg.in b/tests/zfs-tests/include/default.cfg.in index 9ac74f29..392b5209 100644 --- a/tests/zfs-tests/include/default.cfg.in +++ b/tests/zfs-tests/include/default.cfg.in @@ -177,6 +177,8 @@ if is_linux; then DEV_MPATHDIR="/dev/mapper" ZEDLET_DIR="/var/tmp/zed" + ZED_LOG="$ZEDLET_DIR/zed.log" + ZED_DEBUG_LOG="$ZEDLET_DIR/zed.debug.log" VDEVID_CONF="$ZEDLET_DIR/vdev_id.conf" VDEVID_CONF_ETC="/etc/zfs/vdev_id.conf" @@ -198,4 +200,4 @@ else fi export unpack_opts pack_opts verbose unpack_preserve pack_preserve \ ZVOL_DEVDIR ZVOL_RDEVDIR NEWFS_DEFAULT_FS DEV_RDSKDIR DEV_MPATHDIR \ - ZEDLET_DIR VDEVID_CONF VDEVID_CONF_ETC + ZEDLET_DIR ZED_LOG ZED_DEBUG_LOG VDEVID_CONF VDEVID_CONF_ETC diff --git a/tests/zfs-tests/include/libtest.shlib b/tests/zfs-tests/include/libtest.shlib index c88b71f9..345d1903 100644 --- a/tests/zfs-tests/include/libtest.shlib +++ b/tests/zfs-tests/include/libtest.shlib @@ -3320,11 +3320,14 @@ function zed_setup # Customize the zed.rc file to enable the full debug log. log_must sed -i '/\#ZED_DEBUG_LOG=.*/d' $ZEDLET_DIR/zed.rc - echo "ZED_DEBUG_LOG=$ZEDLET_DIR/zed.debug.log" >>$ZEDLET_DIR/zed.rc + echo "ZED_DEBUG_LOG=$ZED_DEBUG_LOG" >>$ZEDLET_DIR/zed.rc + # Scripts must only be user writable. + saved_umask=$(umask) + log_must umask 0022 log_must cp ${ZEDLET_LIBEXEC_DIR}/all-syslog.sh $ZEDLET_DIR log_must cp ${ZEDLET_LIBEXEC_DIR}/all-debug.sh $ZEDLET_DIR - log_must touch $ZEDLET_DIR/zed.debug.log + log_must umask $saved_umask } # @@ -3340,10 +3343,9 @@ function zed_cleanup log_must rm -f ${ZEDLET_DIR}/zed-functions.sh log_must rm -f ${ZEDLET_DIR}/all-syslog.sh log_must rm -f ${ZEDLET_DIR}/all-debug.sh - log_must rm -f ${ZEDLET_DIR}/zed.pid - log_must rm -f ${ZEDLET_DIR}/zedlog - log_must rm -f ${ZEDLET_DIR}/zed.debug.log log_must rm -f ${ZEDLET_DIR}/state + log_must rm -f $ZED_LOG + log_must rm -f $ZED_DEBUG_LOG log_must rm -f $VDEVID_CONF_ETC log_must rm -f $VDEVID_CONF rmdir $ZEDLET_DIR @@ -3371,9 +3373,10 @@ function zed_start log_note "Starting ZED" # run ZED in the background and redirect foreground logging - # output to zedlog + # output to $ZED_LOG. + log_must truncate -s 0 $ZED_DEBUG_LOG log_must eval "zed -vF -d $ZEDLET_DIR -p $ZEDLET_DIR/zed.pid" \ - "-s $ZEDLET_DIR/state 2>${ZEDLET_DIR}/zedlog &" + "-s $ZEDLET_DIR/state 2>$ZED_LOG &" return 0 } @@ -3390,7 +3393,9 @@ function zed_stop log_note "Stopping ZED" if [[ -f ${ZEDLET_DIR}/zed.pid ]]; then zedpid=$(cat ${ZEDLET_DIR}/zed.pid) - log_must kill $zedpid + kill $zedpid + wait $zedpid + rm -f ${ZEDLET_DIR}/zed.pid fi return 0 diff --git a/tests/zfs-tests/include/math.shlib b/tests/zfs-tests/include/math.shlib index 4ed11fb4..66658cdd 100644 --- a/tests/zfs-tests/include/math.shlib +++ b/tests/zfs-tests/include/math.shlib @@ -66,3 +66,33 @@ function to_bytes return 0 } + +# +# Verify $a is equal to $b, otherwise raise an error specifying +# the $type of values being compared +# +function verify_eq # +{ + typeset a=$1 + typeset b=$2 + typeset type=$3 + + if [[ $a -ne $b ]]; then + log_fail "Compared $type should be equal: $a != $b" + fi +} + +# +# Verify $a is not equal to $b, otherwise raise an error specifying +# the $type of values being compared +# +function verify_ne # +{ + typeset a=$1 + typeset b=$2 + typeset type=$3 + + if [[ $a -eq $b ]]; then + log_fail "Compared $type should be not equal: $a == $b" + fi +} diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_010_pos.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_010_pos.ksh index f949e8ae..8b8eade4 100755 --- a/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_010_pos.ksh +++ b/tests/zfs-tests/tests/functional/cli_root/zpool_add/zpool_add_010_pos.ksh @@ -37,10 +37,10 @@ # Verify zpool add succeed when adding vdevs with matching redundancy. # # STRATEGY: -# 1. Create base filesystem to hold virtual disk files. -# 2. Create several files == $MINVDEVSIZE. -# 3. Create pool with given redundancy. -# 3. Verify 'zpool add' succeed with with matching redundancy. +# 1. Create several files == $MINVDEVSIZE. +# 2. Verify 'zpool add' succeeds with matching redundancy. +# 3. Verify 'zpool add' warns with differing redundancy. +# 4. Verify 'zpool add' warns with differing redundancy after removal. # verify_runnable "global" @@ -48,21 +48,24 @@ verify_runnable "global" function cleanup { datasetexists $TESTPOOL1 && destroy_pool $TESTPOOL1 - datasetexists $TESTPOOL && destroy_pool $TESTPOOL + + typeset -i i=0 + while ((i < 10)); do + log_must rm -f $TEST_BASE_DIR/vdev$i + ((i += 1)) + done } log_assert "Verify 'zpool add' succeed with keywords combination." log_onexit cleanup -create_pool $TESTPOOL $DISKS -mntpnt=$(get_prop mountpoint $TESTPOOL) - +# 1. Create several files == $MINVDEVSIZE. typeset -i i=0 while ((i < 10)); do - log_must truncate -s $MINVDEVSIZE $mntpnt/vdev$i + log_must truncate -s $MINVDEVSIZE $TEST_BASE_DIR/vdev$i - eval vdev$i=$mntpnt/vdev$i + eval vdev$i=$TEST_BASE_DIR/vdev$i ((i += 1)) done @@ -99,6 +102,10 @@ set -A redundancy3_add_args \ "mirror $vdev5 $vdev6 $vdev7 $vdev8" \ "raidz3 $vdev5 $vdev6 $vdev7 $vdev8" +set -A log_args "log" "$vdev4" +set -A cache_args "cache" "$vdev4" +set -A spare_args "spare" "$vdev4" + typeset -i j=0 function zpool_create_add @@ -140,11 +147,37 @@ function zpool_create_forced_add done } +function zpool_create_rm_add +{ + typeset -n create_args=$1 + typeset -n add_args=$2 + typeset -n rm_args=$3 + + i=0 + while ((i < ${#create_args[@]})); do + j=0 + while ((j < ${#add_args[@]})); do + log_must zpool create $TESTPOOL1 ${create_args[$i]} + log_must zpool add $TESTPOOL1 ${rm_args[0]} ${rm_args[1]} + log_must zpool add $TESTPOOL1 ${add_args[$j]} + log_must zpool remove $TESTPOOL1 ${rm_args[1]} + log_mustnot zpool add $TESTPOOL1 ${rm_args[1]} + log_must zpool add $TESTPOOL1 ${rm_args[0]} ${rm_args[1]} + log_must zpool destroy -f $TESTPOOL1 + + ((j += 1)) + done + ((i += 1)) + done +} + +# 2. Verify 'zpool add' succeeds with matching redundancy. zpool_create_add redundancy0_create_args redundancy0_add_args zpool_create_add redundancy1_create_args redundancy1_add_args zpool_create_add redundancy2_create_args redundancy2_add_args zpool_create_add redundancy3_create_args redundancy3_add_args +# 3. Verify 'zpool add' warns with differing redundancy. zpool_create_forced_add redundancy0_create_args redundancy1_add_args zpool_create_forced_add redundancy0_create_args redundancy2_add_args zpool_create_forced_add redundancy0_create_args redundancy3_add_args @@ -161,4 +194,17 @@ zpool_create_forced_add redundancy3_create_args redundancy0_add_args zpool_create_forced_add redundancy3_create_args redundancy1_add_args zpool_create_forced_add redundancy3_create_args redundancy2_add_args +# 4. Verify 'zpool add' warns with differing redundancy after removal. +zpool_create_rm_add redundancy1_create_args redundancy1_add_args log_args +zpool_create_rm_add redundancy2_create_args redundancy2_add_args log_args +zpool_create_rm_add redundancy3_create_args redundancy3_add_args log_args + +zpool_create_rm_add redundancy1_create_args redundancy1_add_args cache_args +zpool_create_rm_add redundancy2_create_args redundancy2_add_args cache_args +zpool_create_rm_add redundancy3_create_args redundancy3_add_args cache_args + +zpool_create_rm_add redundancy1_create_args redundancy1_add_args spare_args +zpool_create_rm_add redundancy2_create_args redundancy2_add_args spare_args +zpool_create_rm_add redundancy3_create_args redundancy3_add_args spare_args + log_pass "'zpool add' succeed with keywords combination." diff --git a/tests/zfs-tests/tests/functional/events/events_001_pos.ksh b/tests/zfs-tests/tests/functional/events/events_001_pos.ksh index aaf2ad86..5121f66b 100755 --- a/tests/zfs-tests/tests/functional/events/events_001_pos.ksh +++ b/tests/zfs-tests/tests/functional/events/events_001_pos.ksh @@ -55,14 +55,22 @@ log_assert "Verify zpool sub-commands generate expected events" log_onexit cleanup log_must truncate -s $MINVDEVSIZE $VDEV1 $VDEV2 $VDEV3 $VDEV4 + +log_must zpool events -c log_must zed_start # Create a mirrored pool with two devices. run_and_verify -p "$MPOOL" \ - -e "sysevent.fs.zfs.config_sync" \ -e "sysevent.fs.zfs.pool_create" \ + -e "sysevent.fs.zfs.history_event" \ + -e "sysevent.fs.zfs.config_sync" \ "zpool create $MPOOL mirror $VDEV1 $VDEV2" +# Set a pool property. +run_and_verify -p "$MPOOL" \ + -e "sysevent.fs.zfs.history_event" \ + "zpool set comment=string $MPOOL" + # Add a cache device then remove it. run_and_verify -p "$MPOOL" \ -e "sysevent.fs.zfs.config_sync" \ @@ -86,15 +94,22 @@ run_and_verify -p "$MPOOL"\ -e "resource.fs.zfs.statechange" \ -e "sysevent.fs.zfs.config_sync" \ "zpool offline $MPOOL $VDEV1" -run_and_verify -p "$MPOOL" \ +run_and_verify -p "$MPOOL" -d 10 \ -e "resource.fs.zfs.statechange" \ -e "sysevent.fs.zfs.vdev_online" \ + -e "sysevent.fs.zfs.resilver_start" \ + -e "sysevent.fs.zfs.resilver_finish" \ + -e "sysevent.fs.zfs.history_event" \ -e "sysevent.fs.zfs.config_sync" \ "zpool online $MPOOL $VDEV1" # Attach then detach a device from the mirror. -run_and_verify -p "$MPOOL" \ - -e "sysevent.fs.zfs.vdev_attach" \ +run_and_verify -p "$MPOOL" -d 10 \ + -e "sysevent.fs.zfs.vdev_attach" \ + -e "sysevent.fs.zfs.resilver_start" \ + -e "sysevent.fs.zfs.resilver_finish" \ + -e "sysevent.fs.zfs.history_event" \ + -e "sysevent.fs.zfs.config_sync" \ "zpool attach $MPOOL $VDEV1 $VDEV4" run_and_verify -p "$MPOOL" \ -e "sysevent.fs.zfs.vdev_remove" \ @@ -102,26 +117,30 @@ run_and_verify -p "$MPOOL" \ "zpool detach $MPOOL $VDEV4" # Replace a device -run_and_verify -p "$MPOOL" \ +run_and_verify -p "$MPOOL" -d 10 \ -e "sysevent.fs.zfs.vdev_attach" \ -e "sysevent.fs.zfs.resilver_start" \ -e "sysevent.fs.zfs.resilver_finish" \ + -e "sysevent.fs.zfs.vdev_remove" \ + -e "sysevent.fs.zfs.history_event" \ -e "sysevent.fs.zfs.config_sync" \ "zpool replace -f $MPOOL $VDEV1 $VDEV4" # Scrub a pool. -run_and_verify -p "$MPOOL" \ +run_and_verify -p "$MPOOL" -d 10 \ -e "sysevent.fs.zfs.scrub_start" \ -e "sysevent.fs.zfs.scrub_finish" \ + -e "sysevent.fs.zfs.history_event" \ "zpool scrub $MPOOL" -# Export then import a pool (may change to a pool_export event) +# Export then import a pool run_and_verify -p "$MPOOL" \ - -e "sysevent.fs.zfs.pool_destroy" \ + -e "sysevent.fs.zfs.pool_export" \ -e "sysevent.fs.zfs.config_sync" \ "zpool export $MPOOL" run_and_verify -p "$MPOOL" \ -e "sysevent.fs.zfs.pool_import" \ + -e "sysevent.fs.zfs.history_event" \ -e "sysevent.fs.zfs.config_sync" \ "zpool import -d $TEST_BASE_DIR $MPOOL" diff --git a/tests/zfs-tests/tests/functional/events/events_002_pos.ksh b/tests/zfs-tests/tests/functional/events/events_002_pos.ksh index 7769b45c..b5cb3bb1 100755 --- a/tests/zfs-tests/tests/functional/events/events_002_pos.ksh +++ b/tests/zfs-tests/tests/functional/events/events_002_pos.ksh @@ -29,7 +29,7 @@ # Verify ZED handles missed events from a pool when starting. # # STRATEGY: -# 1. Create a pool and generate some events. +# 1. Clear the events and create a pool to generate some events. # 2. Start the ZED and verify it handles missed events. # 3. Stop the ZED # 4. Generate additional events. @@ -51,7 +51,6 @@ function cleanup done log_must rm -f $TMP_EVENTS_ZED $TMP_EVENTS_ZED - log_must rm -f $ZEDLET_DIR/zed.debug.log.old log_must zed_stop } @@ -61,24 +60,25 @@ log_onexit cleanup log_must truncate -s $MINVDEVSIZE $VDEV1 $VDEV2 # 1. Create a pool and generate some events. -log_must cp -f $ZEDLET_DIR/zed.debug.log $ZEDLET_DIR/zed.debug.log.old +log_must truncate -s 0 $ZED_DEBUG_LOG +log_must zpool events -c log_must zpool create $MPOOL mirror $VDEV1 $VDEV2 # 2. Start the ZED and verify it handles missed events. log_must zed_start -log_must sleep 1 -diff $ZEDLET_DIR/zed.debug.log.old $ZEDLET_DIR/zed.debug.log | \ - grep "^> " | sed 's/^> //g' >$TMP_EVENTS_ZED -log_must awk -v event="sysevent.fs.zfs.pool_create" \ +log_must file_wait $ZED_DEBUG_LOG +log_must cp $ZED_DEBUG_LOG $TMP_EVENTS_ZED + +awk -v event="sysevent.fs.zfs.pool_create" \ 'BEGIN{FS="\n"; RS=""} $0 ~ event { print $0 }' \ $TMP_EVENTS_ZED >$TMP_EVENT_ZED log_must grep -q "^ZEVENT_POOL=$MPOOL" $TMP_EVENT_ZED # 3. Stop the ZED zed_stop +log_must truncate -s 0 $ZED_DEBUG_LOG # 4. Generate additional events. -log_must cp -f $ZEDLET_DIR/zed.debug.log $ZEDLET_DIR/zed.debug.log.old log_must zpool offline $MPOOL $VDEV1 log_must zpool online $MPOOL $VDEV1 log_must zpool scrub $MPOOL @@ -90,9 +90,8 @@ done # 5. Start the ZED and verify it only handled the new missed events. log_must zed_start -log_must sleep 3 -diff $ZEDLET_DIR/zed.debug.log.old $ZEDLET_DIR/zed.debug.log | \ - grep "^> " | sed 's/^> //g' >$TMP_EVENTS_ZED +log_must file_wait $ZED_DEBUG_LOG 15 +log_must cp $ZED_DEBUG_LOG $TMP_EVENTS_ZED log_mustnot grep -q "sysevent.fs.zfs.pool_create" $TMP_EVENTS_ZED log_must grep -q "sysevent.fs.zfs.vdev_online" $TMP_EVENTS_ZED diff --git a/tests/zfs-tests/tests/functional/events/events_common.kshlib b/tests/zfs-tests/tests/functional/events/events_common.kshlib index 9ef97ca6..5c411936 100755 --- a/tests/zfs-tests/tests/functional/events/events_common.kshlib +++ b/tests/zfs-tests/tests/functional/events/events_common.kshlib @@ -27,13 +27,39 @@ . $STF_SUITE/include/libtest.shlib . $STF_SUITE/tests/functional/events/events.cfg +# +# Wait for up to 'timeout' seconds for the 'file' to settle, i.e. +# not be updated for a period of 'delay' seconds. +# +function file_wait # file delay timeout +{ + file=$1 + delay=${2:-3} + timeout=${3:-120} + + SECONDS=0 + + while [ $(( $(date +%s) - $(stat -c %Y $file) )) -lt $delay ]; do + if [[ $SECONDS -gt $timeout ]]; then + return 1 + fi + + sleep 1 + done + + return 0; +} + function run_and_verify { - typeset event pool + typeset delay event pool zedlog set -A events - while getopts "e:p:z:" opt; do + while getopts "d:e:p:z:" opt; do case $opt in + d) + delay=$OPTARG + ;; e) events[${#events[*]}+1]=$OPTARG ;; @@ -48,7 +74,8 @@ function run_and_verify shift $(($OPTIND - 1)) pool=${pool:-$TESTPOOL} - zedlog=${zedlog:-$ZEDLET_DIR/zed.debug.log} + delay=${delay:-3} + zedlog=${zedlog:-$ZED_DEBUG_LOG} fullcmd="$1" cmd=$(echo $fullcmd | awk '{print $1}') subcmd=$(echo $fullcmd | awk '{print $2}') @@ -57,21 +84,28 @@ function run_and_verify [[ $cmd == "zpool" || $cmd == "zfs" ]] || \ log_fail "run_and_verify called with \"$cmd ($fullcmd)\"" - # Run the command as provided and collect the new events. + log_note "Checking events for command: '$fullcmd'" + + # Remove any previous events from the logs. log_must zpool events -c - if [[ -f $zedlog ]]; then - cp -f $zedlog $zedlog.old - fi + log_must truncate -s 0 $zedlog + # Run the command as provided. log_must eval "$fullcmd" - log_must zpool events > $TMP_EVENTS 2>/dev/null - log_must zpool events -v > $TMP_EVENTS_FULL 2>/dev/null - if [[ -f $zedlog ]]; then - sleep 5 # Brief delay for the ZED to handle the event. - diff $zedlog.old $zedlog | grep "^> " | sed 's/^> //g' \ - >$TMP_EVENTS_ZED - fi + # Collect the new events and verify there are some. + log_must zpool sync -f + log_must file_wait $zedlog $delay + log_must cp $zedlog $TMP_EVENTS_ZED + log_must eval "zpool events >$TMP_EVENTS 2>/dev/null" + log_must eval "zpool events -v > $TMP_EVENTS_FULL 2>/dev/null" + + log_must test -s $TMP_EVENTS + log_must test -s $TMP_EVENTS_FULL + log_must test -s $TMP_EVENTS_ZED + + log_note "Events generated:" + cat $TMP_EVENTS # Verify all the expected events appear in the log. for event in ${events[*]}; do @@ -80,19 +114,18 @@ function run_and_verify log_must grep -q "$event" $TMP_EVENTS # Verify the event is in the verbose output with pool name. - log_must awk -v event="$event" \ + awk -v event="$event" \ 'BEGIN{FS="\n"; RS=""} $0 ~ event { print $0 }' \ $TMP_EVENTS_FULL >$TMP_EVENT_FULL log_must grep -q "pool = \"$pool\"" $TMP_EVENT_FULL # Verify the event was received by the ZED and logged. - log_must awk -v event="$event" \ + awk -v event="$event" \ 'BEGIN{FS="\n"; RS=""} $0 ~ event { print $0 }' \ $TMP_EVENTS_ZED >$TMP_EVENT_ZED log_must grep -q "^ZEVENT_POOL=$pool" $TMP_EVENT_ZED - done - log_must rm -f $TMP_EVENTS $TMP_EVENTS_FULL $TMP_EVENT_FULL \ - $TMP_EVENTS_ZED $TMP_EVENT_ZED $zedlog.old + rm -f $TMP_EVENTS $TMP_EVENTS_FULL $TMP_EVENT_FULL \ + $TMP_EVENTS_ZED $TMP_EVENT_ZED } diff --git a/tests/zfs-tests/tests/functional/truncate/Makefile.am b/tests/zfs-tests/tests/functional/truncate/Makefile.am index 16cadf29..0071e8f8 100644 --- a/tests/zfs-tests/tests/functional/truncate/Makefile.am +++ b/tests/zfs-tests/tests/functional/truncate/Makefile.am @@ -1,7 +1,16 @@ +include $(top_srcdir)/config/Rules.am + pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/truncate + dist_pkgdata_SCRIPTS = \ setup.ksh \ cleanup.ksh \ truncate.cfg \ truncate_001_pos.ksh \ - truncate_002_pos.ksh + truncate_002_pos.ksh \ + truncate_timestamps.ksh + +pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/truncate + +pkgexec_PROGRAMS = truncate_test +truncate_test_SOURCES = truncate_test.c diff --git a/tests/zfs-tests/tests/functional/truncate/Makefile.in b/tests/zfs-tests/tests/functional/truncate/Makefile.in index 06daf47b..be35d608 100644 --- a/tests/zfs-tests/tests/functional/truncate/Makefile.in +++ b/tests/zfs-tests/tests/functional/truncate/Makefile.in @@ -15,6 +15,7 @@ @SET_MAKE@ + VPATH = @srcdir@ pkgincludedir = $(includedir)/@PACKAGE@ pkglibdir = $(libdir)/@PACKAGE@ @@ -34,9 +35,10 @@ POST_UNINSTALL = : build_triplet = @build@ host_triplet = @host@ target_triplet = @target@ -subdir = tests/zfs-tests/tests/functional/truncate DIST_COMMON = $(dist_pkgdata_SCRIPTS) $(srcdir)/Makefile.am \ - $(srcdir)/Makefile.in + $(srcdir)/Makefile.in $(top_srcdir)/config/Rules.am +pkgexec_PROGRAMS = truncate_test$(EXEEXT) +subdir = tests/zfs-tests/tests/functional/truncate ACLOCAL_M4 = $(top_srcdir)/aclocal.m4 am__aclocal_m4_deps = $(top_srcdir)/config/always-arch.m4 \ $(top_srcdir)/config/always-no-bool-compare.m4 \ @@ -152,6 +154,14 @@ mkinstalldirs = $(install_sh) -d CONFIG_HEADER = $(top_builddir)/zfs_config.h CONFIG_CLEAN_FILES = CONFIG_CLEAN_VPATH_FILES = +am__installdirs = "$(DESTDIR)$(pkgexecdir)" "$(DESTDIR)$(pkgdatadir)" +PROGRAMS = $(pkgexec_PROGRAMS) +am_truncate_test_OBJECTS = truncate_test.$(OBJEXT) +truncate_test_OBJECTS = $(am_truncate_test_OBJECTS) +truncate_test_LDADD = $(LDADD) +AM_V_lt = $(am__v_lt_$(V)) +am__v_lt_ = $(am__v_lt_$(AM_DEFAULT_VERBOSITY)) +am__v_lt_0 = --silent am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; am__vpath_adj = case $$p in \ $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \ @@ -173,16 +183,36 @@ am__nobase_list = $(am__nobase_strip_setup); \ am__base_list = \ sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \ sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g' -am__installdirs = "$(DESTDIR)$(pkgdatadir)" SCRIPTS = $(dist_pkgdata_SCRIPTS) -AM_V_GEN = $(am__v_GEN_$(V)) -am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) -am__v_GEN_0 = @echo " GEN " $@; +depcomp = $(SHELL) $(top_srcdir)/config/depcomp +am__depfiles_maybe = depfiles +am__mv = mv -f +COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \ + $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) +LTCOMPILE = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) \ + $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \ + $(AM_CFLAGS) $(CFLAGS) +AM_V_CC = $(am__v_CC_$(V)) +am__v_CC_ = $(am__v_CC_$(AM_DEFAULT_VERBOSITY)) +am__v_CC_0 = @echo " CC " $@; AM_V_at = $(am__v_at_$(V)) am__v_at_ = $(am__v_at_$(AM_DEFAULT_VERBOSITY)) am__v_at_0 = @ -SOURCES = -DIST_SOURCES = +CCLD = $(CC) +LINK = $(LIBTOOL) $(AM_V_lt) --tag=CC $(AM_LIBTOOLFLAGS) \ + $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \ + $(AM_LDFLAGS) $(LDFLAGS) -o $@ +AM_V_CCLD = $(am__v_CCLD_$(V)) +am__v_CCLD_ = $(am__v_CCLD_$(AM_DEFAULT_VERBOSITY)) +am__v_CCLD_0 = @echo " CCLD " $@; +AM_V_GEN = $(am__v_GEN_$(V)) +am__v_GEN_ = $(am__v_GEN_$(AM_DEFAULT_VERBOSITY)) +am__v_GEN_0 = @echo " GEN " $@; +SOURCES = $(truncate_test_SOURCES) +DIST_SOURCES = $(truncate_test_SOURCES) +ETAGS = etags +CTAGS = ctags DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST) pkgdatadir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/truncate ACLOCAL = @ACLOCAL@ @@ -387,17 +417,33 @@ top_builddir = @top_builddir@ top_srcdir = @top_srcdir@ udevdir = @udevdir@ udevruledir = @udevruledir@ +DEFAULT_INCLUDES = -include ${top_builddir}/zfs_config.h +AM_LIBTOOLFLAGS = --silent +AM_CFLAGS = ${DEBUG_CFLAGS} -Wall -Wstrict-prototypes \ + ${NO_UNUSED_BUT_SET_VARIABLE} ${NO_BOOL_COMPARE} \ + -fno-strict-aliasing -std=gnu99 +AM_CPPFLAGS = -D_GNU_SOURCE -D__EXTENSIONS__ -D_REENTRANT \ + -D_POSIX_PTHREAD_SEMANTICS -D_FILE_OFFSET_BITS=64 \ + -D_LARGEFILE64_SOURCE -DHAVE_LARGE_STACKS=1 \ + -DTEXT_DOMAIN=\"zfs-linux-user\" \ + -DLIBEXECDIR=\"$(libexecdir)\" \ + -DRUNSTATEDIR=\"$(runstatedir)\" -DSBINDIR=\"$(sbindir)\" \ + -DSYSCONFDIR=\"$(sysconfdir)\" dist_pkgdata_SCRIPTS = \ setup.ksh \ cleanup.ksh \ truncate.cfg \ truncate_001_pos.ksh \ - truncate_002_pos.ksh + truncate_002_pos.ksh \ + truncate_timestamps.ksh +pkgexecdir = $(datadir)/@PACKAGE@/zfs-tests/tests/functional/truncate +truncate_test_SOURCES = truncate_test.c all: all-am .SUFFIXES: -$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps) +.SUFFIXES: .c .lo .o .obj +$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(top_srcdir)/config/Rules.am $(am__configure_deps) @for dep in $?; do \ case '$(am__configure_deps)' in \ *$$dep*) \ @@ -427,6 +473,52 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps) $(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps) cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh $(am__aclocal_m4_deps): +install-pkgexecPROGRAMS: $(pkgexec_PROGRAMS) + @$(NORMAL_INSTALL) + test -z "$(pkgexecdir)" || $(MKDIR_P) "$(DESTDIR)$(pkgexecdir)" + @list='$(pkgexec_PROGRAMS)'; test -n "$(pkgexecdir)" || list=; \ + for p in $$list; do echo "$$p $$p"; done | \ + sed 's/$(EXEEXT)$$//' | \ + while read p p1; do if test -f $$p || test -f $$p1; \ + then echo "$$p"; echo "$$p"; else :; fi; \ + done | \ + sed -e 'p;s,.*/,,;n;h' -e 's|.*|.|' \ + -e 'p;x;s,.*/,,;s/$(EXEEXT)$$//;$(transform);s/$$/$(EXEEXT)/' | \ + sed 'N;N;N;s,\n, ,g' | \ + $(AWK) 'BEGIN { files["."] = ""; dirs["."] = 1 } \ + { d=$$3; if (dirs[d] != 1) { print "d", d; dirs[d] = 1 } \ + if ($$2 == $$4) files[d] = files[d] " " $$1; \ + else { print "f", $$3 "/" $$4, $$1; } } \ + END { for (d in files) print "f", d, files[d] }' | \ + while read type dir files; do \ + if test "$$dir" = .; then dir=; else dir=/$$dir; fi; \ + test -z "$$files" || { \ + echo " $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files '$(DESTDIR)$(pkgexecdir)$$dir'"; \ + $(INSTALL_PROGRAM_ENV) $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL_PROGRAM) $$files "$(DESTDIR)$(pkgexecdir)$$dir" || exit $$?; \ + } \ + ; done + +uninstall-pkgexecPROGRAMS: + @$(NORMAL_UNINSTALL) + @list='$(pkgexec_PROGRAMS)'; test -n "$(pkgexecdir)" || list=; \ + files=`for p in $$list; do echo "$$p"; done | \ + sed -e 'h;s,^.*/,,;s/$(EXEEXT)$$//;$(transform)' \ + -e 's/$$/$(EXEEXT)/' `; \ + test -n "$$list" || exit 0; \ + echo " ( cd '$(DESTDIR)$(pkgexecdir)' && rm -f" $$files ")"; \ + cd "$(DESTDIR)$(pkgexecdir)" && rm -f $$files + +clean-pkgexecPROGRAMS: + @list='$(pkgexec_PROGRAMS)'; test -n "$$list" || exit 0; \ + echo " rm -f" $$list; \ + rm -f $$list || exit $$?; \ + test -n "$(EXEEXT)" || exit 0; \ + list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \ + echo " rm -f" $$list; \ + rm -f $$list +truncate_test$(EXEEXT): $(truncate_test_OBJECTS) $(truncate_test_DEPENDENCIES) + @rm -f truncate_test$(EXEEXT) + $(AM_V_CCLD)$(LINK) $(truncate_test_OBJECTS) $(truncate_test_LDADD) $(LIBS) install-dist_pkgdataSCRIPTS: $(dist_pkgdata_SCRIPTS) @$(NORMAL_INSTALL) test -z "$(pkgdatadir)" || $(MKDIR_P) "$(DESTDIR)$(pkgdatadir)" @@ -462,17 +554,98 @@ uninstall-dist_pkgdataSCRIPTS: echo " ( cd '$(DESTDIR)$(pkgdatadir)' && rm -f" $$files ")"; \ cd "$(DESTDIR)$(pkgdatadir)" && rm -f $$files +mostlyclean-compile: + -rm -f *.$(OBJEXT) + +distclean-compile: + -rm -f *.tab.c + +@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/truncate_test.Po@am__quote@ + +.c.o: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.o$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ $< + +.c.obj: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.obj$$||'`;\ +@am__fastdepCC_TRUE@ $(COMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ `$(CYGPATH_W) '$<'` &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Po +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=no @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(COMPILE) -c -o $@ `$(CYGPATH_W) '$<'` + +.c.lo: +@am__fastdepCC_TRUE@ $(AM_V_CC)depbase=`echo $@ | sed 's|[^/]*$$|$(DEPDIR)/&|;s|\.lo$$||'`;\ +@am__fastdepCC_TRUE@ $(LTCOMPILE) -MT $@ -MD -MP -MF $$depbase.Tpo -c -o $@ $< &&\ +@am__fastdepCC_TRUE@ $(am__mv) $$depbase.Tpo $$depbase.Plo +@am__fastdepCC_FALSE@ $(AM_V_CC) @AM_BACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='$<' object='$@' libtool=yes @AMDEPBACKSLASH@ +@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ +@am__fastdepCC_FALSE@ $(LTCOMPILE) -c -o $@ $< + mostlyclean-libtool: -rm -f *.lo clean-libtool: -rm -rf .libs _libs + +ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + mkid -fID $$unique tags: TAGS -TAGS: +TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + set x; \ + here=`pwd`; \ + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + shift; \ + if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \ + test -n "$$unique" || unique=$$empty_fix; \ + if test $$# -gt 0; then \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + "$$@" $$unique; \ + else \ + $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \ + $$unique; \ + fi; \ + fi ctags: CTAGS -CTAGS: - +CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \ + $(TAGS_FILES) $(LISP) + list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \ + unique=`for i in $$list; do \ + if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \ + done | \ + $(AWK) '{ files[$$0] = 1; nonempty = 1; } \ + END { if (nonempty) { for (i in files) print i; }; }'`; \ + test -z "$(CTAGS_ARGS)$$unique" \ + || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \ + $$unique + +GTAGS: + here=`$(am__cd) $(top_builddir) && pwd` \ + && $(am__cd) $(top_srcdir) \ + && gtags -i $(GTAGS_ARGS) "$$here" + +distclean-tags: + -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags distdir: $(DISTFILES) @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \ @@ -506,9 +679,9 @@ distdir: $(DISTFILES) done check-am: all-am check: check-am -all-am: Makefile $(SCRIPTS) +all-am: Makefile $(PROGRAMS) $(SCRIPTS) installdirs: - for dir in "$(DESTDIR)$(pkgdatadir)"; do \ + for dir in "$(DESTDIR)$(pkgexecdir)" "$(DESTDIR)$(pkgdatadir)"; do \ test -z "$$dir" || $(MKDIR_P) "$$dir"; \ done install: install-am @@ -538,11 +711,14 @@ maintainer-clean-generic: @echo "it deletes files that may require special tools to rebuild." clean: clean-am -clean-am: clean-generic clean-libtool mostlyclean-am +clean-am: clean-generic clean-libtool clean-pkgexecPROGRAMS \ + mostlyclean-am distclean: distclean-am + -rm -rf ./$(DEPDIR) -rm -f Makefile -distclean-am: clean-am distclean-generic +distclean-am: clean-am distclean-compile distclean-generic \ + distclean-tags dvi: dvi-am @@ -562,7 +738,7 @@ install-dvi: install-dvi-am install-dvi-am: -install-exec-am: +install-exec-am: install-pkgexecPROGRAMS install-html: install-html-am @@ -585,12 +761,14 @@ install-ps-am: installcheck-am: maintainer-clean: maintainer-clean-am + -rm -rf ./$(DEPDIR) -rm -f Makefile maintainer-clean-am: distclean-am maintainer-clean-generic mostlyclean: mostlyclean-am -mostlyclean-am: mostlyclean-generic mostlyclean-libtool +mostlyclean-am: mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf: pdf-am @@ -600,21 +778,25 @@ ps: ps-am ps-am: -uninstall-am: uninstall-dist_pkgdataSCRIPTS +uninstall-am: uninstall-dist_pkgdataSCRIPTS uninstall-pkgexecPROGRAMS .MAKE: install-am install-strip -.PHONY: all all-am check check-am clean clean-generic clean-libtool \ - distclean distclean-generic distclean-libtool distdir dvi \ - dvi-am html html-am info info-am install install-am \ - install-data install-data-am install-dist_pkgdataSCRIPTS \ - install-dvi install-dvi-am install-exec install-exec-am \ - install-html install-html-am install-info install-info-am \ - install-man install-pdf install-pdf-am install-ps \ +.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \ + clean-libtool clean-pkgexecPROGRAMS ctags distclean \ + distclean-compile distclean-generic distclean-libtool \ + distclean-tags distdir dvi dvi-am html html-am info info-am \ + install install-am install-data install-data-am \ + install-dist_pkgdataSCRIPTS install-dvi install-dvi-am \ + install-exec install-exec-am install-html install-html-am \ + install-info install-info-am install-man install-pdf \ + install-pdf-am install-pkgexecPROGRAMS install-ps \ install-ps-am install-strip installcheck installcheck-am \ installdirs maintainer-clean maintainer-clean-generic \ - mostlyclean mostlyclean-generic mostlyclean-libtool pdf pdf-am \ - ps ps-am uninstall uninstall-am uninstall-dist_pkgdataSCRIPTS + mostlyclean mostlyclean-compile mostlyclean-generic \ + mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \ + uninstall-am uninstall-dist_pkgdataSCRIPTS \ + uninstall-pkgexecPROGRAMS # Tell versions [3.59,3.63) of GNU make to not export all variables. diff --git a/tests/zfs-tests/tests/functional/truncate/truncate_test.c b/tests/zfs-tests/tests/functional/truncate/truncate_test.c new file mode 100644 index 00000000..3e277e86 --- /dev/null +++ b/tests/zfs-tests/tests/functional/truncate/truncate_test.c @@ -0,0 +1,103 @@ +/* + * This file and its contents are supplied under the terms of the + * Common Development and Distribution License ("CDDL"), version 1.0. + * You may only use this file in accordance with the terms of version + * 1.0 of the CDDL. + * + * A full copy of the text of the CDDL should have accompanied this + * source. A copy of the CDDL is also available via the Internet at + * http://www.illumos.org/license/CDDL. + */ + +/* + * Copyright (c) 2012, 2014 by Delphix. All rights reserved. + * Copyright 2017, loli10K . All rights reserved. + */ + +#include +#include +#include +#include +#include +#include +#include + +#define FSIZE 256*1024*1024 + +static long fsize = FSIZE; +static int errflag = 0; +static char *filename = NULL; +static int ftruncflag = 0; + +static void parse_options(int argc, char *argv[]); + +static void +usage(char *execname) +{ + (void) fprintf(stderr, + "usage: %s [-s filesize] [-f] /path/to/file\n", execname); + (void) exit(1); +} + +int +main(int argc, char *argv[]) +{ + int fd; + + parse_options(argc, argv); + + if (ftruncflag) { + fd = open(filename, O_RDWR|O_CREAT, 0666); + if (fd < 0) { + perror("open"); + return (1); + } + if (ftruncate(fd, fsize) < 0) { + perror("ftruncate"); + return (1); + } + if (close(fd)) { + perror("close"); + return (1); + } + } else { + if (truncate(filename, fsize) < 0) { + perror("truncate"); + return (1); + } + } + return (0); +} + +static void +parse_options(int argc, char *argv[]) +{ + int c; + extern char *optarg; + extern int optind, optopt; + + while ((c = getopt(argc, argv, "s:f")) != -1) { + switch (c) { + case 's': + fsize = atoi(optarg); + break; + case 'f': + ftruncflag++; + break; + case ':': + (void) fprintf(stderr, + "Option -%c requires an operand\n", optopt); + errflag++; + break; + } + if (errflag) { + (void) usage(argv[0]); + } + } + + if (argc <= optind) { + (void) fprintf(stderr, "No filename specified\n"); + usage(argv[0]); + } + filename = argv[optind]; +} diff --git a/tests/zfs-tests/tests/functional/truncate/truncate_timestamps.ksh b/tests/zfs-tests/tests/functional/truncate/truncate_timestamps.ksh new file mode 100755 index 00000000..c365c741 --- /dev/null +++ b/tests/zfs-tests/tests/functional/truncate/truncate_timestamps.ksh @@ -0,0 +1,74 @@ +#!/bin/ksh -p +# +# This file and its contents are supplied under the terms of the +# Common Development and Distribution License ("CDDL"), version 1.0. +# You may only use this file in accordance with the terms of version +# 1.0 of the CDDL. +# +# A full copy of the text of the CDDL should have accompanied this +# source. A copy of the CDDL is also available via the Internet at +# http://www.illumos.org/license/CDDL. +# + +# +# Copyright 2017, loli10K . All rights reserved. +# + +. $STF_SUITE/tests/functional/truncate/truncate.cfg +. $STF_SUITE/include/libtest.shlib +. $STF_SUITE/include/math.shlib + +# +# DESCRIPTION: +# Ensure both truncate(2)/ftruncate(2) update target file mtime/ctime attributes +# +# STRATEGY: +# 1. Create a file +# 2. Truncate the file +# 3. Verify both mtime/ctime are updated +# 4. Rinse and repeat for both truncate(2) and ftruncate(2) with various sizes +# + +verify_runnable "both" + +function verify_truncate #