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>

Split Close
Expand all
Collapse all
          --- old/usr/src/test/zfs-tests/include/libtest.shlib
          +++ new/usr/src/test/zfs-tests/include/libtest.shlib
↓ open down ↓ 256 lines elided ↑ open up ↑
 257  257                  log_fail "$fs_vol#$bkmark already exists."
 258  258          fi
 259  259          datasetexists $fs_vol || \
 260  260                  log_fail "$fs_vol must exist."
 261  261          snapexists $fs_vol@$snap || \
 262  262                  log_fail "$fs_vol@$snap must exist."
 263  263  
 264  264          log_must zfs bookmark $fs_vol@$snap $fs_vol#$bkmark
 265  265  }
 266  266  
 267      -#
 268      -# Create a temporary clone result of an interrupted resumable 'zfs receive'
 269      -# $1 Destination filesystem name. Must not exist, will be created as the result
 270      -#    of this function along with its %recv temporary clone
 271      -# $2 Source filesystem name. Must not exist, will be created and destroyed
 272      -#
 273      -function create_recv_clone
 274      -{
 275      -        typeset recvfs="$1"
 276      -        typeset sendfs="${2:-$TESTPOOL/create_recv_clone}"
 277      -        typeset snap="$sendfs@snap1"
 278      -        typeset incr="$sendfs@snap2"
 279      -        typeset mountpoint="$TESTDIR/create_recv_clone"
 280      -        typeset sendfile="$TESTDIR/create_recv_clone.zsnap"
 281      -
 282      -        [[ -z $recvfs ]] && log_fail "Recv filesystem's name is undefined."
 283      -
 284      -        datasetexists $recvfs && log_fail "Recv filesystem must not exist."
 285      -        datasetexists $sendfs && log_fail "Send filesystem must not exist."
 286      -
 287      -        log_must zfs create -o mountpoint="$mountpoint" $sendfs
 288      -        log_must zfs snapshot $snap
 289      -        log_must eval "zfs send $snap | zfs recv -u $recvfs"
 290      -        log_must mkfile 1m "$mountpoint/data"
 291      -        log_must zfs snapshot $incr
 292      -        log_must eval "zfs send -i $snap $incr | dd bs=10k count=1 > $sendfile"
 293      -        log_mustnot eval "zfs recv -su $recvfs < $sendfile"
 294      -        log_must zfs destroy -r $sendfs
 295      -        log_must rm -f "$sendfile"
 296      -
 297      -        if [[ $(get_prop 'inconsistent' "$recvfs/%recv") -ne 1 ]]; then
 298      -                log_fail "Error creating temporary $recvfs/%recv clone"
 299      -        fi
 300      -}
 301      -
 302  267  function default_mirror_setup
 303  268  {
 304  269          default_mirror_setup_noexit $1 $2 $3
 305  270  
 306  271          log_pass
 307  272  }
 308  273  
 309  274  #
 310  275  # Given a pair of disks, set up a storage pool and dataset for the mirror
 311  276  # @parameters: $1 the primary side of the mirror
↓ open down ↓ 172 lines elided ↑ open up ↑
 484  449                                  log_must zfs set readonly=off $fs
 485  450                                  log_must zfs set snapdir=hidden $fs
 486  451                                  log_must zfs set aclmode=groupmask $fs
 487  452                                  log_must zfs set aclinherit=secure $fs
 488  453                          fi
 489  454                  done
 490  455          fi
 491  456  
 492  457          [[ -d $TESTDIR ]] && \
 493  458                  log_must rm -rf $TESTDIR
      459 +        [[ -d $TESTDIR1 ]] && \
      460 +                log_must rm -rf $TESTDIR1
 494  461  }
 495  462  
 496  463  
 497  464  #
 498  465  # Common function used to cleanup storage pools, file systems
 499  466  # and containers.
 500  467  #
 501  468  function default_container_cleanup
 502  469  {
 503  470          if ! is_global_zone; then
↓ open down ↓ 673 lines elided ↑ open up ↑
1177 1144                  log_must zpool create -f $pool $@
1178 1145          fi
1179 1146  
1180 1147          return 0
1181 1148  }
1182 1149  
1183 1150  # Return 0 if destroy successfully or the pool exists; $? otherwise
1184 1151  # Note: In local zones, this function should return 0 silently.
1185 1152  #
1186 1153  # $1 - pool name
     1154 +# $2 - optional force flag
1187 1155  # Destroy pool with the given parameters.
1188 1156  
1189      -function destroy_pool #pool
     1157 +function do_destroy_pool #pool <-f>
