From 9474c08008d9a16bd997614886610a52bc422f94 Mon Sep 17 00:00:00 2001 From: Matt Macy Date: Tue, 3 Dec 2019 22:20:36 +0000 Subject: [PATCH] Refactor deadman set failmode to be cross platform Signed-off-by: Matt Macy --- include/sys/spa.h | 1 + module/os/linux/zfs/spa_misc_os.c | 11 +++++++++++ module/zfs/spa_misc.c | 6 +++--- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/include/sys/spa.h b/include/sys/spa.h index e460dc2dd395..780119e9af93 100644 --- a/include/sys/spa.h +++ b/include/sys/spa.h @@ -1182,6 +1182,7 @@ extern void spa_wake_waiters(spa_t *spa); int param_set_deadman_ziotime(const char *val, zfs_kernel_param_t *kp); int param_set_deadman_synctime(const char *val, zfs_kernel_param_t *kp); int param_set_slop_shift(const char *buf, zfs_kernel_param_t *kp); +int param_set_deadman_failmode(const char *val, zfs_kernel_param_t *kp); #ifdef ZFS_DEBUG #define dprintf_bp(bp, fmt, ...) do { \ diff --git a/module/os/linux/zfs/spa_misc_os.c b/module/os/linux/zfs/spa_misc_os.c index 97d91f9822ea..23987b9abf84 100644 --- a/module/os/linux/zfs/spa_misc_os.c +++ b/module/os/linux/zfs/spa_misc_os.c @@ -42,6 +42,17 @@ #include #include "zfs_prop.h" + +int +param_set_deadman_failmode(const char *val, zfs_kernel_param_t *kp) +{ + int error; + + error = param_set_deadman_failmode_common(val); + + return (error || param_set_charp(val, kp)); +} + int param_set_deadman_ziotime(const char *val, zfs_kernel_param_t *kp) { diff --git a/module/zfs/spa_misc.c b/module/zfs/spa_misc.c index d49c92e20986..d39673e11fd6 100644 --- a/module/zfs/spa_misc.c +++ b/module/zfs/spa_misc.c @@ -2708,8 +2708,8 @@ spa_suspend_async_destroy(spa_t *spa) #if defined(_KERNEL) -static int -param_set_deadman_failmode(const char *val, zfs_kernel_param_t *kp) +int +param_set_deadman_failmode_common(const char *val) { spa_t *spa = NULL; char *p; @@ -2731,7 +2731,7 @@ param_set_deadman_failmode(const char *val, zfs_kernel_param_t *kp) mutex_exit(&spa_namespace_lock); } - return (param_set_charp(val, kp)); + return (0); } #endif