mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 19:19:32 +03:00
ZTS: Another round of changes for FreeBSD
Highlights: * is_linux -> is_illumos swaps * make block_device_wait more clever when paths are given * slightly optimize default_cleanup_noexit * remove platform differences in user_run * temporarily expect non-libfetch behavior for keylocation=/foo/bar * fix sharenfs exceptions * don't test multihost property * fix misc broken platform checks * clear zinjected faults in removal_resume_export callback Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: John Kennedy <john.kennedy@delphix.com> Signed-off-by: Ryan Moeller <ryan@iXsystems.com> Closes #10092
This commit is contained in:
parent
f5f6fb03b7
commit
2b95e91132
@ -74,14 +74,33 @@ function block_device_wait
|
|||||||
{
|
{
|
||||||
if is_linux; then
|
if is_linux; then
|
||||||
udevadm trigger $*
|
udevadm trigger $*
|
||||||
typeset local start=$SECONDS
|
typeset start=$SECONDS
|
||||||
udevadm settle
|
udevadm settle
|
||||||
typeset local elapsed=$((SECONDS - start))
|
typeset elapsed=$((SECONDS - start))
|
||||||
[[ $elapsed > 60 ]] && \
|
[[ $elapsed > 60 ]] && \
|
||||||
log_note udevadm settle time too long: $elapsed
|
log_note udevadm settle time too long: $elapsed
|
||||||
elif is_freebsd; then
|
elif is_freebsd; then
|
||||||
sleep 3
|
if [[ ${#@} -eq 0 ]]; then
|
||||||
|
sleep 3
|
||||||
|
return
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
|
# Poll for the given paths to appear, but give up eventually.
|
||||||
|
typeset -i i
|
||||||
|
for (( i = 0; i < 5; ++i )); do
|
||||||
|
typeset missing=false
|
||||||
|
typeset dev
|
||||||
|
for dev in "${@}"; do
|
||||||
|
if ! [[ -f $dev ]]; then
|
||||||
|
missing=true
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
if ! $missing; then
|
||||||
|
break
|
||||||
|
fi
|
||||||
|
sleep ${#@}
|
||||||
|
done
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -612,8 +612,8 @@ function default_cleanup_noexit
|
|||||||
then
|
then
|
||||||
destroy_pool $pool
|
destroy_pool $pool
|
||||||
fi
|
fi
|
||||||
ALL_POOLS=$(get_all_pools)
|
|
||||||
done
|
done
|
||||||
|
ALL_POOLS=$(get_all_pools)
|
||||||
done
|
done
|
||||||
|
|
||||||
zfs mount -a
|
zfs mount -a
|
||||||
@ -3315,13 +3315,7 @@ function user_run
|
|||||||
shift
|
shift
|
||||||
|
|
||||||
log_note "user:$user $@"
|
log_note "user:$user $@"
|
||||||
if is_freebsd; then
|
eval su - \$user -c \"$@\" > $TEST_BASE_DIR/out 2>$TEST_BASE_DIR/err
|
||||||
eval "su \$user -c \"$@\"" > $TEST_BASE_DIR/out 2>$TEST_BASE_DIR/err
|
|
||||||
return $?
|
|
||||||
else
|
|
||||||
eval su - \$user -c \"$@\" > $TEST_BASE_DIR/out 2>$TEST_BASE_DIR/err
|
|
||||||
return $?
|
|
||||||
fi
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -64,9 +64,10 @@ log_must zfs create -o encryption=on -o keyformat=passphrase \
|
|||||||
-o keylocation=file:///$TESTPOOL/pkey $TESTPOOL/$TESTFS1
|
-o keylocation=file:///$TESTPOOL/pkey $TESTPOOL/$TESTFS1
|
||||||
|
|
||||||
log_mustnot zfs set keylocation=none $TESTPOOL/$TESTFS1
|
log_mustnot zfs set keylocation=none $TESTPOOL/$TESTFS1
|
||||||
if is_linux; then
|
if true; then
|
||||||
log_mustnot zfs set keylocation=/$TESTPOOL/pkey $TESTPOOL/$TESTFS1
|
log_mustnot zfs set keylocation=/$TESTPOOL/pkey $TESTPOOL/$TESTFS1
|
||||||
else
|
else
|
||||||
|
### SOON: ###
|
||||||
# file:///$TESTPOOL/pkey and /$TESTPOOL/pkey are equivalent on FreeBSD
|
# file:///$TESTPOOL/pkey and /$TESTPOOL/pkey are equivalent on FreeBSD
|
||||||
# thanks to libfetch. Eventually we want to make the other platforms
|
# thanks to libfetch. Eventually we want to make the other platforms
|
||||||
# work this way as well, either by porting libfetch or by other means.
|
# work this way as well, either by porting libfetch or by other means.
|
||||||
|
@ -84,7 +84,7 @@ while (( $i < ${#args[*]} )); do
|
|||||||
typeset arg=${args[i]}
|
typeset arg=${args[i]}
|
||||||
if is_freebsd; then
|
if is_freebsd; then
|
||||||
# FreeBSD does not strictly validate share opts (yet).
|
# FreeBSD does not strictly validate share opts (yet).
|
||||||
if [[ $arg == "-o sharenfs="* ]]; then
|
if [[ $arg == "sharenfs="* ]]; then
|
||||||
((i = i + 1))
|
((i = i + 1))
|
||||||
continue
|
continue
|
||||||
fi
|
fi
|
||||||
|
@ -138,7 +138,7 @@ for option in "" "-Df"; do
|
|||||||
if ((nfs_share_bit == 1)); then
|
if ((nfs_share_bit == 1)); then
|
||||||
log_note "Set sharenfs=on $pool"
|
log_note "Set sharenfs=on $pool"
|
||||||
log_must zfs set sharenfs=on $pool
|
log_must zfs set sharenfs=on $pool
|
||||||
log_must is_shared $pool
|
! is_freebsd && log_must is_shared $pool
|
||||||
f_share="true"
|
f_share="true"
|
||||||
nfs_flag="sharenfs=on"
|
nfs_flag="sharenfs=on"
|
||||||
fi
|
fi
|
||||||
@ -181,19 +181,21 @@ for option in "" "-Df"; do
|
|||||||
for fs in $mount_fs; do
|
for fs in $mount_fs; do
|
||||||
log_must ismounted $pool/$fs
|
log_must ismounted $pool/$fs
|
||||||
[[ -n $f_share ]] && \
|
[[ -n $f_share ]] && \
|
||||||
|
! is_freebsd && \
|
||||||
log_must is_shared $pool/$fs
|
log_must is_shared $pool/$fs
|
||||||
done
|
done
|
||||||
|
|
||||||
for fs in $nomount_fs; do
|
for fs in $nomount_fs; do
|
||||||
log_mustnot ismounted $pool/$fs
|
log_mustnot ismounted $pool/$fs
|
||||||
log_mustnot is_shared $pool/$fs
|
! is_freebsd && \
|
||||||
|
log_mustnot is_shared $pool/$fs
|
||||||
done
|
done
|
||||||
((guid_bit = guid_bit + 1))
|
((guid_bit = guid_bit + 1))
|
||||||
done
|
done
|
||||||
# reset nfsshare=off
|
# reset nfsshare=off
|
||||||
if [[ -n $f_share ]]; then
|
if [[ -n $f_share ]]; then
|
||||||
log_must zfs set sharenfs=off $pool
|
log_must zfs set sharenfs=off $pool
|
||||||
log_mustnot is_shared $pool
|
! is_freebsd && log_mustnot is_shared $pool
|
||||||
fi
|
fi
|
||||||
((nfs_share_bit = nfs_share_bit + 1))
|
((nfs_share_bit = nfs_share_bit + 1))
|
||||||
done
|
done
|
||||||
|
@ -35,7 +35,7 @@ function cleanup
|
|||||||
destroy_pool $TESTPOOL
|
destroy_pool $TESTPOOL
|
||||||
destroy_pool $TESTPOOL2
|
destroy_pool $TESTPOOL2
|
||||||
rm -f $DEVICE1 $DEVICE2
|
rm -f $DEVICE1 $DEVICE2
|
||||||
log_must mmp_clear_hostid
|
! is_freebsd && log_must mmp_clear_hostid
|
||||||
}
|
}
|
||||||
|
|
||||||
function setup_mirror
|
function setup_mirror
|
||||||
@ -48,9 +48,8 @@ function setup_mirror
|
|||||||
log_assert "'zpool split' can set new property values on the new pool"
|
log_assert "'zpool split' can set new property values on the new pool"
|
||||||
log_onexit cleanup
|
log_onexit cleanup
|
||||||
|
|
||||||
if [ -e $HOSTID_FILE ]; then
|
DEVICE1="$TEST_BASE_DIR/device-1"
|
||||||
log_unsupported "System has existing $HOSTID_FILE file"
|
DEVICE2="$TEST_BASE_DIR/device-2"
|
||||||
fi
|
|
||||||
|
|
||||||
typeset good_props=('comment=text' 'ashift=12' 'multihost=on'
|
typeset good_props=('comment=text' 'ashift=12' 'multihost=on'
|
||||||
'listsnapshots=on' 'autoexpand=on' 'autoreplace=on'
|
'listsnapshots=on' 'autoexpand=on' 'autoreplace=on'
|
||||||
@ -59,12 +58,15 @@ typeset bad_props=("bootfs=$TESTPOOL2/bootfs" 'version=28' 'ashift=4'
|
|||||||
'allocated=1234' 'capacity=5678' 'multihost=none'
|
'allocated=1234' 'capacity=5678' 'multihost=none'
|
||||||
'feature@async_destroy=disabled' 'feature@xxx_fake_xxx=enabled'
|
'feature@async_destroy=disabled' 'feature@xxx_fake_xxx=enabled'
|
||||||
'propname=propval' 'readonly=on')
|
'propname=propval' 'readonly=on')
|
||||||
|
if ! is_freebsd; then
|
||||||
DEVICE1="$TEST_BASE_DIR/device-1"
|
good_props+=('multihost=on')
|
||||||
DEVICE2="$TEST_BASE_DIR/device-2"
|
bad_props+=('multihost=none')
|
||||||
|
if [ -e $HOSTID_FILE ]; then
|
||||||
# Needed to set multihost=on
|
log_unsupported "System has existing $HOSTID_FILE file"
|
||||||
log_must mmp_set_hostid $HOSTID1
|
fi
|
||||||
|
# Needed to set multihost=on
|
||||||
|
log_must mmp_set_hostid $HOSTID1
|
||||||
|
fi
|
||||||
|
|
||||||
# Verify we can set a combination of valid property values on the new pool
|
# Verify we can set a combination of valid property values on the new pool
|
||||||
for prop in "${good_props[@]}"
|
for prop in "${good_props[@]}"
|
||||||
|
@ -51,7 +51,7 @@ log_must ulimit -f 1024
|
|||||||
log_mustnot sh -c 'dd if=/dev/zero of=$TESTDIR/ulimit_write_file bs=1M count=2'
|
log_mustnot sh -c 'dd if=/dev/zero of=$TESTDIR/ulimit_write_file bs=1M count=2'
|
||||||
log_must rm $TESTDIR/ulimit_write_file
|
log_must rm $TESTDIR/ulimit_write_file
|
||||||
# FreeBSD allows the sparse file because space has not been allocated.
|
# FreeBSD allows the sparse file because space has not been allocated.
|
||||||
if !is_freebsd; then
|
if ! is_freebsd; then
|
||||||
log_mustnot sh -c 'truncate -s2M $TESTDIR/ulimit_trunc_file'
|
log_mustnot sh -c 'truncate -s2M $TESTDIR/ulimit_trunc_file'
|
||||||
log_must rm $TESTDIR/ulimit_trunc_file
|
log_must rm $TESTDIR/ulimit_trunc_file
|
||||||
fi
|
fi
|
||||||
|
@ -63,11 +63,11 @@ function setup_embedded
|
|||||||
typeset recsize
|
typeset recsize
|
||||||
typeset mntpnt=$(get_prop mountpoint $sendfs)
|
typeset mntpnt=$(get_prop mountpoint $sendfs)
|
||||||
for recsize in 512 1024 2048 4096 8192 16384; do
|
for recsize in 512 1024 2048 4096 8192 16384; do
|
||||||
if is_linux; then
|
if is_illumos; then
|
||||||
|
log_must mkholes -d $((recsize - 8)):8 $mntpnt/$recsize
|
||||||
|
else
|
||||||
log_must dd if=/dev/urandom of=$mntpnt/$recsize bs=8 \
|
log_must dd if=/dev/urandom of=$mntpnt/$recsize bs=8 \
|
||||||
count=1 seek=$(((recsize / 8) - 1))
|
count=1 seek=$(((recsize / 8) - 1))
|
||||||
else
|
|
||||||
log_must mkholes -d $((recsize - 8)):8 $mntpnt/$recsize
|
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
}
|
}
|
||||||
@ -79,7 +79,12 @@ function setup_holes
|
|||||||
typeset mntpnt=$(get_prop mountpoint $sendfs)
|
typeset mntpnt=$(get_prop mountpoint $sendfs)
|
||||||
typeset M=$((1024 * 1024))
|
typeset M=$((1024 * 1024))
|
||||||
|
|
||||||
if is_linux; then
|
if is_illumos; then
|
||||||
|
log_must mkholes -d 0:$((8 * M)) $mntpnt/f1
|
||||||
|
log_must mkholes -d 0:$M -d $((7 * M)):$M $mntpnt/f2
|
||||||
|
log_must mkholes -d $M:$((6 * M)) -h $((7 * M)):$M $mntpnt/f3
|
||||||
|
log_must mkholes -h 0:$((8 * M)) $mntpnt/f4
|
||||||
|
else
|
||||||
log_must dd if=/dev/urandom of=$mntpnt/f1 bs=8M count=1
|
log_must dd if=/dev/urandom of=$mntpnt/f1 bs=8M count=1
|
||||||
|
|
||||||
log_must dd if=/dev/urandom of=$mntpnt/f2 bs=1M count=1
|
log_must dd if=/dev/urandom of=$mntpnt/f2 bs=1M count=1
|
||||||
@ -87,14 +92,9 @@ function setup_holes
|
|||||||
conv=notrunc
|
conv=notrunc
|
||||||
|
|
||||||
log_must dd if=/dev/urandom of=$mntpnt/f3 bs=1M count=6 seek=1
|
log_must dd if=/dev/urandom of=$mntpnt/f3 bs=1M count=6 seek=1
|
||||||
log_must truncate $mntpnt/f3 --size=$((8 * M))
|
log_must truncate -s $((8 * M)) $mntpnt/f3
|
||||||
|
|
||||||
log_must truncate $mntpnt/f4 --size=$((8 * M))
|
log_must truncate -s $((8 * M)) $mntpnt/f4
|
||||||
else
|
|
||||||
log_must mkholes -d 0:$((8 * M)) $mntpnt/f1
|
|
||||||
log_must mkholes -d 0:$M -d $((7 * M)):$M $mntpnt/f2
|
|
||||||
log_must mkholes -d $M:$((6 * M)) -h $((7 * M)):$M $mntpnt/f3
|
|
||||||
log_must mkholes -h 0:$((8 * M)) $mntpnt/f4
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
log_must zfs create $sendfs/manyrm
|
log_must zfs create $sendfs/manyrm
|
||||||
@ -237,15 +237,11 @@ function redacted_cleanup
|
|||||||
typeset ds_list=$@
|
typeset ds_list=$@
|
||||||
typeset ds
|
typeset ds
|
||||||
|
|
||||||
# Verify the receiving pool can still be exported and imported.
|
|
||||||
log_must zpool export $POOL2
|
|
||||||
log_must zpool import $POOL2
|
|
||||||
|
|
||||||
for ds in $ds_list; do
|
for ds in $ds_list; do
|
||||||
datasetexists $ds && log_must zfs destroy -R $ds
|
zfs destroy -R $ds
|
||||||
done
|
done
|
||||||
|
|
||||||
log_must set_tunable32 ALLOW_REDACTED_DATASET_MOUNT 0
|
set_tunable32 ALLOW_REDACTED_DATASET_MOUNT 0
|
||||||
rm -f $(get_prop mountpoint $POOL)/tmp/*
|
rm -f $(get_prop mountpoint $POOL)/tmp/*
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -46,11 +46,11 @@ typeset M=$((1024 * 1024))
|
|||||||
log_onexit redacted_cleanup $sendfs $recvfs
|
log_onexit redacted_cleanup $sendfs $recvfs
|
||||||
|
|
||||||
# Write holes at the start and end of a non-sparse file.
|
# Write holes at the start and end of a non-sparse file.
|
||||||
if is_linux; then
|
if is_illumos; then
|
||||||
|
log_must mkholes -h 0:$M -h $((7 * M)):$M $clone_mnt/f1
|
||||||
|
else
|
||||||
log_must dd if=/dev/zero of=$clone_mnt/f1 bs=1M count=1 conv=notrunc
|
log_must dd if=/dev/zero of=$clone_mnt/f1 bs=1M count=1 conv=notrunc
|
||||||
log_must dd if=/dev/zero of=$clone_mnt/f1 bs=1M count=1 conv=notrunc seek=7
|
log_must dd if=/dev/zero of=$clone_mnt/f1 bs=1M count=1 conv=notrunc seek=7
|
||||||
else
|
|
||||||
log_must mkholes -h 0:$M -h $((7 * M)):$M $clone_mnt/f1
|
|
||||||
fi
|
fi
|
||||||
log_must zfs snapshot $clone@snap1
|
log_must zfs snapshot $clone@snap1
|
||||||
log_must zfs redact $sendfs@snap book1 $clone@snap1
|
log_must zfs redact $sendfs@snap book1 $clone@snap1
|
||||||
@ -72,11 +72,11 @@ log_must zfs rollback -R $clone@snap
|
|||||||
log_must zfs destroy -R $recvfs
|
log_must zfs destroy -R $recvfs
|
||||||
|
|
||||||
# Write data into the middle of a hole.
|
# Write data into the middle of a hole.
|
||||||
if is_linux; then
|
if is_illumos; then
|
||||||
|
log_must mkholes -d $((3 * M)):$((2 * M)) $clone_mnt/f2
|
||||||
|
else
|
||||||
log_must dd if=/dev/urandom of=$clone_mnt/f2 bs=1M count=2 seek=3 \
|
log_must dd if=/dev/urandom of=$clone_mnt/f2 bs=1M count=2 seek=3 \
|
||||||
conv=notrunc
|
conv=notrunc
|
||||||
else
|
|
||||||
log_must mkholes -d $((3 * M)):$((2 * M)) $clone_mnt/f2
|
|
||||||
fi
|
fi
|
||||||
log_must zfs snapshot $clone@snap1
|
log_must zfs snapshot $clone@snap1
|
||||||
log_must zfs redact $sendfs@snap book3 $clone@snap1
|
log_must zfs redact $sendfs@snap book3 $clone@snap1
|
||||||
|
@ -43,13 +43,28 @@
|
|||||||
|
|
||||||
function cleanup
|
function cleanup
|
||||||
{
|
{
|
||||||
log_must zinject -c all
|
zinject -c all
|
||||||
default_cleanup_noexit
|
default_cleanup_noexit
|
||||||
}
|
}
|
||||||
|
|
||||||
function callback
|
function callback
|
||||||
{
|
{
|
||||||
|
#
|
||||||
|
# Inject an error so export fails after having just suspended
|
||||||
|
# the removal thread. [spa_inject_ref gets incremented]
|
||||||
|
#
|
||||||
|
log_must zinject -d $REMOVEDISK -D 10:1 $TESTPOOL
|
||||||
|
|
||||||
|
#
|
||||||
|
# Because of the above error export should fail.
|
||||||
|
#
|
||||||
log_mustnot zpool export $TESTPOOL
|
log_mustnot zpool export $TESTPOOL
|
||||||
|
|
||||||
|
#
|
||||||
|
# Let the removal finish.
|
||||||
|
#
|
||||||
|
log_must zinject -c all
|
||||||
|
|
||||||
return 0
|
return 0
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -78,13 +93,7 @@ log_must dd if=/dev/urandom of=$TESTDIR/$TESTFILE0 bs=64M count=32
|
|||||||
log_must zpool add -f $TESTPOOL $NOTREMOVEDISK
|
log_must zpool add -f $TESTPOOL $NOTREMOVEDISK
|
||||||
|
|
||||||
#
|
#
|
||||||
# Inject an error so export fails after having just suspended
|
# Attempt the export with errors injected.
|
||||||
# the removal thread. [spa_inject_ref gets incremented]
|
|
||||||
#
|
|
||||||
log_must zinject -d $REMOVEDISK -D 10:1 $TESTPOOL
|
|
||||||
|
|
||||||
#
|
|
||||||
# Because of the above error export should fail.
|
|
||||||
#
|
#
|
||||||
log_must attempt_during_removal $TESTPOOL $REMOVEDISK callback
|
log_must attempt_during_removal $TESTPOOL $REMOVEDISK callback
|
||||||
|
|
||||||
|
@ -81,7 +81,7 @@ log_must truncate -s 1G /$sendfs/file1
|
|||||||
log_must dd if=/dev/urandom of=/$sendfs/file1 bs=4k count=11264 seek=1152
|
log_must dd if=/dev/urandom of=/$sendfs/file1 bs=4k count=11264 seek=1152
|
||||||
log_must zfs snapshot $sendfs@snap1
|
log_must zfs snapshot $sendfs@snap1
|
||||||
|
|
||||||
log_must truncate -s 4194304 /$sendfs/file1
|
log_must truncate -s 4M /$sendfs/file1
|
||||||
log_must dd if=/dev/urandom of=/$sendfs/file1 bs=4k count=152 seek=384 \
|
log_must dd if=/dev/urandom of=/$sendfs/file1 bs=4k count=152 seek=384 \
|
||||||
conv=notrunc
|
conv=notrunc
|
||||||
log_must dd if=/dev/urandom of=/$sendfs/file1 bs=4k count=10 seek=1408 \
|
log_must dd if=/dev/urandom of=/$sendfs/file1 bs=4k count=10 seek=1408 \
|
||||||
|
Loading…
Reference in New Issue
Block a user