Lines Matching +full:sda +full:- +full:open +full:- +full:drain

9 # or https://opensource.org/licenses/CDDL-1.0.
29 # Copyright (c) 2017, Open-E Inc. All rights reserved.
45 PWD="$(readlink -f $PWD)"
52 if [ -n "$STF_PATH" ]; then
63 [ "$(printf "$1\n$2" | sort -V | tail -n1)" = "$1" ]
73 [ -z "$ver" ] && case "$UNAME" in
77 # RHEL7: 3.10.0-1160.108.1.el7.x86_64
78 # Fedora 37: 6.5.12-100.fc37.x86_64
79 # Debian 12.6: 6.1.0-22-amd64
80 ver=$(uname -r | grep -Eo "^[0-9]+\.[0-9]+\.[0-9]+")
83 # FreeBSD version numbers are X.Y-BRANCH-pZ. Depending on
84 # branch, -pZ may not be present, but this is typically only
85 # on pre-release or true .0 releases, so can be assumed 0
88 # 13.2-RELEASE-p4
89 # 14.1-RELEASE
90 # 15.0-CURRENT
91 ver=$(uname -r | \
92 grep -Eo "[0-9]+\.[0-9]+(-[A-Z0-9]+-p[0-9]+)?" | \
93 sed -E "s/-[^-]+-p/./")
102 IFS='.' read -r version major minor _ <<<"$ver"
104 [ -z "$version" ] && version=0
105 [ -z "$major" ] && major=0
106 [ -z "$minor" ] && minor=0
115 # Used for comparison: if [ $(linux_version) -ge $(linux_version "2.6.32") ]
124 # Used for comparison: if [ $(freebsd_version) -ge $(freebsd_version "13.2") ]
155 # Determine if this is a 32-bit system
157 # Return 0 if platform is 32-bit, 1 if otherwise
170 is_linux && [ -e /sys/kernel/debug/kmemleak ]
176 # $2 filesystem type; optional - defaulted to zfs
183 [[ -z $fstype ]] && fstype=zfs
189 ! zfs mount | awk -v fs="$1" '$2 == fs {exit 1}'
191 ! zfs mount | awk -v ds="$1" '$1 == ds {exit 1}'
196 mount -pt $fstype | while read dev dir _t _flags; do
200 out=$(df -F $fstype $1 2>/dev/null) || return
212 df -t $fstype $1 > /dev/null 2>&1
215 if [[ -L "$ZVOL_DEVDIR/$1" ]]; then
216 link=$(readlink -f $ZVOL_DEVDIR/$1)
217 [[ -n "$link" ]] && \
218 mount | grep -q "^$link" && \
231 # $2 filesystem type; optional - defaulted to zfs
241 # $2 filesystem type; optional - defaulted to zfs
277 [[ -d /$TESTPOOL ]] && rm -rf /$TESTPOOL
278 log_must zpool create -f $TESTPOOL $disklist
283 rm -rf $TESTDIR || log_unresolved Could not remove $TESTDIR
284 mkdir -p $TESTDIR || log_unresolved Could not create $TESTDIR
287 if [[ -z $no_mountpoint ]]; then
291 if [[ -n $container ]]; then
292 rm -rf $TESTDIR1 || \
294 mkdir -p $TESTDIR1 || \
300 if [[ -z $no_mountpoint ]]; then
306 if [[ -n $volume ]]; then
308 log_must zfs create -V $VOLSIZE $TESTPOOL/$TESTVOL
358 typeset fs_vol=${1:-$TESTPOOL/$TESTFS}
359 typeset snap=${2:-$TESTSNAP}
361 [[ -z $fs_vol ]] && log_fail "Filesystem or volume's name is undefined."
362 [[ -z $snap ]] && log_fail "Snapshot's name is undefined."
381 typeset snap=${1:-$TESTPOOL/$TESTFS@$TESTSNAP}
382 typeset clone=${2:-$TESTPOOL/$TESTCLONE}
384 [[ -z $snap ]] && \
386 [[ -z $clone ]] && \
402 typeset fs_vol=${1:-$TESTFS}
403 typeset snap=${2:-$TESTSNAP}
404 typeset bkmark=${3:-$TESTBKMARK}
406 [[ -z $fs_vol ]] && log_fail "Filesystem or volume's name is undefined."
407 [[ -z $snap ]] && log_fail "Snapshot's name is undefined."
408 [[ -z $bkmark ]] && log_fail "Bookmark's name is undefined."
430 typeset sendfs="${2:-$TESTPOOL/create_recv_clone}"
436 [[ -z $recvfs ]] && log_fail "Recv filesystem's name is undefined."
441 log_must zfs create -o compression=off -o mountpoint="$mountpoint" $sendfs
443 log_must eval "zfs send $snap | zfs recv -u $recvfs"
446 log_must eval "zfs send -i $snap $incr | dd bs=10K count=1 \
448 log_mustnot eval "zfs recv -su $recvfs < $sendfile"
449 destroy_dataset "$sendfs" "-r"
450 log_must rm -f "$sendfile"
452 if [[ $(get_prop 'inconsistent' "$recvfs/%recv") -ne 1 ]]; then
475 [[ -z $primary ]] && \
477 [[ -z $secondary ]] && \
479 [[ -d /$TESTPOOL ]] && rm -rf /$TESTPOOL
480 log_must zpool create -f $TESTPOOL mirror $@
504 # Given a minimum of two disks, set up a storage pool and dataset for the raid-z
512 if [[ ${#disks[*]} -lt 2 ]]; then
513 log_fail "A raid-z requires a minimum of two disks."
516 [[ -d /$TESTPOOL ]] && rm -rf /$TESTPOOL
517 log_must zpool create -f $TESTPOOL raidz $disklist
527 # sub-tests to ensure errors from one set of tests doesn't
545 zpool list -H -o name | grep -Fvx "$KEEP" | grep -v "$NO_POOLS"
556 zfs unmount -a > /dev/null 2>&1
561 while [ ! -z ${ALL_POOLS} ]
573 zfs mount -a
576 for fs in $(zfs list -H -o name \
578 destroy_dataset "$fs" "-Rf"
582 for fs in $(zfs list -H -o name); do
584 [[ -d $fs ]] && log_must rm -rf $fs/*
591 for fs in $(zfs list -H -o name); do
597 if [ -z "$enc" ] || [ "$enc" = "off" ]; then
613 [[ -d $TESTDIR ]] && \
614 log_must rm -rf $TESTDIR
621 rm -f $TEST_BASE_DIR/{err,out}
638 destroy_dataset "$TESTPOOL/$TESTCTR/$TESTFS1" "-R"
639 destroy_dataset "$TESTPOOL/$TESTCTR" "-Rf"
641 [[ -e $TESTDIR1 ]] && \
642 log_must rm -rf $TESTDIR1
655 typeset snap=${1:-$TESTPOOL/$TESTFS@$TESTSNAP}
672 [[ $mtpt != "" && -d $mtpt ]] && \
673 log_must rm -rf $mtpt
683 typeset clone=${1:-$TESTPOOL/$TESTCLONE}
696 [[ $mtpt != "" && -d $mtpt ]] && \
697 log_must rm -rf $mtpt
708 typeset bkmark=${1:-$TESTPOOL/$TESTFS#$TESTBKMARK}
719 # $1 - snapshot name
723 zfs list -H -t snapshot "$1" > /dev/null 2>&1
729 # $1 - bookmark name
733 zfs list -H -t bookmark "$1" > /dev/null 2>&1
739 # $1 - hold tag
740 # $2 - snapshot name
744 ! zfs holds "$2" | awk -v t="$1" '$2 ~ t { exit 1 }'
756 # non-zero otherwise.
802 gpart destroy -F $diskname
805 DSK=$(echo $DSK | sed -e "s|//|/|g")
806 log_must parted $DSK -s -- mklabel gpt
807 blockdev --rereadpt $DSK 2>/dev/null
833 typeset -i slicenum=$1
841 if [[ -z $size || -z $disk ]]; then
854 parted $disk -s -- print 1 >/dev/null
856 if [[ $slicenum -eq 0 || $ret_val -ne 0 ]]; then
857 if ! parted $disk -s -- mklabel gpt; then
864 if [[ -z "$start" ]]; then
870 typeset -i cly_size_kb=0
871 cly_size_kb=$(parted -m $disk -s -- unit cyl print |
872 awk -F '[:k.]' 'NR == 3 {print $4}')
875 parted $disk -s -- \
878 if [[ $ret_val -ne 0 ]]; then
883 blockdev --rereadpt $disk 2>/dev/null
887 if [[ -z $size || -z $disk ]]; then
892 if [[ $slicenum -eq 0 ]] || ! gpart show $disk >/dev/null 2>&1; then
893 gpart destroy -F $disk >/dev/null 2>&1
894 if ! gpart create -s GPT $disk; then
902 if [[ -n $start ]]; then
903 start="-b $start"
905 gpart add -t freebsd-zfs $start -s $size -i $index $disk
906 if [[ $ret_val -ne 0 ]]; then
914 if [[ -z $slicenum || -z $size || -z $disk ]]; then
931 format -e -s -d $disk -f $format_file
933 rm -f $format_file
937 if [[ $ret_val -ne 0 ]]; then
945 # Delete all partitions on all disks - this is specifically for the use of multipath
946 # devices which currently can only be used in the test suite as raw/un-partitioned
953 if [[ -z $DISKSARRAY ]]; then
958 typeset -i part
962 parted $DEV_DSKDIR/$disk -s rm $part > /dev/null 2>&1
963 if lsblk | grep -qF ${partition}; then
972 if gpart destroy -F $disk; then
988 if [[ -z $disk || -z $slice ]] ; then
994 endcyl=$(parted -s $DEV_DSKDIR/$disk -- unit cyl print | \
1003 awk -v slice=$slice '$3 == slice { print $1 + $2 }')
1010 typeset -i ratio=0
1018 typeset -i endcyl=$(prtvtoc -h /dev/rdsk/${disk}s2 |
1019 awk -v token="$slice" '$1 == token {print $6}')
1036 typeset -i i=0
1069 # dirnum: the maximum number of subdirectories to use, -1 no limit
1082 typeset destdir=${1:-$TESTDIR}
1083 typeset -i dirnum=${2:-50}
1084 typeset -i filenum=${3:-50}
1085 typeset -i bytes=${4:-8192}
1086 typeset -i num_writes=${5:-10240}
1087 typeset data=${6:-0}
1089 mkdir -p $destdir/{1..$dirnum}
1091 file_write -o create -f $f -b $bytes -c $num_writes -d $data \
1102 zfs get -Hpo value "$prop" "$dataset" || log_fail "zfs get $prop $dataset"
1111 zpool get -Hpo value "$prop" "$pool" || log_fail "zpool get $prop $pool"
1116 # $1 - pool name
1122 if [[ -z $pool ]]; then
1132 # $1-n dataset name
1145 # $1-n dataset name
1154 zfs list -H -t filesystem,snapshot,volume $1 > /dev/null 2>&1 \
1165 # cf. https://github.com/openzfs/zfs/pull/13165#issuecomment-1059845807
1167 # Linux can have spaces (which are \OOO-escaped),
1178 pgrep -q mountd && showmount -E | grep -qx "$fs"
1192 typeset stat=$(svcs -H -o STA nfs/server:default)
1203 ! exportfs -s | awk -v fs="${fs//\\/\\\\}" '/^\// && $1 == fs {exit 1}'
1222 none|legacy|-) return 1
1242 while read -r mtpt _; do
1254 while read -r mtpt _; do
1266 while read -r mtpt _; do
1275 # the os-specific NFS exports file.
1290 none|legacy|-) return 1
1317 net usershare list | grep -xFq "${fs//[-\/]/_}"
1371 read -r mountd < /var/run/mountd.pid
1373 log_must kill -s HUP "$mountd"
1376 log_must share -F nfs "$fs"
1394 log_must exportfs -u "*:$fs"
1398 read -r mountd < /var/run/mountd.pid
1399 awk -v fs="${fs//\\/\\\\}" '$1 != fs' /etc/zfs/exports > /etc/zfs/exports.$$
1401 log_must kill -s HUP "$mountd"
1404 log_must unshare -F nfs $fs
1418 exportfs -v
1424 share -F nfs
1433 exportfs -s
1436 showmount -e
1449 # Cannot share directory in non-global zone.
1458 # Re-synchronize /var/lib/nfs/etab with /etc/exports and
1461 log_must exportfs -r
1466 log_must kill -s HUP $(</var/run/mountd.pid)
1473 if [[ $(svcs -Ho STA $nfs_fmri) != "ON" ]]; then
1480 if [[ -d $dummy ]]; then
1481 log_must rm -rf $dummy
1496 while [[ timeout -ne 0 && $(svcs -Ho STA $nfs_fmri) == *'*' ]]
1500 ((timeout -= 1))
1504 log_must rm -rf $dummy
1507 log_note "Current NFS status: '$(svcs -Ho STA,FMRI $nfs_fmri)'"
1513 # Return 0 if in global zone, 1 in non-global zone
1537 [[ -z $limit ]] && return 0
1546 *) log_note "Warning: unknown limit $limit - " \
1557 *) log_note "Warning: unknown limit $limit - " \
1571 # $1 - pool name
1572 # $2-n - [keyword] devs_list
1580 if [[ -z $pool ]]; then
1590 [[ -d /$pool ]] && rm -rf /$pool
1591 log_must zpool create -f $pool $@
1600 # $1 - pool name
1608 if [[ -z $pool ]]; then
1621 log_must_busy zpool destroy -f $pool
1623 [[ -d $mtpt ]] && \
1624 log_must rm -rf $mtpt
1636 # $1 - dataset name
1637 # $2-n - dataset options
1645 if [[ -z $dataset ]]; then
1662 # $1 - dataset name
1663 # $2 - custom arguments for zfs destroy
1670 typeset args=${2:-""}
1672 if [[ -z $dataset ]]; then
1682 [ -d $mtpt ] && log_must rm -rf $mtpt
1693 # Reexport TESTPOOL & TESTPOOL(1-4)
1697 typeset -i cntctr=5
1698 typeset -i i=0
1727 [[ -z $pool ]] || [[ -z $state ]] \
1730 if [[ -z $disk ]]; then
1732 zpool get -H -o value health $pool | grep -qi "$state"
1734 zpool status -v $pool | grep "$disk" | grep -qi "$state"
1745 typeset dataset=${1:-$TESTPOOL/$TESTFS@$TESTSNAP}
1754 if [[ -z $fs || -z $snap ]]; then
1769 zdb -e -lll $device | awk -v ashift=$ashift '
1798 zfs unmount -a > /dev/null 2>&1
1801 if [[ -n $dirs ]] ; then
1803 search_path="$search_path -d $dir"
1809 if ! zdb -cudi $filesys > $zdbout 2>&1; then
1810 log_note "Output: zdb -cudi $filesys"
1812 rm -f $zdbout
1816 log_must zfs mount -a
1817 log_must rm -rf $zdbout
1825 typeset pool=${1:-$TESTPOOL}
1830 typeset -i cksum=$(zpool status $pool | awk '
1837 log_must zpool status -v
1847 echo $(zpool iostat -v $1 | awk '(NR > 4) {print $1}' | \
1848 grep -vEe '^-----' -e "^(mirror|raidz[1-3]|draid[1-3]|spare|log|cache|special|dedup)|\-[0-9]$")
1853 # path (like "/dev/sda" instead of "sda").
1857 get_disklist "-P $1"
1874 typeset -i TIMEOUT=$1
1885 ps -p $pid > /dev/null 2>&1 &&
1886 log_must kill -USR1 $pid
1916 typeset timeout=${4:-60}
1917 typeset -i i=0
1919 while [[ $i -lt $timeout ]]; do
1957 typeset timeout=${4:-60}
1958 typeset -i i=0
1960 while [[ $i -lt $timeout ]]; do
1973 # Check the output of 'zpool status -v <pool>',
1983 typeset verbose=${4:-false}
1985 scan=$(zpool status -v "$pool" 2>/dev/null | awk -v token="$token:" '$1==token')
1989 echo $scan | grep -qi "$keyword"
1994 # is_pool_resilvering - to check if the pool resilver is in progress
1995 # is_pool_resilvered - to check if the pool resilver is completed
1996 # is_pool_scrubbing - to check if the pool scrub is in progress
1997 # is_pool_scrubbed - to check if the pool scrub is completed
1998 # is_pool_scrub_stopped - to check if the pool scrub is stopped
1999 # is_pool_scrub_paused - to check if the pool scrub has paused
2000 # is_pool_removing - to check if the pool removing is a vdev
2001 # is_pool_removed - to check if the pool remove is completed
2002 # is_pool_discarding - to check if the pool checkpoint is being discarded
2003 # is_pool_replacing - to check if the pool is performing a replacement
2008 "resilver[ ()0-9A-Za-z:_-]* in progress since" $2
2070 zpool status "$1" | grep -qE 'replacing-[0-9]+'
2076 typeset timeout=${2:-30}
2083 if ((SECONDS - t0 > $timeout)); then
2132 max_finddisksnum=${MAX_FINDDISKSNUM:-6}
2134 swap -l > $sfi
2137 disks=${@:-$(echo "" | format -e 2>/dev/null | awk '
2159 grep -q "${disk}[sp]" /etc/mnttab && continue
2161 grep -q "${disk}[sp]" $sfi && continue
2163 grep -q "${disk}[sp]" $dmpi && continue
2165 # by a user-set environment variable
2166 echo "${ZFS_HOST_DEVICES_IGNORE}" | grep -q "${disk}" && continue
2177 [ $count -lt $max_finddisksnum ]; then
2180 [[ -z $@ ]] && ((count = count + 1))
2200 typeset -i uid=1000
2202 pw useradd -u $uid -g $group -d $basedir/$user -m -n $user
2251 typeset -i gid=1000
2253 pw groupadd -g $gid -n $group > /dev/null 2>&1
2275 pw groupdel -n $group > /dev/null 2>&1
2293 log_must useradd -g $group -d $basedir/$user -m $user
2313 typeset -i gid=100
2315 groupadd -g $gid $group > /dev/null 2>&1
2329 groupmod -n $grp $grp > /dev/null 2>&1
2345 log_must useradd -g $group -d $basedir/$user -m $user
2350 cmd_group=$(stat --format="%G" $(command -v zfs))
2351 log_must usermod -a -G $cmd_group $user
2407 typeset basedir=${3:-"/var/tmp"}
2437 typeset basedir=${2:-"/var/tmp"}
2455 [[ -d $basedir/$user ]] && rm -fr $basedir/$user
2531 for pool in $(zpool list -H -o name)
2535 # this is a list of the top-level directories in each of the
2537 FILEPOOL=$(zpool status -v $pool | awk -v pool="/$1/" '$0 ~ pool {print $1}')
2540 ZVOLPOOL=$(zpool status -v $pool | awk -v zvols="$ZVOL_DEVDIR/$1$" '$0 ~ zvols {print $1}')
2542 # also want to determine if it's a file-based pool using an
2544 POOL_FILE_DIRS=$(zpool status -v $pool | \
2546 awk -F/ '!/dev/ {print $2}')
2550 OUTPUT=$(zfs list -H -r -o mountpoint $1 | \
2551 awk -v pd="${pooldir}$" '$0 ~ pd {print $1}')
2557 if [ ! -z "$ZVOLPOOL" ]
2563 if [ ! -z "$FILEPOOL" ]
2569 if [ ! -z "$ALTMOUNTPOOL" ]
2576 if [ -z "${DONT_DESTROY}" ]
2586 # Verify zfs operation with -p option work as expected
2609 ops="create -V $VOLSIZE"
2613 if [[ -z $newdataset ]]; then
2621 if [[ -z $newdataset ]]; then
2633 destroy_dataset "${newdataset%/*}" "-rRf"
2635 # without -p option, operation will fail
2639 # with -p option, operation should succeed
2640 log_must zfs $ops -p $dataset $newdataset
2644 log_fail "-p option does not work for $ops"
2649 log_must zfs $ops -p $dataset $newdataset
2669 zdb -e $pool
2671 zdb -C $pool
2672 fi | awk -F: -v cfg="$config:" '$0 ~ cfg {sub(/^'\''/, $2); sub(/'\''$/, $2); print $2}'
2679 # $2-n string
2687 typeset -i ind
2690 echo "$str" | cut -f $ind -d ' '
2698 typeset -i cnt=$#
2719 typeset -i len=$1
2721 typeset -i baselen=${#basestr}
2722 typeset -i iter=0
2733 ((iter -= 1))
2753 zdb -vvv $1 | awk -F= -v ds="^Dataset $1 "'\\[' '$0 ~ ds && /cksum/ {print $7}'
2763 typeset field=${3:-$pool}
2765 zpool status -v "$pool" 2>/dev/null | \
2766 awk -v device=$disk -v pool=$pool -v field=$field \
2784 rootfs=$(mount -p | awk '$2 == "/" && $3 == "zfs" {print $1}')
2789 if [[ -z "$rootfs" ]]; then
2815 typeset -i min=${2:-1}
2817 typeset -i count=$(echo "$1" | wc -w)
2842 svcs -H -o state labeld 2>/dev/null | grep -q "enabled"
2845 # Return the number of CPUs (cross-platform)
2849 grep -c '^processor' /proc/cpuinfo
2851 sysctl -n kern.smp.cpus
2853 psrinfo | wc -l
2860 [[ $(get_num_cpus) -gt 1 ]]
2868 sysctl -n hw.clockrate
2870 psrinfo -v 0 | awk '/processor operates at/ {print $6}'
2886 sudo -Eu $user env PATH="$PATH" ksh <<<"$*" >$out 2>$err
2907 if [[ -z $pool ]]; then
2915 # can't reference a mirror/raidz vdev using its ID (i.e mirror-0),
2918 zpool status -v "$pool" | grep -A 1000 "config:" >$tmpfile
2920 grep -wq ${vdev##*/} $tmpfile || return 1
2923 rm -f $tmpfile
2929 typeset -l i max=$1
2944 typeset nfiles=${3:-1}
2945 typeset bs=${4:-1024k}
2946 typeset fname=${5:-file}
2948 [[ -d $dir ]] || log_fail "No directory: $dir"
2952 # command line options and cases where the --buffer_compress_*
2960 truncate -s $file_bytes $dir/$fname.$i
2970 command -v fio > /dev/null || log_unsupported "fio missing"
2972 --name=job \
2973 --fallocate=0 \
2974 --minimal \
2975 --randrepeat=0 \
2976 --buffer_compress_percentage=66 \
2977 --buffer_compress_chunk=4096 \
2978 --directory="$dir" \
2979 --numjobs="$nfiles" \
2980 --nrfiles="$nfiles" \
2981 --rw=write \
2982 --bs="$bs" \
2983 --filesize="$megs" \
2984 "--filename_format='$fname.\$jobnum' >/dev/null"
2993 [[ -e $pathname ]] || log_fail "No such file or directory: $pathname"
2995 objnum=$(stat -f "%i" $pathname)
2997 objnum=$(stat -c %i $pathname)
3010 typeset pool=${1:-$TESTPOOL}
3011 typeset force=${2:-false}
3014 log_must zpool sync -f $pool
3029 typeset force=${1:-false}
3032 log_must zpool sync -f
3047 typeset pool=${1:-$TESTPOOL}
3049 [[ "0" == "$(zpool list -Ho freeing $pool)" ]] && break
3062 typeset timeout=${2:-300}
3063 typeset pool=${1:-$TESTPOOL}
3077 typeset timeout=${2:-300}
3078 typeset pool=${1:-$TESTPOOL}
3110 if [[ ! -d $ZEDLET_DIR ]]; then
3114 if [[ ! -e $VDEVID_CONF ]]; then
3118 if [[ -e $VDEVID_CONF_ETC ]]; then
3124 log_must ln -s $VDEVID_CONF $VDEVID_CONF_ETC
3129 log_must cp ${ZEDLET_ETC_DIR}/zed-functions.sh $ZEDLET_DIR
3132 if [[ -n "$EXTRA_ZEDLETS" ]] ; then
3142 log_must sed -i '/\#ZED_DEBUG_LOG=.*/d' $ZEDLET_DIR/zed.rc
3158 log_must rm -f ${ZEDLET_DIR}/$extra_zedlet
3160 log_must rm -fd ${ZEDLET_DIR}/zed.rc ${ZEDLET_DIR}/zed-functions.sh ${ZEDLET_DIR}/all-syslog.sh ${ZEDLET_DIR}/all-debug.sh ${ZEDLET_DIR}/state \
3173 zedpids="$(pgrep -x zed)"
3174 zedpids2="$(pgrep -x lt-zed)"
3188 if [[ ! -d $ZEDLET_DIR ]]; then
3194 if [ -n "$zedpids" ]; then
3196 # is already running - usually this implies our test cases
3200 log_fail "ZED already running - ${zedpids}"
3205 log_must truncate -s 0 $ZED_DEBUG_LOG
3206 log_must eval "zed -vF -d $ZEDLET_DIR -P $PATH" \
3207 "-s $ZEDLET_DIR/state -j 1 2>$ZED_LOG &"
3225 [ ! -n "$zedpids" ] && break
3234 # Drain all zevents
3238 while [ $(zpool events -H | wc -l) -ne 0 ]; do
3240 zpool events -c >/dev/null
3244 # Set a variable in zed.rc to something, un-commenting it in the process.
3254 eval sed -i $cmd $ZEDLET_DIR/zed.rc
3268 if [[ -z $device ]] ; then
3275 swapon -s | grep -wq $(readlink -f $device)
3278 swapctl -l | grep -wq $device
3281 swap -l | grep -wq $device
3299 log_must swapctl -a $swapdev
3302 log_must swap -a $swapdev
3322 log_must swap -d $swapdev
3330 # Set a global system tunable (64-bit value)
3341 # Set a global system tunable (32-bit value)
3369 [[ -z "$value" ]] && return 1
3370 [[ -z "$mdb_cmd" ]] && return 1
3381 echo "${tunable}/${mdb_cmd}0t${value}" | mdb -kw
3388 [[ ! -d $TEST_BASE_DIR ]] && return 1
3389 [[ -e $TEST_BASE_DIR/tunable-$1 ]] && return 2
3390 echo "$(get_tunable """$1""")" > "$TEST_BASE_DIR"/tunable-"$1"
3395 [[ ! -e $TEST_BASE_DIR/tunable-$1 ]] && return 1
3396 val="$(cat $TEST_BASE_DIR/tunable-"""$1""")"
3398 rm $TEST_BASE_DIR/tunable-$1
3414 typeset module="${2:-zfs}"
3420 if [ -z "$check_only" ] ; then
3427 if [ -z "$check_only" ] ; then
3443 sysctl -n vfs.zfs.$tunable
3446 [[ "$module" -eq "zfs" ]] || return 1
3487 echo y | newfs -v "$@"
3498 stat -f %z "$path"
3501 stat -c %s "$path"
3512 stat -f %m "$path"
3515 stat -c %Y "$path"
3526 stat -f %c "$path"
3529 stat -c %Z "$path"
3540 stat -f %B "$path"
3543 stat -c %W "$path"
3557 stat -f %v "${path}"
3571 script -q /dev/null env "$@"
3573 script --return --quiet -c "$*" /dev/null
3582 typeset -i begin=$1
3583 typeset -i end=$2
3585 seq ${begin} ${end} | sort -R
3589 # Cross-platform xattr helpers
3599 getextattr -qq user "${name}" "${path}"
3602 attr -qg "${name}" "${path}"
3618 attr -qs "${name}" -V "${value}" "${path}"
3630 setextattr -i user "${name}" "${path}"
3633 attr -qs "${name}" "${path}"
3645 rmextattr -q user "${name}" "${path}"
3648 attr -qr "${name}" "${path}"
3659 lsextattr -qq user "${path}"
3662 attr -ql "${path}"
3675 truncate -d -o $offset -l $length "$file"
3678 fallocate --punch-hole --offset $offset --length $length "$file"
3694 fallocate --zero-range --offset $offset --length $length "$file"
3703 # Wait for the specified arcstat to reach non-zero quiescence.
3713 if [[ $echo -eq 0 ]]; then
3717 while $do_once || [ $stat1 -ne $stat2 ] || [ $stat2 -eq 0 ]; do
3724 if [[ $echo -eq 1 ]]; then
3753 if [ $child_exit -ne 0 ]; then
3764 # output and a non-zero error is returned.
3775 zil_replay="${LIBTEST_DIFF_ZIL_REPLAY:-0}"
3779 if ! [ -d "$dir_a" -a -d "$dir_b" ]; then
3783 # Run rsync with --dry-run --itemize-changes to get something akin to diff
3787 # Also make sure to filter out non-user.* xattrs when comparing. On
3788 # SELinux-enabled systems the copied tree will probably have different
3790 args=("-nicaAHX" '--filter=-x! user.*' "--delete")
3792 # NOTE: Quite a few rsync builds do not support --crtimes which would be
3801 if rsync --version | grep -q "[, ] crtimes"; then
3802 args+=("--crtimes")
3804 log_note "This rsync package does not support --crtimes (-N)."
3808 # Unfortunately --no-times doesn't do what we want -- it will still tell
3812 if [ "$zil_replay" -eq 0 ]; then
3818 filter=("grep" "-v" '^\..[.Tt]\+ ')
3823 if [ -n "$diff" ]; then
3850 ulimit -c unlimited
3858 sysctl -n kern.corefile
3863 coreadm -p "$1/core.%f"
3873 [ -s "$1" ] || return 0
3877 { read -r pat; read -r pid; } < "$1"