Lines Matching +full:sync +full:- +full:token
9 # or https://opensource.org/licenses/CDDL-1.0.
29 # Copyright (c) 2017, Open-E Inc. All rights reserved.
43 PWD="$(readlink -f $PWD)"
50 if [ -n "$STF_PATH" ]; then
61 [ "$(printf "$1\n$2" | sort -V | tail -n1)" = "$1" ]
71 [ -z "$ver" ] && case "$UNAME" in
75 # RHEL7: 3.10.0-1160.108.1.el7.x86_64
76 # Fedora 37: 6.5.12-100.fc37.x86_64
77 # Debian 12.6: 6.1.0-22-amd64
78 ver=$(uname -r | grep -Eo "^[0-9]+\.[0-9]+\.[0-9]+")
81 # FreeBSD version numbers are X.Y-BRANCH-pZ. Depending on
82 # branch, -pZ may not be present, but this is typically only
83 # on pre-release or true .0 releases, so can be assumed 0
86 # 13.2-RELEASE-p4
87 # 14.1-RELEASE
88 # 15.0-CURRENT
89 ver=$(uname -r | \
90 grep -Eo "[0-9]+\.[0-9]+(-[A-Z0-9]+-p[0-9]+)?" | \
91 sed -E "s/-[^-]+-p/./")
100 IFS='.' read -r version major minor _ <<<"$ver"
102 [ -z "$version" ] && version=0
103 [ -z "$major" ] && major=0
104 [ -z "$minor" ] && minor=0
113 # Used for comparison: if [ $(linux_version) -ge $(linux_version "2.6.32") ]
122 # Used for comparison: if [ $(freebsd_version) -ge $(freebsd_version "13.2") ]
153 # Determine if this is a 32-bit system
155 # Return 0 if platform is 32-bit, 1 if otherwise
168 is_linux && [ -e /sys/kernel/debug/kmemleak ]
174 # $2 filesystem type; optional - defaulted to zfs
181 [[ -z $fstype ]] && fstype=zfs
187 ! zfs mount | awk -v fs="$1" '$2 == fs {exit 1}'
189 ! zfs mount | awk -v ds="$1" '$1 == ds {exit 1}'
194 mount -pt $fstype | while read dev dir _t _flags; do
198 out=$(df -F $fstype $1 2>/dev/null) || return
210 df -t $fstype $1 > /dev/null 2>&1
213 if [[ -L "$ZVOL_DEVDIR/$1" ]]; then
214 link=$(readlink -f $ZVOL_DEVDIR/$1)
215 [[ -n "$link" ]] && \
216 mount | grep -q "^$link" && \
229 # $2 filesystem type; optional - defaulted to zfs
239 # $2 filesystem type; optional - defaulted to zfs
275 [[ -d /$TESTPOOL ]] && rm -rf /$TESTPOOL
276 log_must zpool create -f $TESTPOOL $disklist
281 rm -rf $TESTDIR || log_unresolved Could not remove $TESTDIR
282 mkdir -p $TESTDIR || log_unresolved Could not create $TESTDIR
285 if [[ -z $no_mountpoint ]]; then
289 if [[ -n $container ]]; then
290 rm -rf $TESTDIR1 || \
292 mkdir -p $TESTDIR1 || \
298 if [[ -z $no_mountpoint ]]; then
304 if [[ -n $volume ]]; then
306 log_must zfs create -V $VOLSIZE $TESTPOOL/$TESTVOL
356 typeset fs_vol=${1:-$TESTPOOL/$TESTFS}
357 typeset snap=${2:-$TESTSNAP}
359 [[ -z $fs_vol ]] && log_fail "Filesystem or volume's name is undefined."
360 [[ -z $snap ]] && log_fail "Snapshot's name is undefined."
379 typeset snap=${1:-$TESTPOOL/$TESTFS@$TESTSNAP}
380 typeset clone=${2:-$TESTPOOL/$TESTCLONE}
382 [[ -z $snap ]] && \
384 [[ -z $clone ]] && \
400 typeset fs_vol=${1:-$TESTFS}
401 typeset snap=${2:-$TESTSNAP}
402 typeset bkmark=${3:-$TESTBKMARK}
404 [[ -z $fs_vol ]] && log_fail "Filesystem or volume's name is undefined."
405 [[ -z $snap ]] && log_fail "Snapshot's name is undefined."
406 [[ -z $bkmark ]] && log_fail "Bookmark's name is undefined."
428 typeset sendfs="${2:-$TESTPOOL/create_recv_clone}"
434 [[ -z $recvfs ]] && log_fail "Recv filesystem's name is undefined."
439 log_must zfs create -o compression=off -o mountpoint="$mountpoint" $sendfs
441 log_must eval "zfs send $snap | zfs recv -u $recvfs"
444 log_must eval "zfs send -i $snap $incr | dd bs=10K count=1 \
446 log_mustnot eval "zfs recv -su $recvfs < $sendfile"
447 destroy_dataset "$sendfs" "-r"
448 log_must rm -f "$sendfile"
450 if [[ $(get_prop 'inconsistent' "$recvfs/%recv") -ne 1 ]]; then
473 [[ -z $primary ]] && \
475 [[ -z $secondary ]] && \
477 [[ -d /$TESTPOOL ]] && rm -rf /$TESTPOOL
478 log_must zpool create -f $TESTPOOL mirror $@
502 # Given a minimum of two disks, set up a storage pool and dataset for the raid-z
510 if [[ ${#disks[*]} -lt 2 ]]; then
511 log_fail "A raid-z requires a minimum of two disks."
514 [[ -d /$TESTPOOL ]] && rm -rf /$TESTPOOL
515 log_must zpool create -f $TESTPOOL raidz $disklist
525 # sub-tests to ensure errors from one set of tests doesn't
543 zpool list -H -o name | grep -Fvx "$KEEP" | grep -v "$NO_POOLS"
554 zfs unmount -a > /dev/null 2>&1
559 while [ ! -z ${ALL_POOLS} ]
571 zfs mount -a
574 for fs in $(zfs list -H -o name \
576 destroy_dataset "$fs" "-Rf"
580 for fs in $(zfs list -H -o name); do
582 [[ -d $fs ]] && log_must rm -rf $fs/*
589 for fs in $(zfs list -H -o name); do
595 if [ -z "$enc" ] || [ "$enc" = "off" ]; then
611 [[ -d $TESTDIR ]] && \
612 log_must rm -rf $TESTDIR
619 rm -f $TEST_BASE_DIR/{err,out}
636 destroy_dataset "$TESTPOOL/$TESTCTR/$TESTFS1" "-R"
637 destroy_dataset "$TESTPOOL/$TESTCTR" "-Rf"
639 [[ -e $TESTDIR1 ]] && \
640 log_must rm -rf $TESTDIR1
653 typeset snap=${1:-$TESTPOOL/$TESTFS@$TESTSNAP}
670 [[ $mtpt != "" && -d $mtpt ]] && \
671 log_must rm -rf $mtpt
681 typeset clone=${1:-$TESTPOOL/$TESTCLONE}
694 [[ $mtpt != "" && -d $mtpt ]] && \
695 log_must rm -rf $mtpt
706 typeset bkmark=${1:-$TESTPOOL/$TESTFS#$TESTBKMARK}
717 # $1 - snapshot name
721 zfs list -H -t snapshot "$1" > /dev/null 2>&1
727 # $1 - bookmark name
731 zfs list -H -t bookmark "$1" > /dev/null 2>&1
737 # $1 - hold tag
738 # $2 - snapshot name
742 ! zfs holds "$2" | awk -v t="$1" '$2 ~ t { exit 1 }'
754 # non-zero otherwise.
800 gpart destroy -F $diskname
803 DSK=$(echo $DSK | sed -e "s|//|/|g")
804 log_must parted $DSK -s -- mklabel gpt
805 blockdev --rereadpt $DSK 2>/dev/null
831 typeset -i slicenum=$1
839 if [[ -z $size || -z $disk ]]; then
852 parted $disk -s -- print 1 >/dev/null
854 if [[ $slicenum -eq 0 || $ret_val -ne 0 ]]; then
855 if ! parted $disk -s -- mklabel gpt; then
862 if [[ -z "$start" ]]; then
868 typeset -i cly_size_kb=0
869 cly_size_kb=$(parted -m $disk -s -- unit cyl print |
870 awk -F '[:k.]' 'NR == 3 {print $4}')
873 parted $disk -s -- \
876 if [[ $ret_val -ne 0 ]]; then
881 blockdev --rereadpt $disk 2>/dev/null
885 if [[ -z $size || -z $disk ]]; then
890 if [[ $slicenum -eq 0 ]] || ! gpart show $disk >/dev/null 2>&1; then
891 gpart destroy -F $disk >/dev/null 2>&1
892 if ! gpart create -s GPT $disk; then
900 if [[ -n $start ]]; then
901 start="-b $start"
903 gpart add -t freebsd-zfs $start -s $size -i $index $disk
904 if [[ $ret_val -ne 0 ]]; then
912 if [[ -z $slicenum || -z $size || -z $disk ]]; then
929 format -e -s -d $disk -f $format_file
931 rm -f $format_file
935 if [[ $ret_val -ne 0 ]]; then
943 # Delete all partitions on all disks - this is specifically for the use of multipath
944 # devices which currently can only be used in the test suite as raw/un-partitioned
951 if [[ -z $DISKSARRAY ]]; then
956 typeset -i part
960 parted $DEV_DSKDIR/$disk -s rm $part > /dev/null 2>&1
961 if lsblk | grep -qF ${partition}; then
970 if gpart destroy -F $disk; then
986 if [[ -z $disk || -z $slice ]] ; then
992 endcyl=$(parted -s $DEV_DSKDIR/$disk -- unit cyl print | \
1001 awk -v slice=$slice '$3 == slice { print $1 + $2 }')
1008 typeset -i ratio=0
1016 typeset -i endcyl=$(prtvtoc -h /dev/rdsk/${disk}s2 |
1017 awk -v token="$slice" '$1 == token {print $6}')
1034 typeset -i i=0
1067 # dirnum: the maximum number of subdirectories to use, -1 no limit
1080 typeset destdir=${1:-$TESTDIR}
1081 typeset -i dirnum=${2:-50}
1082 typeset -i filenum=${3:-50}
1083 typeset -i bytes=${4:-8192}
1084 typeset -i num_writes=${5:-10240}
1085 typeset data=${6:-0}
1087 mkdir -p $destdir/{1..$dirnum}
1089 file_write -o create -f $f -b $bytes -c $num_writes -d $data \
1100 zfs get -Hpo value "$prop" "$dataset" || log_fail "zfs get $prop $dataset"
1109 zpool get -Hpo value "$prop" "$pool" || log_fail "zpool get $prop $pool"
1114 # $1 - pool name
1120 if [[ -z $pool ]]; then
1130 # $1-n dataset name
1143 # $1-n dataset name
1152 zfs list -H -t filesystem,snapshot,volume $1 > /dev/null 2>&1 \
1163 # cf. https://github.com/openzfs/zfs/pull/13165#issuecomment-1059845807
1165 # Linux can have spaces (which are \OOO-escaped),
1176 pgrep -q mountd && showmount -E | grep -qx "$fs"
1190 typeset stat=$(svcs -H -o STA nfs/server:default)
1201 ! exportfs -s | awk -v fs="${fs//\\/\\\\}" '/^\// && $1 == fs {exit 1}'
1220 none|legacy|-) return 1
1240 while read -r mtpt _; do
1252 while read -r mtpt _; do
1264 while read -r mtpt _; do
1273 # the os-specific NFS exports file.
1288 none|legacy|-) return 1
1315 net usershare list | grep -xFq "${fs//[-\/]/_}"
1369 read -r mountd < /var/run/mountd.pid
1371 log_must kill -s HUP "$mountd"
1374 log_must share -F nfs "$fs"
1392 log_must exportfs -u "*:$fs"
1396 read -r mountd < /var/run/mountd.pid
1397 awk -v fs="${fs//\\/\\\\}" '$1 != fs' /etc/zfs/exports > /etc/zfs/exports.$$
1399 log_must kill -s HUP "$mountd"
1402 log_must unshare -F nfs $fs
1416 exportfs -v
1422 share -F nfs
1431 exportfs -s
1434 showmount -e
1447 # Cannot share directory in non-global zone.
1456 # Re-synchronize /var/lib/nfs/etab with /etc/exports and
1459 log_must exportfs -r
1464 log_must kill -s HUP $(</var/run/mountd.pid)
1471 if [[ $(svcs -Ho STA $nfs_fmri) != "ON" ]]; then
1478 if [[ -d $dummy ]]; then
1479 log_must rm -rf $dummy
1494 while [[ timeout -ne 0 && $(svcs -Ho STA $nfs_fmri) == *'*' ]]
1498 ((timeout -= 1))
1502 log_must rm -rf $dummy
1505 log_note "Current NFS status: '$(svcs -Ho STA,FMRI $nfs_fmri)'"
1511 # Return 0 if in global zone, 1 in non-global zone
1535 [[ -z $limit ]] && return 0
1544 *) log_note "Warning: unknown limit $limit - " \
1555 *) log_note "Warning: unknown limit $limit - " \
1569 # $1 - pool name
1570 # $2-n - [keyword] devs_list
1578 if [[ -z $pool ]]; then
1588 [[ -d /$pool ]] && rm -rf /$pool
1589 log_must zpool create -f $pool $@
1598 # $1 - pool name
1606 if [[ -z $pool ]]; then
1619 log_must_busy zpool destroy -f $pool
1621 [[ -d $mtpt ]] && \
1622 log_must rm -rf $mtpt
1634 # $1 - dataset name
1635 # $2-n - dataset options
1643 if [[ -z $dataset ]]; then
1660 # $1 - dataset name
1661 # $2 - custom arguments for zfs destroy
1668 typeset args=${2:-""}
1670 if [[ -z $dataset ]]; then
1680 [ -d $mtpt ] && log_must rm -rf $mtpt
1691 # Reexport TESTPOOL & TESTPOOL(1-4)
1695 typeset -i cntctr=5
1696 typeset -i i=0
1725 [[ -z $pool ]] || [[ -z $state ]] \
1728 if [[ -z $disk ]]; then
1730 zpool get -H -o value health $pool | grep -qi "$state"
1732 zpool status -v $pool | grep "$disk" | grep -qi "$state"
1743 typeset dataset=${1:-$TESTPOOL/$TESTFS@$TESTSNAP}
1752 if [[ -z $fs || -z $snap ]]; then
1767 zdb -e -lll $device | awk -v ashift=$ashift '
1796 zfs unmount -a > /dev/null 2>&1
1799 if [[ -n $dirs ]] ; then
1801 search_path="$search_path -d $dir"
1807 if ! zdb -cudi $filesys > $zdbout 2>&1; then
1808 log_note "Output: zdb -cudi $filesys"
1810 rm -f $zdbout
1814 log_must zfs mount -a
1815 log_must rm -rf $zdbout
1823 typeset pool=${1:-$TESTPOOL}
1828 typeset -i cksum=$(zpool status $pool | awk '
1835 log_must zpool status -v
1845 echo $(zpool iostat -v $1 | awk '(NR > 4) {print $1}' | \
1846 grep -vEe '^-----' -e "^(mirror|raidz[1-3]|draid[1-3]|spare|log|cache|special|dedup)|\-[0-9]$")
1855 get_disklist "-P $1"
1872 typeset -i TIMEOUT=$1
1883 ps -p $pid > /dev/null 2>&1 &&
1884 log_must kill -USR1 $pid
1914 typeset timeout=${4:-60}
1915 typeset -i i=0
1917 while [[ $i -lt $timeout ]]; do
1955 typeset timeout=${4:-60}
1956 typeset -i i=0
1958 while [[ $i -lt $timeout ]]; do
1971 # Check the output of 'zpool status -v <pool>',
1972 # and to see if the content of <token> contain the <keyword> specified.
1976 function check_pool_status # pool token keyword <verbose>
1979 typeset token=$2
1981 typeset verbose=${4:-false}
1983 scan=$(zpool status -v "$pool" 2>/dev/null | awk -v token="$token:" '$1==token')
1987 echo $scan | grep -qi "$keyword"
1992 # is_pool_resilvering - to check if the pool resilver is in progress
1993 # is_pool_resilvered - to check if the pool resilver is completed
1994 # is_pool_scrubbing - to check if the pool scrub is in progress
1995 # is_pool_scrubbed - to check if the pool scrub is completed
1996 # is_pool_scrub_stopped - to check if the pool scrub is stopped
1997 # is_pool_scrub_paused - to check if the pool scrub has paused
1998 # is_pool_removing - to check if the pool removing is a vdev
1999 # is_pool_removed - to check if the pool remove is completed
2000 # is_pool_discarding - to check if the pool checkpoint is being discarded
2001 # is_pool_replacing - to check if the pool is performing a replacement
2006 "resilver[ ()0-9A-Za-z:_-]* in progress since" $2
2068 zpool status "$1" | grep -qE 'replacing-[0-9]+'
2074 typeset timeout=${2:-30}
2081 if ((SECONDS - t0 > $timeout)); then
2130 max_finddisksnum=${MAX_FINDDISKSNUM:-6}
2132 swap -l > $sfi
2135 disks=${@:-$(echo "" | format -e 2>/dev/null | awk '
2157 grep -q "${disk}[sp]" /etc/mnttab && continue
2159 grep -q "${disk}[sp]" $sfi && continue
2161 grep -q "${disk}[sp]" $dmpi && continue
2163 # by a user-set environment variable
2164 echo "${ZFS_HOST_DEVICES_IGNORE}" | grep -q "${disk}" && continue
2175 [ $count -lt $max_finddisksnum ]; then
2178 [[ -z $@ ]] && ((count = count + 1))
2198 typeset -i uid=1000
2200 pw useradd -u $uid -g $group -d $basedir/$user -m -n $user
2249 typeset -i gid=1000
2251 pw groupadd -g $gid -n $group > /dev/null 2>&1
2273 pw groupdel -n $group > /dev/null 2>&1
2291 log_must useradd -g $group -d $basedir/$user -m $user
2311 typeset -i gid=100
2313 groupadd -g $gid $group > /dev/null 2>&1
2327 groupmod -n $grp $grp > /dev/null 2>&1
2343 log_must useradd -g $group -d $basedir/$user -m $user
2348 cmd_group=$(stat --format="%G" $(command -v zfs))
2349 log_must usermod -a -G $cmd_group $user
2405 typeset basedir=${3:-"/var/tmp"}
2435 typeset basedir=${2:-"/var/tmp"}
2453 [[ -d $basedir/$user ]] && rm -fr $basedir/$user
2529 for pool in $(zpool list -H -o name)
2533 # this is a list of the top-level directories in each of the
2535 FILEPOOL=$(zpool status -v $pool | awk -v pool="/$1/" '$0 ~ pool {print $1}')
2538 ZVOLPOOL=$(zpool status -v $pool | awk -v zvols="$ZVOL_DEVDIR/$1$" '$0 ~ zvols {print $1}')
2540 # also want to determine if it's a file-based pool using an
2542 POOL_FILE_DIRS=$(zpool status -v $pool | \
2544 awk -F/ '!/dev/ {print $2}')
2548 OUTPUT=$(zfs list -H -r -o mountpoint $1 | \
2549 awk -v pd="${pooldir}$" '$0 ~ pd {print $1}')
2555 if [ ! -z "$ZVOLPOOL" ]
2561 if [ ! -z "$FILEPOOL" ]
2567 if [ ! -z "$ALTMOUNTPOOL" ]
2574 if [ -z "${DONT_DESTROY}" ]
2584 # Verify zfs operation with -p option work as expected
2607 ops="create -V $VOLSIZE"
2611 if [[ -z $newdataset ]]; then
2619 if [[ -z $newdataset ]]; then
2631 destroy_dataset "${newdataset%/*}" "-rRf"
2633 # without -p option, operation will fail
2637 # with -p option, operation should succeed
2638 log_must zfs $ops -p $dataset $newdataset
2642 log_fail "-p option does not work for $ops"
2647 log_must zfs $ops -p $dataset $newdataset
2667 zdb -e $pool
2669 zdb -C $pool
2670 fi | awk -F: -v cfg="$config:" '$0 ~ cfg {sub(/^'\''/, $2); sub(/'\''$/, $2); print $2}'
2677 # $2-n string
2685 typeset -i ind
2688 echo "$str" | cut -f $ind -d ' '
2696 typeset -i cnt=$#
2717 typeset -i len=$1
2719 typeset -i baselen=${#basestr}
2720 typeset -i iter=0
2731 ((iter -= 1))
2749 sync
2751 zdb -vvv $1 | awk -F= -v ds="^Dataset $1 "'\\[' '$0 ~ ds && /cksum/ {print $7}'
2761 typeset field=${3:-$pool}
2763 zpool status -v "$pool" 2>/dev/null | \
2764 awk -v device=$disk -v pool=$pool -v field=$field \
2782 rootfs=$(mount -p | awk '$2 == "/" && $3 == "zfs" {print $1}')
2787 if [[ -z "$rootfs" ]]; then
2813 typeset -i min=${2:-1}
2815 typeset -i count=$(echo "$1" | wc -w)
2840 svcs -H -o state labeld 2>/dev/null | grep -q "enabled"
2843 # Return the number of CPUs (cross-platform)
2847 grep -c '^processor' /proc/cpuinfo
2849 sysctl -n kern.smp.cpus
2851 psrinfo | wc -l
2858 [[ $(get_num_cpus) -gt 1 ]]
2866 sysctl -n hw.clockrate
2868 psrinfo -v 0 | awk '/processor operates at/ {print $6}'
2884 sudo -Eu $user env PATH="$PATH" ksh <<<"$*" >$out 2>$err
2905 if [[ -z $pool ]]; then
2913 # can't reference a mirror/raidz vdev using its ID (i.e mirror-0),
2916 zpool status -v "$pool" | grep -A 1000 "config:" >$tmpfile
2918 grep -wq ${vdev##*/} $tmpfile || return 1
2921 rm -f $tmpfile
2927 typeset -l i max=$1
2942 typeset nfiles=${3:-1}
2943 typeset bs=${4:-1024k}
2944 typeset fname=${5:-file}
2946 [[ -d $dir ]] || log_fail "No directory: $dir"
2950 # command line options and cases where the --buffer_compress_*
2958 truncate -s $file_bytes $dir/$fname.$i
2968 command -v fio > /dev/null || log_unsupported "fio missing"
2970 --name=job \
2971 --fallocate=0 \
2972 --minimal \
2973 --randrepeat=0 \
2974 --buffer_compress_percentage=66 \
2975 --buffer_compress_chunk=4096 \
2976 --directory="$dir" \
2977 --numjobs="$nfiles" \
2978 --nrfiles="$nfiles" \
2979 --rw=write \
2980 --bs="$bs" \
2981 --filesize="$megs" \
2982 "--filename_format='$fname.\$jobnum' >/dev/null"
2991 [[ -e $pathname ]] || log_fail "No such file or directory: $pathname"
2993 objnum=$(stat -f "%i" $pathname)
2995 objnum=$(stat -c %i $pathname)
3001 # Sync data to the pool
3008 typeset pool=${1:-$TESTPOOL}
3009 typeset force=${2:-false}
3012 log_must zpool sync -f $pool
3014 log_must zpool sync $pool
3021 # Sync all pools
3027 typeset force=${1:-false}
3030 log_must zpool sync -f
3032 log_must zpool sync
3045 typeset pool=${1:-$TESTPOOL}
3047 [[ "0" == "$(zpool list -Ho freeing $pool)" ]] && break
3060 typeset timeout=${2:-300}
3061 typeset pool=${1:-$TESTPOOL}
3075 typeset timeout=${2:-300}
3076 typeset pool=${1:-$TESTPOOL}
3108 if [[ ! -d $ZEDLET_DIR ]]; then
3112 if [[ ! -e $VDEVID_CONF ]]; then
3116 if [[ -e $VDEVID_CONF_ETC ]]; then
3122 log_must ln -s $VDEVID_CONF $VDEVID_CONF_ETC
3127 log_must cp ${ZEDLET_ETC_DIR}/zed-functions.sh $ZEDLET_DIR
3130 if [[ -n "$EXTRA_ZEDLETS" ]] ; then
3140 log_must sed -i '/\#ZED_DEBUG_LOG=.*/d' $ZEDLET_DIR/zed.rc
3156 log_must rm -f ${ZEDLET_DIR}/$extra_zedlet
3158 …log_must rm -fd ${ZEDLET_DIR}/zed.rc ${ZEDLET_DIR}/zed-functions.sh ${ZEDLET_DIR}/all-syslog.sh ${…
3171 zedpids="$(pgrep -x zed)"
3172 zedpids2="$(pgrep -x lt-zed)"
3186 if [[ ! -d $ZEDLET_DIR ]]; then
3192 if [ -n "$zedpids" ]; then
3194 # is already running - usually this implies our test cases
3198 log_fail "ZED already running - ${zedpids}"
3203 log_must truncate -s 0 $ZED_DEBUG_LOG
3204 log_must eval "zed -vF -d $ZEDLET_DIR -P $PATH" \
3205 "-s $ZEDLET_DIR/state -j 1 2>$ZED_LOG &"
3223 [ ! -n "$zedpids" ] && break
3236 while [ $(zpool events -H | wc -l) -ne 0 ]; do
3238 zpool events -c >/dev/null
3242 # Set a variable in zed.rc to something, un-commenting it in the process.
3252 eval sed -i $cmd $ZEDLET_DIR/zed.rc
3266 if [[ -z $device ]] ; then
3273 swapon -s | grep -wq $(readlink -f $device)
3276 swapctl -l | grep -wq $device
3279 swap -l | grep -wq $device
3297 log_must swapctl -a $swapdev
3300 log_must swap -a $swapdev
3320 log_must swap -d $swapdev
3328 # Set a global system tunable (64-bit value)
3339 # Set a global system tunable (32-bit value)
3367 [[ -z "$value" ]] && return 1
3368 [[ -z "$mdb_cmd" ]] && return 1
3379 echo "${tunable}/${mdb_cmd}0t${value}" | mdb -kw
3386 [[ ! -d $TEST_BASE_DIR ]] && return 1
3387 [[ -e $TEST_BASE_DIR/tunable-$1 ]] && return 2
3388 echo "$(get_tunable """$1""")" > "$TEST_BASE_DIR"/tunable-"$1"
3393 [[ ! -e $TEST_BASE_DIR/tunable-$1 ]] && return 1
3394 val="$(cat $TEST_BASE_DIR/tunable-"""$1""")"
3396 rm $TEST_BASE_DIR/tunable-$1
3412 typeset module="${2:-zfs}"
3418 if [ -z "$check_only" ] ; then
3425 if [ -z "$check_only" ] ; then
3441 sysctl -n vfs.zfs.$tunable
3444 [[ "$module" -eq "zfs" ]] || return 1
3485 echo y | newfs -v "$@"
3496 stat -f %z "$path"
3499 stat -c %s "$path"
3510 stat -f %m "$path"
3513 stat -c %Y "$path"
3524 stat -f %c "$path"
3527 stat -c %Z "$path"
3538 stat -f %B "$path"
3541 stat -c %W "$path"
3555 stat -f %v "${path}"
3569 script -q /dev/null env "$@"
3571 script --return --quiet -c "$*" /dev/null
3580 typeset -i begin=$1
3581 typeset -i end=$2
3583 seq ${begin} ${end} | sort -R
3587 # Cross-platform xattr helpers
3597 getextattr -qq user "${name}" "${path}"
3600 attr -qg "${name}" "${path}"
3616 attr -qs "${name}" -V "${value}" "${path}"
3628 setextattr -i user "${name}" "${path}"
3631 attr -qs "${name}" "${path}"
3643 rmextattr -q user "${name}" "${path}"
3646 attr -qr "${name}" "${path}"
3657 lsextattr -qq user "${path}"
3660 attr -ql "${path}"
3668 typeset flags=${2-"-n"}
3708 truncate -d -o $offset -l $length "$file"
3711 fallocate --punch-hole --offset $offset --length $length "$file"
3727 fallocate --zero-range --offset $offset --length $length "$file"
3736 # Wait for the specified arcstat to reach non-zero quiescence.
3746 if [[ $echo -eq 0 ]]; then
3750 while $do_once || [ $stat1 -ne $stat2 ] || [ $stat2 -eq 0 ]; do
3757 if [[ $echo -eq 1 ]]; then
3786 if [ $child_exit -ne 0 ]; then
3797 # output and a non-zero error is returned.
3808 zil_replay="${LIBTEST_DIFF_ZIL_REPLAY:-0}"
3812 if ! [ -d "$dir_a" -a -d "$dir_b" ]; then
3816 # Run rsync with --dry-run --itemize-changes to get something akin to diff
3820 # Also make sure to filter out non-user.* xattrs when comparing. On
3821 # SELinux-enabled systems the copied tree will probably have different
3823 args=("-nicaAHX" '--filter=-x! user.*' "--delete")
3825 # NOTE: Quite a few rsync builds do not support --crtimes which would be
3834 if rsync --version | grep -q "[, ] crtimes"; then
3835 args+=("--crtimes")
3837 log_note "This rsync package does not support --crtimes (-N)."
3841 # Unfortunately --no-times doesn't do what we want -- it will still tell
3845 if [ "$zil_replay" -eq 0 ]; then
3851 filter=("grep" "-v" '^\..[.Tt]\+ ')
3856 if [ -n "$diff" ]; then
3883 ulimit -c unlimited
3891 sysctl -n kern.corefile
3896 coreadm -p "$1/core.%f"
3906 [ -s "$1" ] || return 0
3910 { read -r pat; read -r pid; } < "$1"