mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 19:19:32 +03:00
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:
parent
31a69fbccb
commit
92bd4cabd6
@ -83,8 +83,7 @@ function setup_snap_env
|
|||||||
# Make sure the ufs|ext filesystem hasn't been mounted,
|
# Make sure the ufs|ext filesystem hasn't been mounted,
|
||||||
# then mount the new ufs|ext filesystem.
|
# then mount the new ufs|ext filesystem.
|
||||||
if ! ismounted $TESTDIR1 $NEWFS_DEFAULT_FS; then
|
if ! ismounted $TESTDIR1 $NEWFS_DEFAULT_FS; then
|
||||||
log_must mount \
|
log_must mount $ZVOL_DEVDIR/$VOL $TESTDIR1
|
||||||
$ZVOL_DEVDIR/$TESTPOOL/$TESTVOL $TESTDIR1
|
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -127,7 +126,21 @@ function setup_snap_env
|
|||||||
log_must lockfs -f $TESTDIR1
|
log_must lockfs -f $TESTDIR1
|
||||||
fi
|
fi
|
||||||
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
|
log_must zfs snapshot $snap
|
||||||
|
if is_freebsd && [[ $dtst == $VOL ]]; then
|
||||||
|
log_must mount -uw \
|
||||||
|
$ZVOL_DEVDIR/$VOL $TESTDIR1
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [[ $createclone == "true" ]]; then
|
if [[ $createclone == "true" ]]; then
|
||||||
if datasetnonexists $clone; then
|
if datasetnonexists $clone; then
|
||||||
|
@ -44,7 +44,7 @@
|
|||||||
verify_runnable "global"
|
verify_runnable "global"
|
||||||
|
|
||||||
# properties
|
# properties
|
||||||
set -A sharenfs_prop "off" "on" "rw"
|
set -A sharenfs_prop "off" "on" "ro"
|
||||||
set -A sharesmb_prop "off" "on"
|
set -A sharesmb_prop "off" "on"
|
||||||
|
|
||||||
function cleanup
|
function cleanup
|
||||||
|
@ -45,20 +45,24 @@ function nesting_cleanup
|
|||||||
log_onexit nesting_cleanup
|
log_onexit nesting_cleanup
|
||||||
|
|
||||||
set -A test_depths 30 16 3
|
set -A test_depths 30 16 3
|
||||||
|
typeset mountpoint=/$TESTPOOL/mnt
|
||||||
|
|
||||||
dsA32=$(printf 'a/%.0s' {1..32})"a"
|
dsA32=$(printf 'a/%.0s' {1..32})"a"
|
||||||
log_must zfs create -p $TESTPOOL/$dsA32
|
log_must zfs create -p $TESTPOOL/$dsA32
|
||||||
|
|
||||||
dsB32=$(printf 'b/%.0s' {1..32})"b"
|
dsB32=$(printf 'b/%.0s' {1..32})"b"
|
||||||
log_must zfs create -o mountpoint=none -p $TESTPOOL/$dsB32
|
log_must zfs create -o mountpoint=none -p $TESTPOOL/$dsB32
|
||||||
log_mustnot mount -t zfs $TESTPOOL/$dsB32 /mnt
|
# 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"
|
dsC32=$(printf 'c/%.0s' {1..32})"c"
|
||||||
log_must zfs create -o mountpoint=legacy -p $TESTPOOL/$dsC32
|
log_must zfs create -o mountpoint=legacy -p $TESTPOOL/$dsC32
|
||||||
log_must mount -t zfs $TESTPOOL/$dsC32 /mnt
|
log_must mount -t zfs $TESTPOOL/$dsC32 /mnt
|
||||||
|
|
||||||
dsD32=$(printf 'd/%.0s' {1..32})"d"
|
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
|
for d in ${test_depths[@]}; do
|
||||||
@ -152,7 +156,7 @@ for d in ${test_depths[@]}; do
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
|
|
||||||
# mountpoint=testpool/mnt
|
# mountpoint=/testpool/mnt
|
||||||
ds_pre=$(printf 'd/%.0s' {1..$(($d-2))})"d"
|
ds_pre=$(printf 'd/%.0s' {1..$(($d-2))})"d"
|
||||||
ds=$(printf 'd/%.0s' {1..$(($d-1))})"d"
|
ds=$(printf 'd/%.0s' {1..$(($d-1))})"d"
|
||||||
ds_post=$(printf 'd/%.0s' {1..$(($d))})"d"
|
ds_post=$(printf 'd/%.0s' {1..$(($d))})"d"
|
||||||
@ -182,8 +186,8 @@ for d in ${test_depths[@]}; do
|
|||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
log_must rmdir $mountpoint # remove the mountpoint we created
|
||||||
log_must zpool export $TESTPOOL
|
log_must zpool export $TESTPOOL
|
||||||
log_must rmdir /testpool/mnt # remove the mountpoint we created
|
|
||||||
log_must zpool import $TESTPOOL
|
log_must zpool import $TESTPOOL
|
||||||
|
|
||||||
log_pass "Verified nested dataset are unmounted."
|
log_pass "Verified nested dataset are unmounted."
|
||||||
|
@ -101,7 +101,7 @@ function verify_perm
|
|||||||
|
|
||||||
log_note "Check $type $user $perm $dtst"
|
log_note "Check $type $user $perm $dtst"
|
||||||
if ((ret != 0)) ; then
|
if ((ret != 0)) ; then
|
||||||
log_note "Fail: $user should have $perm " \
|
log_note "Fail: $user should have $perm" \
|
||||||
"on $dtst"
|
"on $dtst"
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
@ -33,7 +33,7 @@
|
|||||||
. $STF_SUITE/include/libtest.shlib
|
. $STF_SUITE/include/libtest.shlib
|
||||||
. $STF_SUITE/tests/functional/delegate/delegate_common.kshlib
|
. $STF_SUITE/tests/functional/delegate/delegate_common.kshlib
|
||||||
|
|
||||||
if ! is_linux; then
|
if is_illumos; then
|
||||||
# check svc:/network/nis/client:default state
|
# check svc:/network/nis/client:default state
|
||||||
# disable it if the state is ON
|
# disable it if the state is ON
|
||||||
# and the state will be restored during cleanup.ksh
|
# and the state will be restored during cleanup.ksh
|
||||||
|
@ -50,6 +50,14 @@ function cleanup
|
|||||||
{
|
{
|
||||||
if id $STAFF_GROUP > /dev/null 2>&1; then
|
if id $STAFF_GROUP > /dev/null 2>&1; then
|
||||||
log_must del_user $STAFF_GROUP
|
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
|
fi
|
||||||
|
|
||||||
restore_root_datasets
|
restore_root_datasets
|
||||||
@ -71,6 +79,14 @@ done
|
|||||||
log_must restore_root_datasets
|
log_must restore_root_datasets
|
||||||
|
|
||||||
log_must del_user $STAFF_GROUP
|
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
|
for dtst in $datasets ; do
|
||||||
log_must zfs allow $STAFF_GROUP $perms $dtst
|
log_must zfs allow $STAFF_GROUP $perms $dtst
|
||||||
log_must verify_perm $dtst $perms $STAFF1 $STAFF2
|
log_must verify_perm $dtst $perms $STAFF1 $STAFF2
|
||||||
|
@ -93,7 +93,7 @@ elif is_freebsd; then
|
|||||||
# Permission Filesystem Volume
|
# Permission Filesystem Volume
|
||||||
#
|
#
|
||||||
# Removed for FreeBSD
|
# Removed for FreeBSD
|
||||||
# - zoned - spelled "jailed"
|
# - jailed - jailing requires superuser privileges
|
||||||
# - sharenfs - sharing requires superuser privileges
|
# - sharenfs - sharing requires superuser privileges
|
||||||
# - share - sharing requires superuser privileges
|
# - share - sharing requires superuser privileges
|
||||||
# - xattr - Not supported on FreeBSD
|
# - xattr - Not supported on FreeBSD
|
||||||
@ -125,7 +125,6 @@ set -A perms create true false \
|
|||||||
clone true true \
|
clone true true \
|
||||||
rename true true \
|
rename true true \
|
||||||
promote true true \
|
promote true true \
|
||||||
jailed true false \
|
|
||||||
receive true false \
|
receive true false \
|
||||||
destroy true true
|
destroy true true
|
||||||
|
|
||||||
|
@ -32,9 +32,7 @@
|
|||||||
|
|
||||||
# if we're running NIS, turn it off until we clean up
|
# if we're running NIS, turn it off until we clean up
|
||||||
# (it can cause useradd to take a long time, hitting our TIMEOUT)
|
# (it can cause useradd to take a long time, hitting our TIMEOUT)
|
||||||
if is_linux; then
|
if is_illumos; then
|
||||||
USED_NIS=false
|
|
||||||
else
|
|
||||||
USES_NIS=false
|
USES_NIS=false
|
||||||
svcs svc:/network/nis/client:default | grep online > /dev/null
|
svcs svc:/network/nis/client:default | grep online > /dev/null
|
||||||
if [ $? -eq 0 ]
|
if [ $? -eq 0 ]
|
||||||
@ -42,6 +40,8 @@ else
|
|||||||
svcadm disable -t svc:/network/nis/client:default
|
svcadm disable -t svc:/network/nis/client:default
|
||||||
USES_NIS=true
|
USES_NIS=true
|
||||||
fi
|
fi
|
||||||
|
else
|
||||||
|
USES_NIS=false
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Make sure we use a brand new user for this
|
# Make sure we use a brand new user for this
|
||||||
|
Loading…
Reference in New Issue
Block a user