]> git.proxmox.com Git - mirror_zfs.git/commitdiff
OpenZFS 7535 - need test for resumed send of top most filesystem
authorBrian Behlendorf <behlendorf1@llnl.gov>
Wed, 12 Apr 2017 15:47:42 +0000 (08:47 -0700)
committerGitHub <noreply@github.com>
Wed, 12 Apr 2017 15:47:42 +0000 (08:47 -0700)
Authored by: John Kennedy <john.kennedy@delphix.com>
Reviewed by: George Wilson <george.wilson@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Approved by: Richard Lowe <richlowe@richlowe.net>
Ported-by: Brian Behlendorf <behlendorf1@llnl.gov>
Porting Notes:
- zfs_share_001_pos.ksh - Older versions of exportfs will match
  multiple exports that share a common prefix.  Reorder the 'fs'
  list so unshares occur from most to least unique.
- zfs_share_005_pos.ksh - Enabled and updated for Linux.

OpenZFS-issue: https://www.illumos.org/issues/7535
OpenZFS-commit: https://github.com/openzfs/openzfs/commit/ac89d1e
Closes #5979

15 files changed:
tests/runfiles/linux.run
tests/zfs-tests/include/default.cfg
tests/zfs-tests/tests/functional/cli_root/zfs_send/zfs_send_007_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_001_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zfs_share/zfs_share_005_pos.ksh
tests/zfs-tests/tests/functional/cli_root/zpool_import/zpool_import_rename_001_pos.ksh
tests/zfs-tests/tests/functional/rsend/cleanup.ksh
tests/zfs-tests/tests/functional/rsend/rsend.cfg
tests/zfs-tests/tests/functional/rsend/rsend.kshlib
tests/zfs-tests/tests/functional/rsend/rsend_019_pos.ksh
tests/zfs-tests/tests/functional/rsend/rsend_020_pos.ksh
tests/zfs-tests/tests/functional/rsend/rsend_021_pos.ksh
tests/zfs-tests/tests/functional/rsend/rsend_022_pos.ksh
tests/zfs-tests/tests/functional/rsend/rsend_024_pos.ksh
tests/zfs-tests/tests/functional/rsend/setup.ksh

index a358b55785ccd06ac0d0e62d45d08077580d3152..9415edbe0c9c617def5346edf01c37dd73b4455c 100644 (file)
@@ -184,11 +184,9 @@ tests = ['cache_001_pos', 'cache_002_neg', 'canmount_001_pos',
     'zfs_set_002_neg', 'zfs_set_003_neg', 'property_alias_001_pos',
     'mountpoint_003_pos', 'ro_props_001_pos']
 
