Differential D28677 Diff 83996 sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_013_pos.ksh
Changeset View
Changeset View
Standalone View
Standalone View
sys/contrib/openzfs/tests/zfs-tests/tests/functional/cli_root/zfs_mount/zfs_mount_013_pos.ksh
Show All 26 Lines | |||||
set -A vdevs $(get_disklist_fullpath $TESTPOOL) | set -A vdevs $(get_disklist_fullpath $TESTPOOL) | ||||
typeset -r mntpoint=$(get_prop mountpoint $TESTPOOL) | typeset -r mntpoint=$(get_prop mountpoint $TESTPOOL) | ||||
typeset -r helper="mount.zfs -o zfsutil" | typeset -r helper="mount.zfs -o zfsutil" | ||||
typeset -r fs=$TESTPOOL/$TESTFS | typeset -r fs=$TESTPOOL/$TESTFS | ||||
function cleanup | function cleanup | ||||
{ | { | ||||
cd $STF_SUITE | cd $STF_SUITE | ||||
[[ -d $TESTDIR/$$ ]] && (rm -rf $TESTDIR/$$ || log_fail) | if [[ -d $TESTDIR/$$ ]]; then | ||||
log_must rm -rf $TESTDIR/$$ | |||||
fi | |||||
mounted && zfs $mountcmd $TESTPOOL | mounted && zfs $mountcmd $TESTPOOL | ||||
return 0 | return 0 | ||||
} | } | ||||
log_onexit cleanup | log_onexit cleanup | ||||
log_note "Verify zfs mount helper functions for both devices and pools" | log_note "Verify zfs mount helper functions for both devices and pools" | ||||
# Ensure that the ZFS filesystem is unmounted | # Ensure that the ZFS filesystem is unmounted | ||||
force_unmount $TESTPOOL | force_unmount $TESTPOOL | ||||
log_note "Verify '<dataset> <path>'" | log_note "Verify '<dataset> <path>'" | ||||
log_must $helper $fs $mntpoint | log_must $helper $fs $mntpoint | ||||
log_must ismounted $fs | log_must ismounted $fs | ||||
force_unmount $fs | force_unmount $fs | ||||
log_note "Verify mount(8) does not canonicalize before calling helper" | log_note "Verify mount(8) does not canonicalize before calling helper" | ||||
# Canonicalization is confused by files in PWD matching [device|mountpoint] | # Canonicalization is confused by files in PWD matching [device|mountpoint] | ||||
mkdir -p $TESTDIR/$$/$TESTPOOL && cd $TESTDIR/$$ || log_fail | log_must mkdir -p $TESTDIR/$$/$TESTPOOL | ||||
log_must cd $TESTDIR/$$ | |||||
# The env flag directs zfs to exec /bin/mount, which then calls helper | # The env flag directs zfs to exec /bin/mount, which then calls helper | ||||
log_must eval ZFS_MOUNT_HELPER=1 zfs $mountcmd -v $TESTPOOL | log_must eval ZFS_MOUNT_HELPER=1 zfs $mountcmd -v $TESTPOOL | ||||
# mount (2.35.2) still suffers from a cosmetic PWD prefix bug | # mount (2.35.2) still suffers from a cosmetic PWD prefix bug | ||||
log_must mounted $TESTPOOL | log_must mounted $TESTPOOL | ||||
force_unmount $TESTPOOL | |||||
log_note "Verify CWD prefix filter <dataset> <path>" | |||||
log_must cd / | |||||
log_must zfs set mountpoint=legacy $TESTPOOL | |||||
log_must mkdir -p $mntpoint | |||||
log_must mount -t zfs $TESTPOOL $mntpoint | |||||
log_must ismounted $TESTPOOL | |||||
log_must umount $mntpoint | |||||
log_must zfs set mountpoint=$mntpoint $TESTPOOL | |||||
log_must cd - | |||||
force_unmount $TESTPOOL | force_unmount $TESTPOOL | ||||
log_note "Verify '-f <dataset> <path>' fakemount" | log_note "Verify '-f <dataset> <path>' fakemount" | ||||
log_must $helper -f $fs $mntpoint | log_must $helper -f $fs $mntpoint | ||||
log_mustnot ismounted $fs | log_mustnot ismounted $fs | ||||
log_note "Verify '-o ro -v <dataset> <path>' verbose RO" | log_note "Verify '-o ro -v <dataset> <path>' verbose RO" | ||||
log_must ${helper},ro -v $fs $mntpoint | log_must ${helper},ro -v $fs $mntpoint | ||||
log_must ismounted $fs | log_must ismounted $fs | ||||
force_unmount $fs | force_unmount $fs | ||||
log_note "Verify '-o abc -s <device> <path>' sloppy option" | log_note "Verify '-o abc -s <device> <path>' sloppy option" | ||||
log_must ${helper},abc -s ${vdevs[0]} $mntpoint | log_must ${helper},abc -s ${vdevs[0]} $mntpoint | ||||
log_must mounted $mntpoint | log_must mounted $mntpoint | ||||
force_unmount $TESTPOOL | force_unmount $TESTPOOL | ||||
log_note "Verify '<device> <path>'" | log_note "Verify '<device> <path>'" | ||||
log_must $helper ${vdevs[0]} $mntpoint | log_must $helper ${vdevs[0]} $mntpoint | ||||
log_must mounted $mntpoint | log_must mounted $mntpoint | ||||
log_pass "zfs mount helper correctly handles both device and pool strings" | log_pass "zfs mount helper correctly handles both device and pool strings" | ||||
No newline at end of file |