mirror of
https://git.proxmox.com/git/mirror_zfs.git
synced 2024-12-26 03:09:34 +03:00
module param callbacks check for initialized spa
Callbacks provided for module parameters are executed both after the module is loaded, when a user alters it via sysfs, e.g echo bar > /sys/modules/zfs/parameters/foo as well as when the module is loaded with an argument, e.g. modprobe zfs foo=bar In the latter case, the init functions likely have not run yet, including spa_init() which initializes the namespace lock so it is safe to use. Instead of immediately taking the namespace lock and attemping to iterate over initialized spa structures, check whether spa_mode_global is nonzero. This is set by spa_init() after it has initialized the namespace lock. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Reviewed-by: Tim Chase <tim@chase2k.com> Signed-off-by: Olaf Faaland <faaland1@llnl.gov> Closes #7496 Closes #7521
This commit is contained in:
parent
68fded8146
commit
bc5f51c5de
@ -609,6 +609,7 @@ param_set_multihost_interval(const char *val, zfs_kernel_param_t *kp)
|
||||
if (ret < 0)
|
||||
return (ret);
|
||||
|
||||
if (spa_mode_global != 0)
|
||||
mmp_signal_all_threads();
|
||||
|
||||
return (ret);
|
||||
|
@ -818,6 +818,7 @@ param_set_vdev_scheduler(const char *val, zfs_kernel_param_t *kp)
|
||||
if ((p = strchr(val, '\n')) != NULL)
|
||||
*p = '\0';
|
||||
|
||||
if (spa_mode_global != 0) {
|
||||
mutex_enter(&spa_namespace_lock);
|
||||
while ((spa = spa_next(spa)) != NULL) {
|
||||
if (spa_state(spa) != POOL_STATE_ACTIVE ||
|
||||
@ -831,6 +832,7 @@ param_set_vdev_scheduler(const char *val, zfs_kernel_param_t *kp)
|
||||
spa_close(spa, FTAG);
|
||||
}
|
||||
mutex_exit(&spa_namespace_lock);
|
||||
}
|
||||
|
||||
return (param_set_charp(val, kp));
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user