diff options
author | Brian Behlendorf <[email protected]> | 2016-10-24 13:28:58 -0700 |
---|---|---|
committer | GitHub <[email protected]> | 2016-10-24 13:28:58 -0700 |
commit | 13d9a004fe533df8613888687650b1b0e272b67d (patch) | |
tree | aaf12080a8ab4083e61fa78b35181853bd8c90b7 /module/zfs/vdev.c | |
parent | 1bbd8770490f0e5b8c575865ab70f6853bca2a2a (diff) |
Fix taskq creation failure in vdev_open_children()
When creating and destroying pools in tight loop it's possible to
exhaust the number of allowed threads on a system. This results
in taskq_create() failling and a NULL dereference.
Resolve the issue by falling back to opening the vdevs all
synchronously.
Reviewed-by: Denys Rtveliashvili <[email protected]>
Reviewed-by: HÃ¥kan Johansson <[email protected]>
Signed-off-by: Brian Behlendorf <[email protected]>
Closes zfsonlinux/spl#521
Closes #4637
Diffstat (limited to 'module/zfs/vdev.c')
-rw-r--r-- | module/zfs/vdev.c | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/module/zfs/vdev.c b/module/zfs/vdev.c index 8a4d48a1d..e3a9da2d5 100644 --- a/module/zfs/vdev.c +++ b/module/zfs/vdev.c @@ -1179,12 +1179,15 @@ vdev_open_children(vdev_t *vd) * spa_namespace_lock */ if (vdev_uses_zvols(vd)) { +retry_sync: for (c = 0; c < children; c++) vd->vdev_child[c]->vdev_open_error = vdev_open(vd->vdev_child[c]); } else { tq = taskq_create("vdev_open", children, minclsyspri, children, children, TASKQ_PREPOPULATE); + if (tq == NULL) + goto retry_sync; for (c = 0; c < children; c++) VERIFY(taskq_dispatch(tq, vdev_open_child, |