1190 1158  {
1191 1159          typeset pool=${1%%/*}
     1160 +        typeset force=$2
1192 1161          typeset mtpt
1193 1162  
1194 1163          if [[ -z $pool ]]; then
1195 1164                  log_note "No pool name given."
1196 1165                  return 1
1197 1166          fi
1198 1167  
1199 1168          if is_global_zone ; then
1200 1169                  if poolexists "$pool" ; then
1201 1170                          mtpt=$(get_prop mountpoint "$pool")
1202 1171  
1203 1172                          # At times, syseventd activity can cause attempts to
1204 1173                          # destroy a pool to fail with EBUSY. We retry a few
1205 1174                          # times allowing failures before requiring the destroy
1206 1175                          # to succeed.
1207      -                        typeset -i wait_time=10 ret=1 count=0
     1176 +                        typeset -i wait_time=$DESTROY_SLEEP_TIME ret=1 count=0
1208 1177                          must=""
1209 1178                          while [[ $ret -ne 0 ]]; do
1210      -                                $must zpool destroy -f $pool
     1179 +                                $must zpool destroy $force $pool
1211 1180                                  ret=$?
1212 1181                                  [[ $ret -eq 0 ]] && break
1213 1182                                  log_note "zpool destroy failed with $ret"
1214      -                                [[ count++ -ge 7 ]] && must=log_must
     1183 +                                [[ count++ -ge $NUM_RETRIES ]] && must=log_must
1215 1184                                  sleep $wait_time
1216 1185                          done
1217 1186  
1218 1187                          [[ -d $mtpt ]] && \
1219 1188                                  log_must rm -rf $mtpt
1220 1189                  else
1221 1190                          log_note "Pool does not exist. ($pool)"
1222 1191                          return 1
1223 1192                  fi
1224 1193          fi
1225 1194  
1226 1195          return 0
1227 1196  }
1228 1197  
     1198 +# Return 0 if destroy successfully or the pool exists; $? otherwise
     1199 +# Note: In local zones, this function should return 0 silently.
1229 1200  #
     1201 +# $1 - pool name
     1202 +# Destroy pool with the given parameters.
     1203 +
     1204 +function destroy_pool_no_force #pool
     1205 +{
     1206 +        typeset pool=${1%%/*}
     1207 +
     1208 +        do_destroy_pool $pool
     1209 +        if (( $? != 0 )); then
     1210 +                return 1
     1211 +        else
     1212 +                return 0
     1213 +        fi
     1214 +}
     1215 +
     1216 +# Return 0 if destroy successfully or the pool exists; $? otherwise
     1217 +# Note: In local zones, this function should return 0 silently.
     1218 +#
     1219 +# $1 - pool name
     1220 +# Force a destroy pool with the given parameters.
     1221 +
     1222 +function destroy_pool #pool
     1223 +{
     1224 +        typeset pool=${1%%/*}
     1225 +
     1226 +        do_destroy_pool $pool -f
     1227 +        if (( $? != 0 )); then
     1228 +                return 1
     1229 +        else
     1230 +                return 0
     1231 +        fi
     1232 +}
     1233 +
     1234 +#
1230 1235  # Firstly, create a pool with 5 datasets. Then, create a single zone and
1231 1236  # export the 5 datasets to it. In addition, we also add a ZFS filesystem
1232 1237  # and a zvol device to the zone.
1233 1238  #
1234 1239  # $1 zone name
1235 1240  # $2 zone root directory prefix
1236 1241  # $3 zone ip
1237 1242  #
1238 1243  function zfs_zones_setup #zone_name zone_root zone_ip
1239 1244  {
↓ open down ↓ 259 lines elided ↑ open up ↑
1499 1504  
1500 1505          cur_state=$(get_device_state $pool $disk "spares")
1501 1506  
1502 1507          if [[ $state != ${cur_state} ]]; then
1503 1508                  return 1
1504 1509          fi
1505 1510          return 0
1506 1511  }
1507 1512  
1508 1513  #
1509      -# Wait until a hotspare transitions to a given state or times out.
1510      -#
1511      -# Return 0 when  pool/disk matches expected state, 1 on timeout.
1512      -#
1513      -function wait_hotspare_state # pool disk state timeout
1514      -{
1515      -        typeset pool=$1
1516      -        typeset disk=${2#$/DEV_DSKDIR/}
1517      -        typeset state=$3
1518      -        typeset timeout=${4:-60}
1519      -        typeset -i i=0
1520      -
1521      -        while [[ $i -lt $timeout ]]; do
1522      -                if check_hotspare_state $pool $disk $state; then
1523      -                        return 0
1524      -                fi
1525      -
1526      -                i=$((i+1))
1527      -                sleep 1
1528      -        done
1529      -
1530      -        return 1
1531      -}
1532      -
1533      -#
1534 1514  # Verify a given slog disk is inuse or avail
1535 1515  #
1536 1516  # Return 0 is pool/disk matches expected state, 1 otherwise
1537 1517  #
1538 1518  function check_slog_state # pool disk state{online,offline,unavail}
1539 1519  {
1540 1520          typeset pool=$1
1541 1521          typeset disk=${2#/dev/dsk/}
1542 1522          typeset state=$3
1543 1523  
↓ open down ↓ 18 lines elided ↑ open up ↑
1562 1542  
1563 1543          cur_state=$(get_device_state $pool $disk)
1564 1544  
1565 1545          if [[ $state != ${cur_state} ]]; then
1566 1546                  return 1
1567 1547          fi
1568 1548          return 0
1569 1549  }
1570 1550  
1571 1551  #
1572      -# Wait until a vdev transitions to a given state or times out.
1573      -#
1574      -# Return 0 when  pool/disk matches expected state, 1 on timeout.
1575      -#
1576      -function wait_vdev_state # pool disk state timeout
1577      -{
1578      -        typeset pool=$1
1579      -        typeset disk=${2#$/DEV_DSKDIR/}
1580      -        typeset state=$3
1581      -        typeset timeout=${4:-60}
1582      -        typeset -i i=0
1583      -
1584      -        while [[ $i -lt $timeout ]]; do
1585      -                if check_vdev_state $pool $disk $state; then
1586      -                        return 0
1587      -                fi
1588      -
1589      -                i=$((i+1))
1590      -                sleep 1
1591      -        done
1592      -
1593      -        return 1
1594      -}
1595      -
1596      -#
1597 1552  # Check the output of 'zpool status -v <pool>',
1598 1553  # and to see if the content of <token> contain the <keyword> specified.
1599 1554  #
1600 1555  # Return 0 is contain, 1 otherwise
1601 1556  #
1602 1557  function check_pool_status # pool token keyword <verbose>
1603 1558  {
1604 1559          typeset pool=$1
1605 1560          typeset token=$2
1606 1561          typeset keyword=$3
↓ open down ↓ 10 lines elided ↑ open up ↑
1617 1572  }
1618 1573  
1619 1574  #
1620 1575  # These 6 following functions are instance of check_pool_status()
1621 1576  #       is_pool_resilvering - to check if the pool is resilver in progress
1622 1577  #       is_pool_resilvered - to check if the pool is resilver completed
1623 1578  #       is_pool_scrubbing - to check if the pool is scrub in progress
1624 1579  #       is_pool_scrubbed - to check if the pool is scrub completed
1625 1580  #       is_pool_scrub_stopped - to check if the pool is scrub stopped
1626 1581  #       is_pool_scrub_paused - to check if the pool has scrub paused
1627      -#       is_pool_removing - to check if the pool is removing a vdev
1628      -#       is_pool_removed - to check if the pool is remove completed
1629 1582  #
1630 1583  function is_pool_resilvering #pool <verbose>
1631 1584  {
1632 1585          check_pool_status "$1" "scan" "resilver in progress since " $2
1633 1586          return $?
1634 1587  }
1635 1588  
1636 1589  function is_pool_resilvered #pool <verbose>
1637 1590  {
1638 1591          check_pool_status "$1" "scan" "resilvered " $2
↓ open down ↓ 17 lines elided ↑ open up ↑
1656 1609          check_pool_status "$1" "scan" "scrub canceled" $2
1657 1610          return $?
1658 1611  }
1659 1612  
1660 1613  function is_pool_scrub_paused #pool <verbose>
1661 1614  {
1662 1615          check_pool_status "$1" "scan" "scrub paused since " $2
1663 1616          return $?
1664 1617  }
1665 1618  
1666      -function is_pool_removing #pool
1667      -{
1668      -        check_pool_status "$1" "remove" "in progress since "
1669      -        return $?
1670      -}
1671      -
1672      -function is_pool_removed #pool
1673      -{
1674      -        check_pool_status "$1" "remove" "completed on"
1675      -        return $?
1676      -}
1677      -
1678 1619  #
1679 1620  # Use create_pool()/destroy_pool() to clean up the infomation in
1680 1621  # in the given disk to avoid slice overlapping.
1681 1622  #
1682 1623  function cleanup_devices #vdevs
1683 1624  {
1684 1625          typeset pool="foopool$$"
1685 1626  
1686 1627          if poolexists $pool ; then
1687 1628                  destroy_pool $pool
↓ open down ↓ 754 lines elided ↑ open up ↑
2442 2383  # Run the given command as the user provided.
2443 2384  function user_run
2444 2385  {
2445 2386          typeset user=$1
2446 2387          shift
2447 2388  
2448 2389          eval su \$user -c \"$@\" > /tmp/out 2>/tmp/err
2449 2390          return $?
2450 2391  }
2451 2392  
     2393 +# Return 0 if the pool is successfully epxorted; $? otherwise
2452 2394  #
     2395 +# $1 - pool name
     2396 +# Export pool.
     2397 +function export_pool #pool
     2398 +{
     2399 +        typeset pool=${1%%/*}
     2400 +        # Checking to see if the device is busy. If so, we'll
     2401 +        # retry the export a few times with a sleep between tries.
     2402 +        errmsg='device is busy'
     2403 +        retry_num=$NUM_RETRIES
     2404 +        TMPFILE=`mktemp`
     2405 +        if [ -z "$TMPFILE" ] ; then
     2406 +                log_note "Unable to create temporary file $TMPFILE"
     2407 +                return 1
     2408 +        fi
     2409 +        until [ $retry_num == 0 ] ; do
     2410 +                log_note "zpool export $pool"
     2411 +                zpool export $pool 2>$TMPFILE
     2412 +                # If the export failed, see if it's due to a
     2413 +                # device is busy issue and retry if it is.
     2414 +                if (( $? != 0 )); then
     2415 +                        # if this is busy then we want to retry
     2416 +                        if [ "`grep "$errmsg" $TMPFILE`" != "" ]; then
     2417 +                                retry_num-=1
     2418 +                                log_note "Device is busy, retry zpool export"
     2419 +                                sleep $EXPORT_SLEEP_TIME
     2420 +                        else # return here if error is something else
     2421 +                                rn $TMPFILE
     2422 +                                return 1
     2423 +                        fi
     2424 +                else
     2425 +                        # export succeeded.
     2426 +                        rm $TMPFILE
     2427 +                        return 0
     2428 +                fi
     2429 +        done
     2430 +        # We've reached our max retries, try to export one more time
     2431 +        # and require it to succeed.
     2432 +        log_must zpool export $pool
     2433 +}
     2434 +
     2435 +#
2453 2436  # Check if the pool contains the specified vdevs
2454 2437  #
2455 2438  # $1 pool
2456 2439  # $2..n <vdev> ...
2457 2440  #
2458 2441  # Return 0 if the vdevs are contained in the pool, 1 if any of the specified
2459 2442  # vdevs is not in the pool, and 2 if pool name is missing.
2460 2443  #
2461 2444  function vdevs_in_pool
2462 2445  {
↓ open down ↓ 41 lines elided ↑ open up ↑
2504 2487          done
2505 2488  
2506 2489          echo $min
2507 2490  }
2508 2491  
2509 2492  #
2510 2493  # Generate a random number between 1 and the argument.
2511 2494  #
2512 2495  function random
2513 2496  {
2514      -        typeset max=$1
2515      -        echo $(( ($RANDOM % $max) + 1 ))
     2497 +        typeset max=$1
     2498 +        echo $(( ($RANDOM % $max) + 1 ))
2516 2499  }
2517 2500  
2518 2501  # Write data that can be compressed into a directory
2519 2502  function write_compressible
2520 2503  {
2521 2504          typeset dir=$1
2522 2505          typeset megs=$2
2523 2506          typeset nfiles=${3:-1}
2524 2507          typeset bs=${4:-1024k}
2525 2508          typeset fname=${5:-file}
↓ open down ↓ 16 lines elided ↑ open up ↑
2542 2525  }
2543 2526  
2544 2527  function get_objnum
2545 2528  {
2546 2529          typeset pathname=$1
2547 2530          typeset objnum
2548 2531  
2549 2532          [[ -e $pathname ]] || log_fail "No such file or directory: $pathname"
2550 2533          objnum=$(stat -c %i $pathname)
2551 2534          echo $objnum
2552      -}
2553      -
2554      -#
2555      -# Prints the current time in seconds since UNIX Epoch.
2556      -#
2557      -function current_epoch
2558      -{
2559      -        printf '%(%s)T'
2560      -}
2561      -
2562      -#
2563      -# Get decimal value of global uint32_t variable using mdb.
2564      -#
2565      -function mdb_get_uint32
2566      -{
2567      -        typeset variable=$1
2568      -        typeset value
2569      -
2570      -        value=$(mdb -k -e "$variable/X | ::eval .=U")
2571      -        if [[ $? -ne 0 ]]; then
2572      -                log_fail "Failed to get value of '$variable' from mdb."
2573      -                return 1
2574      -        fi
2575      -
2576      -        echo $value
2577      -        return 0
2578      -}
2579      -
2580      -#
2581      -# Set global uint32_t variable to a decimal value using mdb.
2582      -#
2583      -function mdb_set_uint32
2584      -{
2585      -        typeset variable=$1
2586      -        typeset value=$2
2587      -
2588      -        mdb -kw -e "$variable/W 0t$value" > /dev/null
2589      -        if [[ $? -ne 0 ]]; then
2590      -                echo "Failed to set '$variable' to '$value' in mdb."
2591      -                return 1
2592      -        fi
2593      -
2594      -        return 0
2595 2535  }
    
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX