Print this page
NEX-9752 backport illumos 6950 ARC should cache compressed data
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Yuri Pankov <yuri.pankov@nexenta.com>
6950 ARC should cache compressed data
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Dan Kimmel <dan.kimmel@delphix.com>
Reviewed by: Matt Ahrens <mahrens@delphix.com>
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Don Brady <don.brady@intel.com>
Reviewed by: Richard Elling <Richard.Elling@RichardElling.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
6369 remove SVM tests from ZFS test suite
Reviewed by: John Kennedy <john.kennedy@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Albert Lee <trisk@omniti.com>
Approved by: Dan McDonald <danmcd@omniti.com>
6248 zpool_create_008_pos and zpool_create_009_neg can fail intermittently
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
4185 add new cryptographic checksums to ZFS: SHA-512, Skein, Edon-R (fix studio build)
4185 add new cryptographic checksums to ZFS: SHA-512, Skein, Edon-R
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Prakash Surya <prakash.surya@delphix.com>
Reviewed by: Saso Kiselkov <saso.kiselkov@nexenta.com>
Reviewed by: Richard Lowe <richlowe@richlowe.net>
Approved by: Garrett D'Amore <garrett@damore.org>
5767 fix several problems with zfs test suite
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Approved by: Gordon Ross <gwr@nexenta.com>
NEX-3974 Remove timing issues so the robot can run consistently
Reviewed by: Steve Peng <steve.peng@nexenta.com>
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
NEX-3363 Test suites don't cleanup after themselves properly.
Reviewed by: Josef 'Jeff' Sipek <josef.sipek@nexenta.com>
NEX-3740 The zfs tests use psrinfo instead of /usr/sbin/psrinfo
    Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
    Reviewed by: Steve Peng <steve.peng@nexenta.com>
NEX-3258 Remove dependency upon SVM from zfs-tests
Reviewed by: Josef Sipek <josef.sipek@nexenta.com>
Reviewed by: Steve Peng <steve.peng@nexenta.com>
Reviewed by: Alek Pinchuk <alek.pinchuk@nexenta.com>
NEX-2744 zfs-tests suite fails rootpool_002_neg
NEX-2739 zfs-tests suite fails link_count_001
NEX-2741 zfs-tests suite fails mmap_write_001_pos
4206 history_003_pos relies on exact size of history log and entries
4207 history_008_pos depends on obsolete internal history log message
4208 Typo in zfs_main.c: "posxiuser"
4209 Populate zfstest with the remainder of the STF tests
Reviewed by: Sonu Pillai <sonu.pillai@delphix.com>
Reviewed by: Will Guyette <will.guyette@delphix.com>
Reviewed by: Eric Diven <eric.diven@delphix.com>
Reviewed by: Christopher Siden <christopher.siden@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>

@@ -262,45 +262,10 @@
                 log_fail "$fs_vol@$snap must exist."
 
         log_must zfs bookmark $fs_vol@$snap $fs_vol#$bkmark
 }
 
-#
-# Create a temporary clone result of an interrupted resumable 'zfs receive'
-# $1 Destination filesystem name. Must not exist, will be created as the result
-#    of this function along with its %recv temporary clone
-# $2 Source filesystem name. Must not exist, will be created and destroyed
-#
-function create_recv_clone
-{
-        typeset recvfs="$1"
-        typeset sendfs="${2:-$TESTPOOL/create_recv_clone}"
-        typeset snap="$sendfs@snap1"
-        typeset incr="$sendfs@snap2"
-        typeset mountpoint="$TESTDIR/create_recv_clone"
-        typeset sendfile="$TESTDIR/create_recv_clone.zsnap"
-
-        [[ -z $recvfs ]] && log_fail "Recv filesystem's name is undefined."
-
-        datasetexists $recvfs && log_fail "Recv filesystem must not exist."
-        datasetexists $sendfs && log_fail "Send filesystem must not exist."
-
-        log_must zfs create -o mountpoint="$mountpoint" $sendfs
-        log_must zfs snapshot $snap
-        log_must eval "zfs send $snap | zfs recv -u $recvfs"
-        log_must mkfile 1m "$mountpoint/data"
-        log_must zfs snapshot $incr
-        log_must eval "zfs send -i $snap $incr | dd bs=10k count=1 > $sendfile"
-        log_mustnot eval "zfs recv -su $recvfs < $sendfile"
-        log_must zfs destroy -r $sendfs
-        log_must rm -f "$sendfile"
-
-        if [[ $(get_prop 'inconsistent' "$recvfs/%recv") -ne 1 ]]; then
-                log_fail "Error creating temporary $recvfs/%recv clone"
-        fi
-}
-
 function default_mirror_setup
 {
         default_mirror_setup_noexit $1 $2 $3
 
         log_pass

@@ -489,10 +454,12 @@
                 done
         fi
 
         [[ -d $TESTDIR ]] && \
                 log_must rm -rf $TESTDIR
+        [[ -d $TESTDIR1 ]] && \
+                log_must rm -rf $TESTDIR1
 }
 
 
 #
 # Common function used to cleanup storage pools, file systems

@@ -1182,15 +1149,17 @@
 
 # Return 0 if destroy successfully or the pool exists; $? otherwise
 # Note: In local zones, this function should return 0 silently.
 #
 # $1 - pool name
+# $2 - optional force flag
 # Destroy pool with the given parameters.
 
-function destroy_pool #pool
+function do_destroy_pool #pool <-f>
 {
         typeset pool=${1%%/*}
+        typeset force=$2
         typeset mtpt
 
         if [[ -z $pool ]]; then
                 log_note "No pool name given."
                 return 1

@@ -1202,18 +1171,18 @@
 
                         # At times, syseventd activity can cause attempts to
                         # destroy a pool to fail with EBUSY. We retry a few
                         # times allowing failures before requiring the destroy
                         # to succeed.
-                        typeset -i wait_time=10 ret=1 count=0
+                        typeset -i wait_time=$DESTROY_SLEEP_TIME ret=1 count=0
                         must=""
                         while [[ $ret -ne 0 ]]; do
-                                $must zpool destroy -f $pool
+                                $must zpool destroy $force $pool
                                 ret=$?
                                 [[ $ret -eq 0 ]] && break
                                 log_note "zpool destroy failed with $ret"
-                                [[ count++ -ge 7 ]] && must=log_must
+                                [[ count++ -ge $NUM_RETRIES ]] && must=log_must
                                 sleep $wait_time
                         done
 
                         [[ -d $mtpt ]] && \
                                 log_must rm -rf $mtpt

@@ -1224,11 +1193,47 @@
         fi
 
         return 0
 }
 
+# Return 0 if destroy successfully or the pool exists; $? otherwise
+# Note: In local zones, this function should return 0 silently.
 #
+# $1 - pool name
+# Destroy pool with the given parameters.
+
+function destroy_pool_no_force #pool
+{
+        typeset pool=${1%%/*}
+
+        do_destroy_pool $pool
+        if (( $? != 0 )); then
+                return 1
+        else
+                return 0
+        fi
+}
+
+# Return 0 if destroy successfully or the pool exists; $? otherwise
+# Note: In local zones, this function should return 0 silently.
+#
+# $1 - pool name
+# Force a destroy pool with the given parameters.
+
+function destroy_pool #pool
+{
+        typeset pool=${1%%/*}
+
+        do_destroy_pool $pool -f
+        if (( $? != 0 )); then
+                return 1
+        else
+                return 0
+        fi
+}
+
+#
 # Firstly, create a pool with 5 datasets. Then, create a single zone and
 # export the 5 datasets to it. In addition, we also add a ZFS filesystem
 # and a zvol device to the zone.
 #
 # $1 zone name

@@ -1504,35 +1509,10 @@
         fi
         return 0
 }
 
 #
-# Wait until a hotspare transitions to a given state or times out.
-#
-# Return 0 when  pool/disk matches expected state, 1 on timeout.
-#
-function wait_hotspare_state # pool disk state timeout
-{
-        typeset pool=$1
-        typeset disk=${2#$/DEV_DSKDIR/}
-        typeset state=$3
-        typeset timeout=${4:-60}
-        typeset -i i=0
-
-        while [[ $i -lt $timeout ]]; do
-                if check_hotspare_state $pool $disk $state; then
-                        return 0
-                fi
-
-                i=$((i+1))
-                sleep 1
-        done
-
-        return 1
-}
-
-#
 # Verify a given slog disk is inuse or avail
 #
 # Return 0 is pool/disk matches expected state, 1 otherwise
 #
 function check_slog_state # pool disk state{online,offline,unavail}

@@ -1567,35 +1547,10 @@
         fi
         return 0
 }
 
 #
-# Wait until a vdev transitions to a given state or times out.
-#
-# Return 0 when  pool/disk matches expected state, 1 on timeout.
-#
-function wait_vdev_state # pool disk state timeout
-{
-        typeset pool=$1
-        typeset disk=${2#$/DEV_DSKDIR/}
-        typeset state=$3
-        typeset timeout=${4:-60}
-        typeset -i i=0
-
-        while [[ $i -lt $timeout ]]; do
-                if check_vdev_state $pool $disk $state; then
-                        return 0
-                fi
-
-                i=$((i+1))
-                sleep 1
-        done
-
-        return 1
-}
-
-#
 # Check the output of 'zpool status -v <pool>',
 # and to see if the content of <token> contain the <keyword> specified.
 #
 # Return 0 is contain, 1 otherwise
 #

@@ -1622,12 +1577,10 @@
 #       is_pool_resilvered - to check if the pool is resilver completed
 #       is_pool_scrubbing - to check if the pool is scrub in progress
 #       is_pool_scrubbed - to check if the pool is scrub completed
 #       is_pool_scrub_stopped - to check if the pool is scrub stopped
 #       is_pool_scrub_paused - to check if the pool has scrub paused
-#       is_pool_removing - to check if the pool is removing a vdev
-#       is_pool_removed - to check if the pool is remove completed
 #
 function is_pool_resilvering #pool <verbose>
 {
         check_pool_status "$1" "scan" "resilver in progress since " $2
         return $?

@@ -1661,22 +1614,10 @@
 {
         check_pool_status "$1" "scan" "scrub paused since " $2
         return $?
 }
 
-function is_pool_removing #pool
-{
-        check_pool_status "$1" "remove" "in progress since "
-        return $?
-}
-
-function is_pool_removed #pool
-{
-        check_pool_status "$1" "remove" "completed on"
-        return $?
-}
-
 #
 # Use create_pool()/destroy_pool() to clean up the infomation in
 # in the given disk to avoid slice overlapping.
 #
 function cleanup_devices #vdevs

@@ -2447,11 +2388,53 @@
 
         eval su \$user -c \"$@\" > /tmp/out 2>/tmp/err
         return $?
 }
 
+# Return 0 if the pool is successfully epxorted; $? otherwise
 #
+# $1 - pool name
+# Export pool.
+function export_pool #pool
+{
+        typeset pool=${1%%/*}
+        # Checking to see if the device is busy. If so, we'll
+        # retry the export a few times with a sleep between tries.
+        errmsg='device is busy'
+        retry_num=$NUM_RETRIES
+        TMPFILE=`mktemp`
+        if [ -z "$TMPFILE" ] ; then
+                log_note "Unable to create temporary file $TMPFILE"
+                return 1
+        fi
+        until [ $retry_num == 0 ] ; do
+                log_note "zpool export $pool"
+                zpool export $pool 2>$TMPFILE
+                # If the export failed, see if it's due to a
+                # device is busy issue and retry if it is.
+                if (( $? != 0 )); then
+                        # if this is busy then we want to retry
+                        if [ "`grep "$errmsg" $TMPFILE`" != "" ]; then
+                                retry_num-=1
+                                log_note "Device is busy, retry zpool export"
+                                sleep $EXPORT_SLEEP_TIME
+                        else # return here if error is something else
+                                rn $TMPFILE
+                                return 1
+                        fi
+                else
+                        # export succeeded.
+                        rm $TMPFILE
+                        return 0
+                fi
+        done
+        # We've reached our max retries, try to export one more time
+        # and require it to succeed.
+        log_must zpool export $pool
+}
+
+#
 # Check if the pool contains the specified vdevs
 #
 # $1 pool
 # $2..n <vdev> ...
 #

@@ -2547,49 +2530,6 @@
         typeset objnum
 
         [[ -e $pathname ]] || log_fail "No such file or directory: $pathname"
         objnum=$(stat -c %i $pathname)
         echo $objnum
-}
-
-#
-# Prints the current time in seconds since UNIX Epoch.
-#
-function current_epoch
-{
-        printf '%(%s)T'
-}
-
-#
-# Get decimal value of global uint32_t variable using mdb.
-#
-function mdb_get_uint32
-{
-        typeset variable=$1
-        typeset value
-
-        value=$(mdb -k -e "$variable/X | ::eval .=U")
-        if [[ $? -ne 0 ]]; then
-                log_fail "Failed to get value of '$variable' from mdb."
-                return 1
-        fi
-
-        echo $value
-        return 0
-}
-
-#
-# Set global uint32_t variable to a decimal value using mdb.
-#
-function mdb_set_uint32
-{
-        typeset variable=$1
-        typeset value=$2
-
-        mdb -kw -e "$variable/W 0t$value" > /dev/null
-        if [[ $? -ne 0 ]]; then
-                echo "Failed to set '$variable' to '$value' in mdb."
-                return 1
-        fi
-
-        return 0
 }