]> git.proxmox.com Git - mirror_zfs.git/commit
module param callbacks check for initialized spa
authorOlaf Faaland <faaland1@llnl.gov>
Fri, 11 May 2018 19:46:07 +0000 (12:46 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Fri, 11 May 2018 19:46:07 +0000 (12:46 -0700)
commitbc5f51c5de21fd8b7cf3110801a6b1db1e4c3d0a
tree9781fdf091e1a1e364f4ae8a6f1d7ff133da2206
parent68fded814692c6a7fa7ca1f584a34a92aaa279af
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
module/zfs/mmp.c
module/zfs/vdev_disk.c