-# DISABLED:
-# zfs_share_005_pos - needs investigation, probably unsupported NFS share format
 [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_006_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']
 
index 63104a8b7648086d8d9ef522d291aff659901717..83c3ec47c60ce5482fceacec9654fd868ed39086 100644 (file)
@@ -70,23 +70,28 @@ export FIO_SCRIPTS=$STF_SUITE/tests/perf/fio
 export PERF_SCRIPTS=$STF_SUITE/tests/perf/scripts
 
 # some test pool names
-export TESTPOOL=testpool.$$
-export TESTPOOL1=testpool1.$$
-export TESTPOOL2=testpool2.$$
-export TESTPOOL3=testpool3.$$
+export TESTPOOL=testpool
+export TESTPOOL1=testpool1
+export TESTPOOL2=testpool2
+export TESTPOOL3=testpool3
 export PERFPOOL=perfpool
 
 # some test file system names
-export TESTFS=testfs.$$
-export TESTFS1=testfs1.$$
-export TESTFS2=testfs2.$$
-export TESTFS3=testfs3.$$
+export TESTFS=testfs
+export TESTFS1=testfs1
+export TESTFS2=testfs2
+export TESTFS3=testfs3
 
 # some test directory names
-export TESTDIR=${TEST_BASE_DIR%%/}/testdir$$
-export TESTDIR0=${TEST_BASE_DIR%%/}/testdir0$$
-export TESTDIR1=${TEST_BASE_DIR%%/}/testdir1$$
-export TESTDIR2=${TEST_BASE_DIR%%/}/testdir2$$
+export TESTDIR=${TEST_BASE_DIR%%/}/testdir
+export TESTDIR0=${TEST_BASE_DIR%%/}/testdir0
+export TESTDIR1=${TEST_BASE_DIR%%/}/testdir1
+export TESTDIR2=${TEST_BASE_DIR%%/}/testdir2
+
+# some test sub file system names
+export TESTSUBFS=subfs
+export TESTSUBFS1=subfs1
+export TESTSUBFS2=subfs2
 
 # some temp files
 export TEMPFILE=${TEST_BASE_DIR%%/}/tempfile$$
@@ -96,23 +101,23 @@ export TEMPFILE2=${TEST_BASE_DIR%%/}/tempfile2$$
 
 export ZFSROOT=
 
-export TESTSNAP=testsnap$$
-export TESTSNAP1=testsnap1$$
-export TESTSNAP2=testsnap2$$
-export TESTCLONE=testclone$$
-export TESTCLONE1=testclone1$$
-export TESTCLONE2=testclone2$$
-export TESTCLCT=testclct$$
-export TESTCTR=testctr$$
-export TESTCTR1=testctr1$$
-export TESTCTR2=testctr2$$
-export TESTVOL=testvol$$
-export TESTVOL1=testvol1$$
-export TESTVOL2=testvol2$$
-export TESTFILE0=testfile0.$$
-export TESTFILE1=testfile1.$$
-export TESTFILE2=testfile2.$$
-export TESTBKMARK=testbkmark$$
+export TESTSNAP=testsnap
+export TESTSNAP1=testsnap1
+export TESTSNAP2=testsnap2
+export TESTCLONE=testclone
+export TESTCLONE1=testclone1
+export TESTCLONE2=testclone2
+export TESTCLCT=testclct
+export TESTCTR=testctr
+export TESTCTR1=testctr1
+export TESTCTR2=testctr2
+export TESTVOL=testvol
+export TESTVOL1=testvol1
+export TESTVOL2=testvol2
+export TESTFILE0=testfile0
+export TESTFILE1=testfile1
+export TESTFILE2=testfile2
+export TESTBKMARK=testbkmark
 
 export LONGPNAME="poolname50charslong_012345678901234567890123456789"
 export LONGFSNAME="fsysname50charslong_012345678901234567890123456789"
index 3147a7a14a549fa2d6b88587baf0658b469fe14c..8d2061b31cb7dac0d97508dd642e23c650a261f5 100755 (executable)
@@ -42,7 +42,7 @@ function cleanup
        zfs destroy -rf $TESTPOOL/recvfs
        rm $streamfile
        rm $vdev
-       zpool destroy testpool
+       zpool destroy tmp_pool
 }
 
 
@@ -88,12 +88,11 @@ test_pool ()
 
 test_pool $TESTPOOL
 log_must truncate --size=1G $vdev
-log_must zpool create -o version=1 testpool $vdev
-test_pool testpool
-log_must zpool destroy testpool
-log_must zpool create -d testpool $vdev
-test_pool testpool
-log_must zpool destroy testpool
-
+log_must zpool create -o version=1 tmp_pool $vdev
+test_pool tmp_pool
+log_must zpool destroy tmp_pool
+log_must zpool create -d tmp_pool $vdev
+test_pool tmp_pool
+log_must zpool destroy tmp_pool
 
 log_pass "'zfs send' drills appropriate holes"
index 7638660e3d8f7314265c8518f21796b9d1b98635..a2c06e0b38cf89fe8b844d2e7d3e752a0459cdb7 100755 (executable)
@@ -47,9 +47,9 @@
 verify_runnable "global"
 
 set -A fs \
-    "$TESTDIR" "$TESTPOOL/$TESTFS" \
     "$TESTDIR1" "$TESTPOOL/$TESTCTR/$TESTFS1" \
-    "$TESTDIR2" "$TESTPOOL/$TESTFS-clone"
+    "$TESTDIR2" "$TESTPOOL/$TESTFS-clone" \
+    "$TESTDIR" "$TESTPOOL/$TESTFS"
 
 function cleanup
 {
index 006517d01e8a8c3b31a6672d1fe09891429ada16..013e04ba311f189c4a58e918c9f0ab7d24b3134c 100755 (executable)
@@ -50,12 +50,17 @@ function cleanup
                log_must unshare_fs $TESTPOOL/$TESTFS
 }
 
-set -A shareopts \
-    "ro" "ro=machine1" "ro=machine1:machine2" \
-    "rw" "rw=machine1" "rw=machine1:machine2" \
-    "ro=machine1:machine2,rw" "anon=0" "anon=0,sec=sys,rw" \
-    "nosuid" "root=machine1:machine2" "rw=.mydomain.mycompany.com" \
-    "rw=-terra:engineering" "log" "public"
+if is_linux; then
+       set -A shareopts \
+           "ro" "rw" "rw,insecure" "rw,async" "ro,crossmnt"
+else
+       set -A shareopts \
+           "ro" "ro=machine1" "ro=machine1:machine2" \
+           "rw" "rw=machine1" "rw=machine1:machine2" \
+           "ro=machine1:machine2,rw" "anon=0" "anon=0,sec=sys,rw" \
+           "nosuid" "root=machine1:machine2" "rw=.mydomain.mycompany.com" \
+           "rw=-terra:engineering" "log" "public"
+fi
 
 log_assert "Verify that NFS share options are propagated correctly."
 log_onexit cleanup
@@ -72,6 +77,11 @@ do
                log_fail "get sharenfs failed. ($option != ${shareopts[i]})"
        fi
 
+       # Verify the single option after the leading 'ro' or 'rw'.
+       if is_linux; then
+               option=`echo "$option" | cut -f2 -d','`
+       fi
+
        showshares_nfs | grep $option > /dev/null 2>&1
        if (( $? != 0 )); then
                log_fail "The '$option' option was not found in share output."
index ea4ea0caf8d031e1381aa7dcd5a79d2e1ec01ed3..6d8db3b674961f93dd61bf4acffd39abfe3eabae 100755 (executable)
@@ -164,10 +164,11 @@ done
 VDEV_FILE=$(mktemp /tmp/tmp.XXXXXX)
 
 log_must mkfile -n 128M $VDEV_FILE
-log_must zpool create testpool $VDEV_FILE
-log_must zfs create testpool/testfs
-ID=$(zpool get -Ho value guid testpool)
-log_must zpool export testpool
-log_mustnot zpool import $(echo id) $(printf "%*s\n" 250 "" | tr ' ' 'c')
+log_must zpool create overflow $VDEV_FILE
+log_must zfs create overflow/testfs
+ID=$(zpool get -Ho value guid overflow)
+log_must zpool export overflow
+log_mustnot zpool import -d /tmp $(echo id) \
+    $(printf "%*s\n" 250 "" | tr ' ' 'c')
 
 log_pass "Successfully imported and renamed a ZPOOL"
index 17a3e09a73af5930ed277e445c9443cf84ea41bf..063fe9dd1f61f46d557c7e2ea84d3ca8543fe78a 100755 (executable)
@@ -36,9 +36,11 @@ verify_runnable "both"
 if is_global_zone ; then
        destroy_pool $POOL
        destroy_pool $POOL2
+       poolexists $POOL3 && destroy_pool $POOL3
 else
        cleanup_pool $POOL
        cleanup_pool $POOL2
+       poolexists $POOL3 && cleanup_pool $POOL3
 fi
 log_must rm -rf $BACKDIR $TESTDIR
 
index 064a6e7caf6a61007296d28ca6b4db3336836f6c..8984ee2a7039014999b6ce4cf03c5816de59c71e 100644 (file)
@@ -31,7 +31,9 @@ export BACKDIR=${TEST_BASE_DIR%%/}/backdir-rsend
 
 export DISK1=${DISKS%% *}
 export DISK2=$(echo $DISKS | awk '{print $2}')
+export DISK3=$(echo $DISKS | awk '{print $3}')
 
 export POOL=$TESTPOOL
 export POOL2=$TESTPOOL1
+export POOL3=$TESTPOOL2
 export FS=$TESTFS
index 784d0f75a418ad37f4330e20bfc9a60d45ba3a30..ac07dcf90c0809e6ebebb6bbb6378341d5b77765 100644 (file)
@@ -120,7 +120,7 @@ function cleanup_pool
        if is_global_zone ; then
                log_must zfs destroy -Rf $pool
        else
