OpenZFS 7535 - need test for resumed send of top most filesystem

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
This commit is contained in:
Brian Behlendorf 2017-04-12 08:47:42 -07:00 committed by GitHub
parent 17b43f96f9
commit dd49132a1d
15 changed files with 107 additions and 87 deletions

View 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']

View 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"

View File

@ -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"

View File

@ -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
{

View File

@ -50,12 +50,17 @@ function cleanup
log_must unshare_fs $TESTPOOL/$TESTFS
}
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."

View File

@ -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"

View File

@ -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

View 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

View 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 &

View File

@ -30,22 +30,24 @@
# 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
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"

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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

View File

@ -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