Meta: 1
Name: zfs
Branch: 1.0
-Version: 0.7.3
+Version: 0.7.4
Release: 1
Release-Tags: relext
License: CDDL
# 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"]
]
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"]
sep
))
sys.stdout.write("\n")
+ sys.stdout.flush()
def print_header():
data = fcntl.ioctl(sys.stdout.fileno(), termios.TIOCGWINSZ, '1234')
sz = struct.unpack('hh', data)
return sz[0]
- except:
+ except Exception:
pass
(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;
&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,
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) {
/*
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])
])
#! /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.
# 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.
# 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]...
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
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,
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 $@
# Define the identity of the package.
PACKAGE='zfs'
- VERSION='0.7.3'
+ VERSION='0.7.4'
cat >>confdefs.h <<_ACEOF
{ $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; }; }
{ $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; }; }
# 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
_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'`\\"
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.
fi
fi
- # Filter out any exceptions...
+ # Filter out any exceptions...
if [ -n "$ZFS_POOL_EXCEPTIONS" ]
then
local found=""
"${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
"$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=""
/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
# 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
zfs-import-scan.service \
zfs-mount.service \
zfs-share.service \
+ zfs-import.target \
zfs.target
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
zfs-import-scan.service \
zfs-mount.service \
zfs-share.service \
+ zfs-import.target \
zfs.target
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
After=cryptsetup.target
After=systemd-remount-fs.service
Before=dracut-mount.service
+Before=zfs-import.target
ConditionPathExists=@sysconfdir@/zfs/zpool.cache
[Service]
ExecStart=@sbindir@/zpool import -c @sysconfdir@/zfs/zpool.cache -aN
[Install]
-WantedBy=zfs-mount.service
-WantedBy=zfs.target
+WantedBy=zfs-import.target
After=systemd-udev-settle.service
After=cryptsetup.target
Before=dracut-mount.service
+Before=zfs-import.target
ConditionPathExists=!@sysconfdir@/zfs/zpool.cache
[Service]
ExecStart=@sbindir@/zpool import -aN -o cachefile=none
[Install]
-WantedBy=zfs-mount.service
-WantedBy=zfs.target
+WantedBy=zfs-import.target
--- /dev/null
+[Unit]
+Description=ZFS pool import target
+
+[Install]
+WantedBy=zfs-mount.service
+WantedBy=zfs.target
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
(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
/*
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,
#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"
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 */
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
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
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)))
/*
* 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, '/');
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.
.\" 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
\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
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
.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
\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
\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
\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
\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
\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
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
.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
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
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,
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,
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 = {{{{{
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 *,
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,
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 = {{{{{
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 *,
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,
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 = {{{{{
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 *,
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,
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 = {{{{{
* 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
};
/*
}
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
}
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
}
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;
}
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 = {
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);
blkptr_t *dh_bp;
int dh_err;
dbuf_dirty_record_t *dh_dr;
- arc_buf_contents_t dh_type;
int dh_depth;
};
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,
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
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,
#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.
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)) {
dh->dh_bp = NULL;
dh->dh_err = 0;
dh->dh_dr = NULL;
- dh->dh_type = 0;
dh->dh_depth = depth;
}
/*
* 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;
}
}
}
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
};
/*
}
/*
- * 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
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;
}
/*
* 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
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;
+ 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;
*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;
* 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.
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.
*/
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.
*/
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
*/
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);
}
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);
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);
* 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;
}
}
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);
}
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
}
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
};
/*
}
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
}
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
};
/*
*
* 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.
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));
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;
}
&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);
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);
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);
}
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);
}
/*
Requires: kernel-devel
%endif
Provides: %{module}-kmod = %{version}
+AutoReqProv: no
%description
This package contains the dkms ZFS kernel modules.
rm -rf $RPM_BUILD_ROOT
%changelog
+* Thu Dec 07 2017 Tony Hutter <hutter2@llnl.gov> - 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 <hutter2@llnl.gov> - 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
# 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
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
%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
%endif
%changelog
+* Thu Dec 07 2017 Tony Hutter <hutter2@llnl.gov> - 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 <hutter2@llnl.gov> - 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
Requires: kernel-devel
%endif
Provides: %{module}-kmod = %{version}
+AutoReqProv: no
%description
This package contains the dkms ZFS kernel modules.
# 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
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
%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
%endif
%changelog
+* Thu Dec 07 2017 Tony Hutter <hutter2@llnl.gov> - 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 <hutter2@llnl.gov> - 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
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"
-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:
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
d)
FILEDIR="$OPTARG"
;;
+ I)
+ ITERATIONS="$OPTARG"
+ if [ "$ITERATIONS" -le 0 ]; then
+ fail "Iterations must be greater than 0."
+ fi
+ ;;
s)
FILESIZE="$OPTARG"
;;
fi
SINGLETEST+=("$OPTARG")
;;
+ T)
+ TAGS="$OPTARG"
+ ;;
u)
SINGLETESTUSER="$OPTARG"
;;
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 ""
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
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',
# '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',
'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',
'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]
'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]
'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
'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',
'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',
'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',
'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',
'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',
'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',
'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',
'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',
'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
'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]
'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',
'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 = [
'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']
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
try:
kp = Popen(cmd)
kp.wait()
- except:
+ except Exception:
pass
def update_cmd_privs(self, cmd, user):
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 = ''
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):
"""
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):
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):
"""
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)
('pre', ''),
('pre_user', ''),
('post', ''),
- ('post_user', '')
+ ('post_user', ''),
+ ('tags', [])
]
def __str__(self):
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'))
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):
"""
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:
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:
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:
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"
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
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"
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
# 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
}
#
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
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
}
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
return 0
}
+
+#
+# Verify $a is equal to $b, otherwise raise an error specifying
+# the $type of values being compared
+#
+function verify_eq # <a> <b> <type>
+{
+ 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 # <a> <b> <type>
+{
+ 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
+}
# 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"
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
"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
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
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."
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" \
-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" \
"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"
# 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.
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
}
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
# 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
. $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
;;
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}')
[[ $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
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
}
+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
@SET_MAKE@
+
VPATH = @srcdir@
pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
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 \
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/||"`;; \
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@
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*) \
$(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)"
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'`; \
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
@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
install-dvi-am:
-install-exec-am:
+install-exec-am: install-pkgexecPROGRAMS
install-html: install-html-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
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.
--- /dev/null
+/*
+ * 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 <ezomori.nozomu@gmail.com>. All rights reserved.
+ */
+
+#include <fcntl.h>
+#include <sys/stat.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <errno.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+#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];
+}
--- /dev/null
+#!/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 <ezomori.nozomu@gmail.com>. 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 # <filename> <filesize> <option>
+{
+ typeset filename="$1"
+ typeset -i size="$2"
+ typeset option="$3"
+
+ log_must mkfile $sizeavg $filename # always start with $sizeavg
+ typeset -i timestm="$(stat -c %Y $filename)"
+ typeset -i timestc="$(stat -c %Z $filename)"
+ log_must sleep 1
+ log_must $STF_SUITE/tests/functional/truncate/truncate_test -s $size $filename $option
+ verify_eq $size "$(stat -c %s $filename)" "size"
+ verify_ne $timestm "$(stat -c %Y $filename)" "mtime"
+ verify_ne $timestc "$(stat -c %Z $filename)" "ctime"
+ log_must rm -f $filename
+}
+
+function cleanup
+{
+ [[ -f $truncfile ]] && rm -f $truncfile
+}
+
+log_assert "Ensure both truncate(2)/ftruncate(2) update target file timestamps"
+log_onexit cleanup
+
+truncfile="$TESTDIR/truncate.$$"
+sizemin="123"
+sizeavg="$((256*1024))"
+sizemax="$((1024*1024))"
+
+# truncate(2)
+verify_truncate $truncfile $sizemin ""
+verify_truncate $truncfile $sizeavg ""
+verify_truncate $truncfile $sizemax ""
+
+# ftruncate(2)
+verify_truncate $truncfile $sizemin "-f"
+verify_truncate $truncfile $sizeavg "-f"
+verify_truncate $truncfile $sizemax "-f"
+
+log_pass "Successful truncation correctly update timestamps"
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/include/math.shlib
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
#
function group_object_count
{
typeset fs=$1
- typeset user=$2
- typeset cnt=$(zfs groupspace -oname,objused $fs | grep $user |
- awk '{print $2}')
- echo $cnt
+ typeset group=$2
+ typeset -i groupspacecnt=$(zfs groupspace -oname,objused $fs |
+ awk /$group/'{print $2}')
+ typeset -i zfsgetcnt=$(zfs get -H -ovalue groupobjused@$group $fs)
+
+ # 'zfs groupspace' and 'zfs get groupobjused@' should be equal
+ verify_eq "$groupspacecnt" "$zfsgetcnt" "groupobjused@$group"
+
+ echo $groupspacecnt
}
log_onexit cleanup
#
. $STF_SUITE/include/libtest.shlib
+. $STF_SUITE/include/math.shlib
. $STF_SUITE/tests/functional/userquota/userquota_common.kshlib
#
{
typeset fs=$1
typeset user=$2
- typeset cnt=$(zfs userspace -oname,objused $fs |
+ typeset -i userspacecnt=$(zfs userspace -oname,objused $fs |
awk /$user/'{print $2}')
- echo $cnt
+ typeset -i zfsgetcnt=$(zfs get -H -ovalue userobjused@$user $fs)
+
+ # 'zfs userspace' and 'zfs get userobjused@' should be equal
+ verify_eq "$userspacecnt" "$zfsgetcnt" "userobjused@$user"
+
+ echo $userspacecnt
}
log_onexit cleanup