-               typeset list=$(zfs list -H -r -t filesystem,snapshot,volume -o name $pool)
+               typeset list=$(zfs list -H -r -t all -o name $pool)
                for ds in $list ; do
                        if [[ $ds != $pool ]] ; then
                                if datasetexists $ds ; then
@@ -140,12 +140,18 @@ function cleanup_pool
                log_must zfs mount $pool
        fi
        if [[ -d $mntpnt ]]; then
-               log_must rm -rf $mntpnt/*
+               rm -rf $mntpnt/*
        fi
 
        return 0
 }
 
+function cleanup_pools
+{
+       cleanup_pool $POOL2
+       destroy_pool $POOL3
+}
+
 #
 # Detect if the given two filesystems have same sub-datasets
 #
@@ -157,8 +163,8 @@ function cmp_ds_subs
        typeset src_fs=$1
        typeset dst_fs=$2
 
-       zfs list -r -H -t filesystem,snapshot,volume -o name $src_fs > $BACKDIR/src1
-       zfs list -r -H -t filesystem,snapshot,volume -o name $dst_fs > $BACKDIR/dst1
+       zfs list -r -H -t all -o name $src_fs > $BACKDIR/src1
+       zfs list -r -H -t all -o name $dst_fs > $BACKDIR/dst1
 
        eval sed -e 's:^$src_fs:PREFIX:g' < $BACKDIR/src1 > $BACKDIR/src
        eval sed -e 's:^$dst_fs:PREFIX:g' < $BACKDIR/dst1 > $BACKDIR/dst
@@ -324,8 +330,7 @@ function getds_with_suffix
        typeset ds=$1
        typeset suffix=$2
 
-       typeset list=$(zfs list -r -H -t filesystem,snapshot,volume -o name $ds \
-           | grep "$suffix$")
+       typeset list=$(zfs list -r -H -t all -o name $ds | grep "$suffix$")
 
        echo $list
 }
@@ -487,7 +492,7 @@ function resume_test
 
        for ((i=0; i<2; i=i+1)); do
                mess_file /$streamfs/$stream_num
-               log_mustnot zfs recv -sv $recvfs </$streamfs/$stream_num
+               log_mustnot zfs recv -suv $recvfs </$streamfs/$stream_num
                stream_num=$((stream_num+1))
 
                token=$(zfs get -Hp -o value receive_resume_token $recvfs)
@@ -495,31 +500,26 @@ function resume_test
                [[ -f /$streamfs/$stream_num ]] || \
                    log_fail "NO FILE /$streamfs/$stream_num"
        done
-       log_must zfs recv -sv $recvfs </$streamfs/$stream_num
+       log_must zfs recv -suv $recvfs </$streamfs/$stream_num
 }
 
 #
 # Setup filesystems for the resumable send/receive tests
 #
-# $1 The pool to set up with the "send" filesystems
-# $2 The pool for receive
+# $1 The "send" filesystem
+# $2 The "recv" filesystem
 #
 function test_fs_setup
 {
-       sendpool=$1
-       recvpool=$2
+       typeset sendfs=$1
+       typeset recvfs=$2
+       typeset sendpool=${sendfs%%/*}
+       typeset recvpool=${recvfs%%/*}
 
-       sendfs=$sendpool/sendfs
-       recvfs=$recvpool/recvfs
-       streamfs=$sendpool/stream
+       datasetexists $sendfs && log_must zfs destroy -r $sendpool
+       datasetexists $recvfs && log_must zfs destroy -r $recvpool
 
-       if datasetexists $recvfs; then
-               log_must zfs destroy -r $recvfs
-       fi
-       if datasetexists $sendfs; then
-               log_must zfs destroy -r $sendfs
-       fi
-       if $(zfs create -o compress=lz4 $sendfs); then
+       if $(datasetexists $sendfs || zfs create -o compress=lz4 $sendfs); then
                mk_files 1000 256 0 $sendfs &
                mk_files 1000 131072 0 $sendfs &
                mk_files 100 1048576 0 $sendfs &
index e9f6df3d3be8d24bcd39cc6758d71d13a1aa127a..5858bd2f2d87e99f2c38b760fa4668f3838e39b2 100755 (executable)
 # 4. ZFS send to the stream state file again using the receive_resume_token
 # 5. ZFS receive and verify the receive completes successfully
 # 6. Repeat steps on an incremental ZFS send
+# 7. Repeat the entire procedure for a dataset at the pool root
 #
 
 verify_runnable "both"
 
 log_assert "Verify resumability of a full and incremental ZFS send/receive " \
     "in the presence of a corrupted stream"
-log_onexit cleanup_pool $POOL2
+log_onexit cleanup_pools $POOL2 $POOL3
 
-sendfs=$POOL/sendfs
-recvfs=$POOL2/recvfs
-streamfs=$POOL/stream
+recvfs=$POOL3/recvfs
+streamfs=$POOL2/stream
 
-test_fs_setup $POOL $POOL2
-resume_test "zfs send -v $sendfs@a" $streamfs $recvfs
-resume_test "zfs send -v -i @a $sendfs@b" $streamfs $recvfs
-file_check $sendfs $recvfs
+for sendfs in $POOL2/sendfs $POOL2; do
+       test_fs_setup $sendfs $recvfs
+       resume_test "zfs send -v $sendfs@a" $streamfs $recvfs
+       resume_test "zfs send -v -i @a $sendfs@b" $streamfs $recvfs
+       file_check $sendfs $recvfs
+done
 
 log_pass "Verify resumability of a full and incremental ZFS send/receive " \
     "in the presence of a corrupted stream"
index 46050720cf5c99e6a33cb5d2b86c384134bd69ae..25e125b4f911879bfbadc0c9f545bac6a80ffc5c 100755 (executable)
@@ -41,7 +41,7 @@ sendfs=$POOL/sendfs
 recvfs=$POOL2/recvfs
 streamfs=$POOL/stream
 
-test_fs_setup $POOL $POOL2
+test_fs_setup $sendfs $recvfs
 resume_test "zfs send -D -v $sendfs@a" $streamfs $recvfs
 file_check $sendfs $recvfs
 
index 8f3a47a5fe7db1fbeb97c6bb3e858f40080722c9..30af5ba43d6ee7ef5c71c217f3eacde595044d09 100755 (executable)
@@ -43,7 +43,7 @@ sendfs=$POOL/sendfs
 recvfs=$POOL2/recvfs
 streamfs=$POOL/stream
 
-test_fs_setup $POOL $POOL2
+test_fs_setup $sendfs $recvfs
 resume_test "zfs send -v -e $sendfs@a" $streamfs $recvfs
 resume_test "zfs send -v -e -i @a $sendfs@b" $streamfs $recvfs
 file_check $sendfs $recvfs
index 7670b8eb4abe5f77af0fb49d3429b943680deee6..278f1535fd2f4d8f9e4435d3ebd544c44b8852d7 100755 (executable)
@@ -51,7 +51,7 @@ sendfs=$POOL/sendfs
 recvfs=$POOL2/recvfs
 streamfs=$POOL/stream
 
-test_fs_setup $POOL $POOL2
+test_fs_setup $sendfs $recvfs
 log_must zfs bookmark $sendfs@a $sendfs#bm_a
 log_must zfs destroy $sendfs@a
 log_must zfs receive -v $recvfs </$POOL/initial.zsend
index 0b0a1e0d070385f3d77ad261dd27691fc056af53..f61be944289950ffdfa8934b7b2efb66bd8bb17e 100755 (executable)
@@ -48,7 +48,7 @@ sendfs=$POOL/sendfs
 recvfs=$POOL2/recvfs
 streamfs=$POOL/stream
 
-test_fs_setup $POOL $POOL2
+test_fs_setup $sendfs $recvfs
 log_must zfs unmount $sendfs
 resume_test "zfs send $sendfs" $streamfs $recvfs
 file_check $sendfs $recvfs
index f0417e85ae351264f742cdc9a5d4987b5b5fbec4..dbf4eecede88aaa9f6ecb7f9f4afd013142a3402 100755 (executable)
@@ -37,6 +37,7 @@ verify_disk_count "$DISKS" 2
 if is_global_zone ; then
        log_must zpool create $POOL $DISK1
        log_must zpool create $POOL2 $DISK2
+       log_must zpool create $POOL3 $DISK3
 fi
 log_must mkdir $BACKDIR $TESTDIR