summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Moeller <[email protected]>2020-02-18 14:22:56 -0500
committerGitHub <[email protected]>2020-02-18 11:22:56 -0800
commit5f087dda784b26f16e72eff32c0e2c2b7c483adb (patch)
tree5948fd65b72984b68588ecbc91c33142e48e48e2
parent8b3547a481a74b39c5d0eed256896fb25e8310e9 (diff)
Enable zpool events tunables and tests on FreeBSD
We have have made the necessary changes in our module code to expose zevents through both devd and the zpool events ioctl. Now the tunables can be exposed and zpool events tests can be enabled on both platforms. A few minor tweaks to the tests were needed to accommodate the way wc formats output on FreeBSD. zed remains to be ported. Reviewed-by: Brian Behlendorf <[email protected]> Signed-off-by: Ryan Moeller <[email protected]> Closes #10008
-rw-r--r--include/os/linux/kernel/linux/mod_compat.h1
-rw-r--r--module/zfs/fm.c17
-rw-r--r--tests/runfiles/common.run5
-rw-r--r--tests/runfiles/linux.run5
-rw-r--r--tests/zfs-tests/include/tunables.cfg2
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_clear.ksh6
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_errors.ksh4
-rwxr-xr-xtests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_follow.ksh4
8 files changed, 21 insertions, 23 deletions
diff --git a/include/os/linux/kernel/linux/mod_compat.h b/include/os/linux/kernel/linux/mod_compat.h
index 572093218..a0f618d14 100644
--- a/include/os/linux/kernel/linux/mod_compat.h
+++ b/include/os/linux/kernel/linux/mod_compat.h
@@ -70,6 +70,7 @@ enum scope_prefix_types {
zfs_vdev,
zfs_vdev_cache,
zfs_vdev_mirror,
+ zfs_zevent,
zfs_zio,
zfs_zil,
spa
diff --git a/module/zfs/fm.c b/module/zfs/fm.c
index e3c3a1700..c00e08b8d 100644
--- a/module/zfs/fm.c
+++ b/module/zfs/fm.c
@@ -1607,9 +1607,7 @@ fm_erpt_dropped_increment(void)
{
atomic_inc_64(&ratelimit_dropped);
}
-#endif
-#ifdef _KERNEL
void
fm_init(void)
{
@@ -1664,14 +1662,13 @@ fm_fini(void)
fm_ksp = NULL;
}
}
+#endif /* _KERNEL */
-module_param(zfs_zevent_len_max, int, 0644);
-MODULE_PARM_DESC(zfs_zevent_len_max, "Max event queue length");
-
-module_param(zfs_zevent_cols, int, 0644);
-MODULE_PARM_DESC(zfs_zevent_cols, "Max event column width");
+ZFS_MODULE_PARAM(zfs_zevent, zfs_zevent_, len_max, INT, ZMOD_RW,
+ "Max event queue length");
-module_param(zfs_zevent_console, int, 0644);
-MODULE_PARM_DESC(zfs_zevent_console, "Log events to the console");
+ZFS_MODULE_PARAM(zfs_zevent, zfs_zevent_, cols, INT, ZMOD_RW,
+ "Max event column width");
-#endif /* _KERNEL */
+ZFS_MODULE_PARAM(zfs_zevent, zfs_zevent_, console, INT, ZMOD_RW,
+ "Log events to the console");
diff --git a/tests/runfiles/common.run b/tests/runfiles/common.run
index 3c71458eb..cbd8ef93e 100644
--- a/tests/runfiles/common.run
+++ b/tests/runfiles/common.run
@@ -333,6 +333,11 @@ tags = ['functional', 'cli_root', 'zpool_destroy']
tests = ['zpool_detach_001_neg']
tags = ['functional', 'cli_root', 'zpool_detach']
+[tests/functional/cli_root/zpool_events]
+tests = ['zpool_events_clear', 'zpool_events_cliargs', 'zpool_events_follow',
+ 'zpool_events_poolname', 'zpool_events_errors']
+tags = ['functional', 'cli_root', 'zpool_events']
+
[tests/functional/cli_root/zpool_export]
tests = ['zpool_export_001_pos', 'zpool_export_002_pos',
'zpool_export_003_neg', 'zpool_export_004_pos']
diff --git a/tests/runfiles/linux.run b/tests/runfiles/linux.run
index 7378f1aee..6d6fc0322 100644
--- a/tests/runfiles/linux.run
+++ b/tests/runfiles/linux.run
@@ -59,11 +59,6 @@ tags = ['functional', 'cli_root', 'zfs_sysfs']
tests = ['add_nested_replacing_spare']
tags = ['functional', 'cli_root', 'zpool_add']
-[tests/functional/cli_root/zpool_events:Linux]
-tests = ['zpool_events_clear', 'zpool_events_cliargs', 'zpool_events_follow',
- 'zpool_events_poolname', 'zpool_events_errors']
-tags = ['functional', 'cli_root', 'zpool_events']
-
[tests/functional/cli_root/zpool_expand:Linux]
tests = ['zpool_expand_001_pos', 'zpool_expand_002_pos',
'zpool_expand_003_neg', 'zpool_expand_004_pos', 'zpool_expand_005_pos']
diff --git a/tests/zfs-tests/include/tunables.cfg b/tests/zfs-tests/include/tunables.cfg
index 2a4ea9bdc..01176c781 100644
--- a/tests/zfs-tests/include/tunables.cfg
+++ b/tests/zfs-tests/include/tunables.cfg
@@ -73,7 +73,7 @@ VDEV_VALIDATE_SKIP vdev.validate_skip vdev_validate_skip
VOL_INHIBIT_DEV UNSUPPORTED zvol_inhibit_dev
VOL_MODE vol.mode zvol_volmode
VOL_RECURSIVE vol.recursive UNSUPPORTED
-ZEVENT_LEN_MAX UNSUPPORTED zfs_zevent_len_max
+ZEVENT_LEN_MAX zevent.len_max zfs_zevent_len_max
ZIO_SLOW_IO_MS zio.slow_io_ms zio_slow_io_ms
%%%%
while read name FreeBSD Linux; do
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_clear.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_clear.ksh
index 67038a474..054d39be3 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_clear.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_clear.ksh
@@ -43,14 +43,14 @@ for i in `seq 1 $EVENTS_NUM`; do
done
# wait a bit to allow the kernel module to process new events
zpool_events_settle
-EVENTS_NUM="$(zpool events -H | wc -l)"
+EVENTS_NUM=$(zpool events -H | wc -l | xargs)
# 3. Verify 'zpool events -c' successfully clear new events
-CLEAR_OUTPUT="$(zpool events -c)"
+CLEAR_OUTPUT=$(zpool events -c)
if [[ "$CLEAR_OUTPUT" != "cleared $EVENTS_NUM events" ]]; then
log_fail "Failed to clear $EVENTS_NUM events: $CLEAR_OUTPUT"
fi
-EVENTS_NUM="$(zpool events -H | wc -l)"
+EVENTS_NUM=$(zpool events -H | wc -l)
if [[ $EVENTS_NUM -ne 0 ]]; then
log_fail "Unexpected events number: $EVENTS_NUM != 0"
fi
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_errors.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_errors.ksh
index ba940210e..4645e245c 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_errors.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_errors.ksh
@@ -129,11 +129,11 @@ function do_test
fi
fi
- if [ "$val" == "0" ] || [ "$events" == "" ] ; then
+ if [ -z "$val" -o $val -eq 0 -o -z "$events" -o $events -eq 0 ] ; then
log_fail "Didn't see any errors or events ($val/$events)"
fi
- if [ "$val" != "$events" ] ; then
+ if [ $val -ne $events ] ; then
log_fail "$val $POOLTYPE $str errors != $events events"
else
log_note "$val $POOLTYPE $str errors == $events events"
diff --git a/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_follow.ksh b/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_follow.ksh
index a996e57c1..258de033b 100755
--- a/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_follow.ksh
+++ b/tests/zfs-tests/tests/functional/cli_root/zpool_events/zpool_events_follow.ksh
@@ -56,8 +56,8 @@ done
zpool_events_settle
# 4. Verify 'zpool events -f' successfully recorded these new events
-EVENTS_LOG="$(cat $EVENTS_FILE | wc -l)"
-if [[ "$EVENTS_LOG" != "$EVENTS_NUM" ]]; then
+EVENTS_LOG=$(cat $EVENTS_FILE | wc -l)
+if [[ $EVENTS_LOG -ne $EVENTS_NUM ]]; then
log_fail "Unexpected number of events: $EVENTS_LOG != $EVENTS_NUM"
fi