* Open the requested child vdevs. If any of the leaf vdevs are using * a ZFS volume then do the opens in a single thread. This avoids a * deadlock when the current thread is holding the spa_namespace_lock. */
| 1673 | * deadlock when the current thread is holding the spa_namespace_lock. |
| 1674 | */ |
| 1675 | static void |
| 1676 | vdev_open_children_impl(vdev_t *vd, vdev_open_children_func_t *open_func) |
| 1677 | { |
| 1678 | int children = vd->vdev_children; |
| 1679 | |
| 1680 | taskq_t *tq = taskq_create("vdev_open", children, minclsyspri, |
| 1681 | children, children, TASKQ_PREPOPULATE); |
| 1682 | vd->vdev_nonrot = B_TRUE; |
| 1683 | |
| 1684 | for (int c = 0; c < children; c++) { |
| 1685 | vdev_t *cvd = vd->vdev_child[c]; |
| 1686 | |
| 1687 | if (open_func(cvd) == B_FALSE) |
| 1688 | continue; |
| 1689 | |
| 1690 | if (tq == NULL || vdev_uses_zvols(vd)) { |
| 1691 | cvd->vdev_open_error = vdev_open(cvd); |
| 1692 | } else { |
| 1693 | VERIFY(taskq_dispatch(tq, vdev_open_child, |
| 1694 | cvd, TQ_SLEEP) != TASKQID_INVALID); |
| 1695 | } |
| 1696 | |
| 1697 | vd->vdev_nonrot &= cvd->vdev_nonrot; |
| 1698 | } |
| 1699 | |
| 1700 | if (tq != NULL) { |
| 1701 | taskq_wait(tq); |
| 1702 | taskq_destroy(tq); |
| 1703 | } |
| 1704 | } |
| 1705 | |
| 1706 | /* |
| 1707 | * Open all child vdevs. |
no test coverage detected