summaryrefslogtreecommitdiffstats
path: root/cmd/zpool/zpool_main.c
diff options
context:
space:
mode:
authorBrian Behlendorf <[email protected]>2016-03-17 15:32:33 -0700
committerBrian Behlendorf <[email protected]>2016-03-21 10:20:02 -0700
commit505d9655c9e759a145b4812c654c51c34dbe3425 (patch)
tree7ad9dfd11ce94dd597a72b61c6d1563e55f6208b /cmd/zpool/zpool_main.c
parentfc0c72b1670156622af26562030e84bd56d4cdfb (diff)
Fix zdb -e and zhack thread_init()
This issue was caused by calling `thread_init()` and `thread_fini()` multiple times resulting in `kthread_key` being invalid. To resolve the issue the explicit calls to `thread_init()` and `thread_fini()` required by the `zpool` command have been moved in to the command. Consumers such as `zdb` and `zhack` perform the same initialized through `kernel_init()` and `kernel_fini()`. Resolving this issue allows multiple additional test cases to be enabled. Signed-off-by: Brian Behlendorf <[email protected]> Signed-off-by: Signed-off-by: Chunwei Chen <[email protected]> Signed-off-by: Tim Chase <[email protected]> Closes #4331
Diffstat (limited to 'cmd/zpool/zpool_main.c')
-rw-r--r--cmd/zpool/zpool_main.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/cmd/zpool/zpool_main.c b/cmd/zpool/zpool_main.c
index b74dc219a..c9b600650 100644
--- a/cmd/zpool/zpool_main.c
+++ b/cmd/zpool/zpool_main.c
@@ -2331,7 +2331,15 @@ zpool_do_import(int argc, char **argv)
idata.cachefile = cachefile;
idata.scan = do_scan;
+ /*
+ * Under Linux the zpool_find_import_impl() function leverages the
+ * taskq implementation to parallelize device scanning. It is
+ * therefore necessary to initialize this functionality for the
+ * duration of the zpool_search_import() function.
+ */
+ thread_init();
pools = zpool_search_import(g_zfs, &idata);
+ thread_fini();
if (pools != NULL && idata.exists &&
(argc == 1 || strcmp(argv[0], argv[1]) == 0)) {