ZTS: Misc fixes for FreeBSD

* Force UFS sync before snap in vol rollback tests
* rw is not a valid share option on FreeBSD, use ro instead
* zfs_unmount_nested: mountpoint is in the pool, rmdir *before* export
* Fix some more platform checks
* Fix disappearing group in delegate tests
* Don't try delegating for jailed, only root can set it

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #10038
This commit is contained in:
Ryan Moeller 2020-02-24 13:17:55 -05:00 committed by GitHub
parent 31a69fbccb
commit 92bd4cabd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 46 additions and 14 deletions

View File

@ -83,8 +83,7 @@ function setup_snap_env
# Make sure the ufs|ext filesystem hasn't been mounted,
# then mount the new ufs|ext filesystem.
if ! ismounted $TESTDIR1 $NEWFS_DEFAULT_FS; then
log_must mount \
$ZVOL_DEVDIR/$TESTPOOL/$TESTVOL $TESTDIR1
log_must mount $ZVOL_DEVDIR/$VOL $TESTDIR1
fi
fi
@ -127,7 +126,21 @@ function setup_snap_env
log_must lockfs -f $TESTDIR1
fi
fi
if is_freebsd && [[ $dtst == $VOL ]]; then
# Though sync does start a fs sync on
# FreeBSD, it does not wait for it to
# finish. We can force a blocking sync
# by updating the fs mount instead.
# Otherwise, the snapshot might occur
# with the fs in an unmountable state.
log_must mount -ur \
$ZVOL_DEVDIR/$VOL $TESTDIR1
fi
log_must zfs snapshot $snap
if is_freebsd && [[ $dtst == $VOL ]]; then
log_must mount -uw \
$ZVOL_DEVDIR/$VOL $TESTDIR1
fi
fi
if [[ $createclone == "true" ]]; then
if datasetnonexists $clone; then

View File

@ -44,7 +44,7 @@
verify_runnable "global"
# properties
set -A sharenfs_prop "off" "on" "rw"
set -A sharenfs_prop "off" "on" "ro"
set -A sharesmb_prop "off" "on"
function cleanup

View File

@ -45,20 +45,24 @@ function nesting_cleanup
log_onexit nesting_cleanup
set -A test_depths 30 16 3
typeset mountpoint=/$TESTPOOL/mnt
dsA32=$(printf 'a/%.0s' {1..32})"a"
log_must zfs create -p $TESTPOOL/$dsA32
dsB32=$(printf 'b/%.0s' {1..32})"b"
log_must zfs create -o mountpoint=none -p $TESTPOOL/$dsB32
# FreeBSD's mount command ignores the mountpoint property.
if ! is_freebsd; then
log_mustnot mount -t zfs $TESTPOOL/$dsB32 /mnt
fi
dsC32=$(printf 'c/%.0s' {1..32})"c"
log_must zfs create -o mountpoint=legacy -p $TESTPOOL/$dsC32
log_must mount -t zfs $TESTPOOL/$dsC32 /mnt
dsD32=$(printf 'd/%.0s' {1..32})"d"
log_must zfs create -o mountpoint=/$TESTPOOL/mnt -p $TESTPOOL/$dsD32
log_must zfs create -o mountpoint=$mountpoint -p $TESTPOOL/$dsD32
for d in ${test_depths[@]}; do
@ -152,7 +156,7 @@ for d in ${test_depths[@]}; do
fi
# mountpoint=testpool/mnt
# mountpoint=/testpool/mnt
ds_pre=$(printf 'd/%.0s' {1..$(($d-2))})"d"
ds=$(printf 'd/%.0s' {1..$(($d-1))})"d"
ds_post=$(printf 'd/%.0s' {1..$(($d))})"d"
@ -182,8 +186,8 @@ for d in ${test_depths[@]}; do
fi
done
log_must rmdir $mountpoint # remove the mountpoint we created
log_must zpool export $TESTPOOL
log_must rmdir /testpool/mnt # remove the mountpoint we created
log_must zpool import $TESTPOOL
log_pass "Verified nested dataset are unmounted."

View File

@ -33,7 +33,7 @@
. $STF_SUITE/include/libtest.shlib
. $STF_SUITE/tests/functional/delegate/delegate_common.kshlib
if ! is_linux; then
if is_illumos; then
# check svc:/network/nis/client:default state
# disable it if the state is ON
# and the state will be restored during cleanup.ksh

View File

@ -50,6 +50,14 @@ function cleanup
{
if id $STAFF_GROUP > /dev/null 2>&1; then
log_must del_user $STAFF_GROUP
if is_freebsd; then
# pw userdel also deletes the group with the same name
# and has no way to opt out of this behavior (yet).
# Recreate the group as a workaround.
log_must add_group $STAFF_GROUP
log_must add_user $STAFF_GROUP $STAFF1
log_must add_user $STAFF_GROUP $STAFF2
fi
fi
restore_root_datasets
@ -71,6 +79,14 @@ done
log_must restore_root_datasets
log_must del_user $STAFF_GROUP
if is_freebsd; then
# pw userdel also deletes the group with the same name
# and has no way to opt out of this behavior (yet).
# Recreate the group as a workaround.
log_must add_group $STAFF_GROUP
log_must add_user $STAFF_GROUP $STAFF1
log_must add_user $STAFF_GROUP $STAFF2
fi
for dtst in $datasets ; do
log_must zfs allow $STAFF_GROUP $perms $dtst
log_must verify_perm $dtst $perms $STAFF1 $STAFF2

View File

@ -93,7 +93,7 @@ elif is_freebsd; then
# Permission Filesystem Volume
#
# Removed for FreeBSD
# - zoned - spelled "jailed"
# - jailed - jailing requires superuser privileges
# - sharenfs - sharing requires superuser privileges
# - share - sharing requires superuser privileges
# - xattr - Not supported on FreeBSD
@ -125,7 +125,6 @@ set -A perms create true false \
clone true true \
rename true true \
promote true true \
jailed true false \
receive true false \
destroy true true

View File

@ -32,9 +32,7 @@
# if we're running NIS, turn it off until we clean up
# (it can cause useradd to take a long time, hitting our TIMEOUT)
if is_linux; then
USED_NIS=false
else
if is_illumos; then
USES_NIS=false
svcs svc:/network/nis/client:default | grep online > /dev/null
if [ $? -eq 0 ]
@ -42,6 +40,8 @@ else
svcadm disable -t svc:/network/nis/client:default
USES_NIS=true
fi
else
USES_NIS=false
fi
# Make sure we use a brand new user for this