ZTS: Test zvol I/O in different volmodes

We found that our zvol code had some issues with volmode=dev that were
not revealed by ZTS.

Add some basic I/O operations to exercise more code paths in the
volmode test.

Reviewed-by: John Kennedy <john.kennedy@delphix.com>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Ryan Moeller <ryan@iXsystems.com>
Closes #9953
This commit is contained in:
Ryan Moeller 2020-02-10 16:10:25 -05:00 committed by GitHub
parent 31b160f0a6
commit 572b5b302a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 15 additions and 0 deletions

View File

@ -83,6 +83,17 @@ function sysctl_volmode # value
log_must set_tunable32 VOL_MODE $value log_must set_tunable32 VOL_MODE $value
} }
#
# Exercise open and close, read and write operations
#
function test_io # dev
{
typeset dev=$1
log_must dd if=/dev/zero of=$dev count=1
log_must dd if=$dev of=/dev/null count=1
}
log_assert "Verify that ZFS volume property 'volmode' works as intended" log_assert "Verify that ZFS volume property 'volmode' works as intended"
log_onexit cleanup log_onexit cleanup
@ -96,6 +107,8 @@ log_must zfs create -o mountpoint=none $VOLFS
log_must zfs create -V $VOLSIZE -s $SUBZVOL log_must zfs create -V $VOLSIZE -s $SUBZVOL
log_must zfs create -V $VOLSIZE -s $ZVOL log_must zfs create -V $VOLSIZE -s $ZVOL
udev_wait udev_wait
test_io $ZDEV
test_io $SUBZDEV
# 1. Verify "volmode" property does not accept invalid values # 1. Verify "volmode" property does not accept invalid values
typeset badvals=("off" "on" "1" "nope" "-") typeset badvals=("off" "on" "1" "nope" "-")
@ -114,6 +127,7 @@ log_must zfs create -V $VOLSIZE -s $ZVOL
udev_wait udev_wait
log_must zfs set volmode=full $ZVOL log_must zfs set volmode=full $ZVOL
blockdev_exists $ZDEV blockdev_exists $ZDEV
test_io $ZDEV
log_must verify_partition $ZDEV log_must verify_partition $ZDEV
udev_wait udev_wait
# 3.1 Verify "volmode=geom" is an alias for "volmode=full" # 3.1 Verify "volmode=geom" is an alias for "volmode=full"
@ -130,6 +144,7 @@ log_must zfs create -V $VOLSIZE -s $ZVOL
udev_wait udev_wait
log_must zfs set volmode=dev $ZVOL log_must zfs set volmode=dev $ZVOL
blockdev_exists $ZDEV blockdev_exists $ZDEV
test_io $ZDEV
log_mustnot verify_partition $ZDEV log_mustnot verify_partition $ZDEV
udev_wait udev_wait
log_must_busy zfs destroy $ZVOL log_must_busy zfs destroy $ZVOL