From 9192f27c1d7a8cb367d8691277573f2b756b47b6 Mon Sep 17 00:00:00 2001 From: Ryan Moeller Date: Tue, 23 Jun 2020 16:32:42 -0400 Subject: [PATCH] Add zfs_multihost_interval tunable handler for FreeBSD This tunable required a handler to be implemented for ZFS_MODULE_PARAM_CALL. Add the handler so the tunable can be declared in common code. Reviewed-by: Brian Behlendorf Signed-off-by: Ryan Moeller Closes #10490 --- include/os/freebsd/spl/sys/mod_os.h | 3 +++ include/sys/mmp.h | 1 + module/os/freebsd/zfs/sysctl_os.c | 15 +++++++++++++++ module/os/linux/zfs/mmp_os.c | 7 +------ module/zfs/mmp.c | 6 ++++++ tests/zfs-tests/include/tunables.cfg | 2 +- 6 files changed, 27 insertions(+), 7 deletions(-) diff --git a/include/os/freebsd/spl/sys/mod_os.h b/include/os/freebsd/spl/sys/mod_os.h index d81d927fd..9a3b29e1e 100644 --- a/include/os/freebsd/spl/sys/mod_os.h +++ b/include/os/freebsd/spl/sys/mod_os.h @@ -72,6 +72,9 @@ #define param_set_deadman_ziotime_args(var) \ CTLTYPE_ULONG, NULL, 0, param_set_deadman_ziotime, "LU" +#define param_set_multihost_interval_args(var) \ + CTLTYPE_ULONG, &var, 0, param_set_multihost_interval, "LU" + #define param_set_slop_shift_args(var) \ CTLTYPE_INT, &var, 0, param_set_slop_shift, "I" diff --git a/include/sys/mmp.h b/include/sys/mmp.h index 527e3323b..ce9c4496a 100644 --- a/include/sys/mmp.h +++ b/include/sys/mmp.h @@ -63,6 +63,7 @@ extern void mmp_update_uberblock(struct spa *spa, struct uberblock *ub); extern void mmp_signal_all_threads(void); /* Global tuning */ +extern int param_set_multihost_interval(ZFS_MODULE_PARAM_ARGS); extern ulong_t zfs_multihost_interval; extern uint_t zfs_multihost_fail_intervals; extern uint_t zfs_multihost_import_intervals; diff --git a/module/os/freebsd/zfs/sysctl_os.c b/module/os/freebsd/zfs/sysctl_os.c index 544a88956..6d5c88e21 100644 --- a/module/os/freebsd/zfs/sysctl_os.c +++ b/module/os/freebsd/zfs/sysctl_os.c @@ -691,3 +691,18 @@ param_set_slop_shift(SYSCTL_HANDLER_ARGS) return (0); } + +int +param_set_multihost_interval(SYSCTL_HANDLER_ARGS) +{ + int err; + + err = sysctl_handle_long(oidp, arg1, 0, req); + if (err != 0 || req->newptr == NULL) + return (err); + + if (spa_mode_global != SPA_MODE_UNINIT) + mmp_signal_all_threads(); + + return (0); +} diff --git a/module/os/linux/zfs/mmp_os.c b/module/os/linux/zfs/mmp_os.c index 9c8545f3c..ff3ef1bf6 100644 --- a/module/os/linux/zfs/mmp_os.c +++ b/module/os/linux/zfs/mmp_os.c @@ -25,7 +25,7 @@ #include #include -static int +int param_set_multihost_interval(const char *val, zfs_kernel_param_t *kp) { int ret; @@ -39,8 +39,3 @@ param_set_multihost_interval(const char *val, zfs_kernel_param_t *kp) return (ret); } - -module_param_call(zfs_multihost_interval, param_set_multihost_interval, - param_get_ulong, &zfs_multihost_interval, 0644); -MODULE_PARM_DESC(zfs_multihost_interval, - "Milliseconds between mmp writes to each leaf"); diff --git a/module/zfs/mmp.c b/module/zfs/mmp.c index e1e468557..4170d7e03 100644 --- a/module/zfs/mmp.c +++ b/module/zfs/mmp.c @@ -715,6 +715,12 @@ mmp_signal_all_threads(void) mutex_exit(&spa_namespace_lock); } +/* BEGIN CSTYLED */ +ZFS_MODULE_PARAM_CALL(zfs_multihost, zfs_multihost_, interval, + param_set_multihost_interval, param_get_ulong, ZMOD_RW, + "Milliseconds between mmp writes to each leaf"); +/* END CSTYLED */ + ZFS_MODULE_PARAM(zfs_multihost, zfs_multihost_, fail_intervals, UINT, ZMOD_RW, "Max allowed period without a successful mmp write"); diff --git a/tests/zfs-tests/include/tunables.cfg b/tests/zfs-tests/include/tunables.cfg index c450764db..df8824b1e 100644 --- a/tests/zfs-tests/include/tunables.cfg +++ b/tests/zfs-tests/include/tunables.cfg @@ -55,7 +55,7 @@ METASLAB_FORCE_GANGING metaslab.force_ganging metaslab_force_ganging MULTIHOST_FAIL_INTERVALS multihost.fail_intervals zfs_multihost_fail_intervals MULTIHOST_HISTORY UNSUPPORTED zfs_multihost_history MULTIHOST_IMPORT_INTERVALS multihost.import_intervals zfs_multihost_import_intervals -MULTIHOST_INTERVAL UNSUPPORTED zfs_multihost_interval +MULTIHOST_INTERVAL multihost.interval zfs_multihost_interval OVERRIDE_ESTIMATE_RECORDSIZE send.override_estimate_recordsize zfs_override_estimate_recordsize REMOVAL_SUSPEND_PROGRESS removal_suspend_progress zfs_removal_suspend_progress REMOVE_MAX_SEGMENT remove_max_segment zfs_remove_max_segment