1494 vdev_reopen(vdev_t *vd)
1495 {
1496 spa_t *spa = vd->vdev_spa;
1497
1498 ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL);
1499
1500 /* set the reopening flag unless we're taking the vdev offline */
1501 vd->vdev_reopening = !vd->vdev_offline;
1502 vdev_close(vd);
1503 (void) vdev_open(vd);
1504
1505 /*
1506 * Call vdev_validate() here to make sure we have the same device.
1507 * Otherwise, a device with an invalid label could be successfully
1508 * opened in response to vdev_reopen().
1509 */
1510 if (vd->vdev_aux) {
1511 (void) vdev_validate_aux(vd);
1512 if (vdev_readable(vd) && vdev_writeable(vd) &&
1513 vd->vdev_aux == &spa->spa_l2cache &&
1514 !l2arc_vdev_present(vd))
1515 l2arc_add_vdev(spa, vd);
1516 } else {
1517 (void) vdev_validate(vd, B_TRUE);
1518 }
1519
1520 /*
1521 * Reassess parent vdev's health.
1522 */
1523 vdev_propagate_state(vd);
1524 }
1525
1526 int
1527 vdev_create(vdev_t *vd, uint64_t txg, boolean_t isreplacing)
1528 {
1529 int error;
1530
1531 /*
1532 * Normally, partial opens (e.g. of a mirror) are allowed.
1533 * For a create, however, we want to fail the request if
1534 * there are any components we can't open.
1535 */
|
1494 vdev_reopen(vdev_t *vd)
1495 {
1496 spa_t *spa = vd->vdev_spa;
1497
1498 ASSERT(spa_config_held(spa, SCL_STATE_ALL, RW_WRITER) == SCL_STATE_ALL);
1499
1500 /* set the reopening flag unless we're taking the vdev offline */
1501 vd->vdev_reopening = !vd->vdev_offline;
1502 vdev_close(vd);
1503 (void) vdev_open(vd);
1504
1505 /*
1506 * Call vdev_validate() here to make sure we have the same device.
1507 * Otherwise, a device with an invalid label could be successfully
1508 * opened in response to vdev_reopen().
1509 */
1510 if (vd->vdev_aux) {
1511 (void) vdev_validate_aux(vd);
1512 if (vdev_readable(vd) && vdev_writeable(vd) &&
1513 vd->vdev_aux == &spa->spa_l2cache &&
1514 !l2arc_vdev_present(vd)) {
1515 /*
1516 * When reopening we can assume persistent L2ARC is
1517 * supported, since we've already opened the device
1518 * in the past and prepended an L2 uberblock.
1519 */
1520 l2arc_add_vdev(spa, vd, B_TRUE);
1521 }
1522 } else {
1523 (void) vdev_validate(vd, B_TRUE);
1524 }
1525
1526 /*
1527 * Reassess parent vdev's health.
1528 */
1529 vdev_propagate_state(vd);
1530 }
1531
1532 int
1533 vdev_create(vdev_t *vd, uint64_t txg, boolean_t isreplacing)
1534 {
1535 int error;
1536
1537 /*
1538 * Normally, partial opens (e.g. of a mirror) are allowed.
1539 * For a create, however, we want to fail the request if
1540 * there are any components we can't open.
1541 */
|