Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor deadman set failmode to be cross platform #9670

Merged
merged 1 commit into from
Dec 5, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions include/sys/spa.h
Original file line number Diff line number Diff line change
Expand Up @@ -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 { \
Expand Down
3 changes: 2 additions & 1 deletion include/sys/spa_impl.h
Original file line number Diff line number Diff line change
Expand Up @@ -433,6 +433,7 @@ struct spa {
};

extern char *spa_config_path;
extern char *zfs_deadman_failmode;
behlendorf marked this conversation as resolved.
Show resolved Hide resolved
extern int spa_slop_shift;
extern void spa_taskq_dispatch_ent(spa_t *spa, zio_type_t t, zio_taskq_type_t q,
task_func_t *func, void *arg, uint_t flags, taskq_ent_t *ent);
Expand All @@ -443,7 +444,7 @@ extern void spa_load_l2cache(spa_t *spa);
extern sysevent_t *spa_event_create(spa_t *spa, vdev_t *vd, nvlist_t *hist_nvl,
const char *name);
extern void spa_event_post(sysevent_t *ev);

extern int param_set_deadman_failmode_common(const char *val);

#ifdef __cplusplus
}
Expand Down
13 changes: 13 additions & 0 deletions module/os/linux/zfs/spa_misc_os.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@
#include <sys/kstat.h>
#include "zfs_prop.h"


int
param_set_deadman_failmode(const char *val, zfs_kernel_param_t *kp)
mattmacy marked this conversation as resolved.
Show resolved Hide resolved
{
int error;

error = -param_set_deadman_failmode_common(val);
if (error == 0)
error = param_set_charp(val, kp);

return (error);
}

int
param_set_deadman_ziotime(const char *val, zfs_kernel_param_t *kp)
{
Expand Down
20 changes: 9 additions & 11 deletions module/zfs/spa_misc.c
Original file line number Diff line number Diff line change
Expand Up @@ -2708,21 +2708,21 @@ 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;

if (val == NULL)
return (SET_ERROR(-EINVAL));
return (SET_ERROR(EINVAL));

if ((p = strchr(val, '\n')) != NULL)
*p = '\0';

if (strcmp(val, "wait") != 0 && strcmp(val, "continue") != 0 &&
strcmp(val, "panic"))
return (SET_ERROR(-EINVAL));
return (SET_ERROR(EINVAL));

if (spa_mode_global != SPA_MODE_UNINIT) {
mutex_enter(&spa_namespace_lock);
Expand All @@ -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));
mattmacy marked this conversation as resolved.
Show resolved Hide resolved
return (0);
}
#endif

Expand Down Expand Up @@ -2847,13 +2847,11 @@ ZFS_MODULE_PARAM(zfs, zfs_, ddt_data_is_special, INT, ZMOD_RW,
ZFS_MODULE_PARAM(zfs, zfs_, user_indirect_is_special, INT, ZMOD_RW,
"Place user data indirect blocks into the special class");

#ifdef _KERNEL
module_param_call(zfs_deadman_failmode, param_set_deadman_failmode,
param_get_charp, &zfs_deadman_failmode, 0644);
MODULE_PARM_DESC(zfs_deadman_failmode, "Failmode for deadman timer");
#endif

/* BEGIN CSTYLED */
ZFS_MODULE_PARAM_CALL(zfs_deadman, zfs_deadman_, failmode,
param_set_deadman_failmode, param_get_charp, ZMOD_RW,
"Failmode for deadman timer");

ZFS_MODULE_PARAM_CALL(zfs_deadman, zfs_deadman_, synctime_ms,
param_set_deadman_synctime, param_get_ulong, ZMOD_RW,
"Pool sync expiration time in milliseconds");
Expand Down