spa.c (211931) | spa.c (213197) |
---|---|
1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 1096 unchanged lines hidden (view full) --- 1105 1106 if (vd->vdev_ops->vdev_op_leaf && vdev_is_dead(vd)) { 1107 zfs_post_autoreplace(vd->vdev_spa, vd); 1108 spa_event_notify(vd->vdev_spa, vd, ESC_ZFS_VDEV_CHECK); 1109 } 1110} 1111 1112/* | 1/* 2 * CDDL HEADER START 3 * 4 * The contents of this file are subject to the terms of the 5 * Common Development and Distribution License (the "License"). 6 * You may not use this file except in compliance with the License. 7 * 8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE --- 1096 unchanged lines hidden (view full) --- 1105 1106 if (vd->vdev_ops->vdev_op_leaf && vdev_is_dead(vd)) { 1107 zfs_post_autoreplace(vd->vdev_spa, vd); 1108 spa_event_notify(vd->vdev_spa, vd, ESC_ZFS_VDEV_CHECK); 1109 } 1110} 1111 1112/* |
1113 * Load the slog device state from the config object since it's possible 1114 * that the label does not contain the most up-to-date information. 1115 */ 1116void 1117spa_load_log_state(spa_t *spa) 1118{ 1119 nvlist_t *nv, *nvroot, **child; 1120 uint64_t is_log; 1121 uint_t children, c; 1122 vdev_t *rvd = spa->spa_root_vdev; 1123 1124 VERIFY(load_nvlist(spa, spa->spa_config_object, &nv) == 0); 1125 VERIFY(nvlist_lookup_nvlist(nv, ZPOOL_CONFIG_VDEV_TREE, &nvroot) == 0); 1126 VERIFY(nvlist_lookup_nvlist_array(nvroot, ZPOOL_CONFIG_CHILDREN, 1127 &child, &children) == 0); 1128 1129 for (c = 0; c < children; c++) { 1130 vdev_t *tvd = rvd->vdev_child[c]; 1131 1132 if (nvlist_lookup_uint64(child[c], ZPOOL_CONFIG_IS_LOG, 1133 &is_log) == 0 && is_log) 1134 vdev_load_log_state(tvd, child[c]); 1135 } 1136 nvlist_free(nv); 1137} 1138 1139/* |
|
1113 * Check for missing log devices 1114 */ 1115int 1116spa_check_logs(spa_t *spa) 1117{ 1118 switch (spa->spa_log_state) { 1119 case SPA_LOG_MISSING: 1120 /* need to recheck in case slog has been restored */ 1121 case SPA_LOG_UNKNOWN: 1122 if (dmu_objset_find(spa->spa_name, zil_check_log_chain, NULL, 1123 DS_FIND_CHILDREN)) { 1124 spa->spa_log_state = SPA_LOG_MISSING; 1125 return (1); 1126 } 1127 break; | 1140 * Check for missing log devices 1141 */ 1142int 1143spa_check_logs(spa_t *spa) 1144{ 1145 switch (spa->spa_log_state) { 1146 case SPA_LOG_MISSING: 1147 /* need to recheck in case slog has been restored */ 1148 case SPA_LOG_UNKNOWN: 1149 if (dmu_objset_find(spa->spa_name, zil_check_log_chain, NULL, 1150 DS_FIND_CHILDREN)) { 1151 spa->spa_log_state = SPA_LOG_MISSING; 1152 return (1); 1153 } 1154 break; |
1128 1129 case SPA_LOG_CLEAR: 1130 (void) dmu_objset_find(spa->spa_name, zil_clear_log_chain, NULL, 1131 DS_FIND_CHILDREN); 1132 break; | |
1133 } | 1155 } |
1134 spa->spa_log_state = SPA_LOG_GOOD; | |
1135 return (0); 1136} 1137 1138/* 1139 * Load an existing storage pool, using the pool's builtin spa_config as a 1140 * source of configuration information. 1141 */ 1142static int --- 307 unchanged lines hidden (view full) --- 1450 goto out; 1451 } 1452 1453 spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); 1454 spa_load_l2cache(spa); 1455 spa_config_exit(spa, SCL_ALL, FTAG); 1456 } 1457 | 1156 return (0); 1157} 1158 1159/* 1160 * Load an existing storage pool, using the pool's builtin spa_config as a 1161 * source of configuration information. 1162 */ 1163static int --- 307 unchanged lines hidden (view full) --- 1471 goto out; 1472 } 1473 1474 spa_config_enter(spa, SCL_ALL, FTAG, RW_WRITER); 1475 spa_load_l2cache(spa); 1476 spa_config_exit(spa, SCL_ALL, FTAG); 1477 } 1478 |
1479 spa_load_log_state(spa); 1480 |
|
1458 if (spa_check_logs(spa)) { 1459 vdev_set_state(rvd, B_TRUE, VDEV_STATE_CANT_OPEN, 1460 VDEV_AUX_BAD_LOG); 1461 error = ENXIO; 1462 ereport = FM_EREPORT_ZFS_LOG_REPLAY; 1463 goto out; 1464 } 1465 --- 71 unchanged lines hidden (view full) --- 1537 * This must all happen in a single txg. 1538 */ 1539 tx = dmu_tx_create_assigned(spa_get_dsl(spa), 1540 spa_first_txg(spa)); 1541 (void) dmu_objset_find(spa_name(spa), 1542 zil_claim, tx, DS_FIND_CHILDREN); 1543 dmu_tx_commit(tx); 1544 | 1481 if (spa_check_logs(spa)) { 1482 vdev_set_state(rvd, B_TRUE, VDEV_STATE_CANT_OPEN, 1483 VDEV_AUX_BAD_LOG); 1484 error = ENXIO; 1485 ereport = FM_EREPORT_ZFS_LOG_REPLAY; 1486 goto out; 1487 } 1488 --- 71 unchanged lines hidden (view full) --- 1560 * This must all happen in a single txg. 1561 */ 1562 tx = dmu_tx_create_assigned(spa_get_dsl(spa), 1563 spa_first_txg(spa)); 1564 (void) dmu_objset_find(spa_name(spa), 1565 zil_claim, tx, DS_FIND_CHILDREN); 1566 dmu_tx_commit(tx); 1567 |
1568 spa->spa_log_state = SPA_LOG_GOOD; |
|
1545 spa->spa_sync_on = B_TRUE; 1546 txg_sync_start(spa->spa_dsl_pool); 1547 1548 /* 1549 * Wait for all claims to sync. 1550 */ 1551 txg_wait_synced(spa->spa_dsl_pool, 0); 1552 --- 2948 unchanged lines hidden --- | 1569 spa->spa_sync_on = B_TRUE; 1570 txg_sync_start(spa->spa_dsl_pool); 1571 1572 /* 1573 * Wait for all claims to sync. 1574 */ 1575 txg_wait_synced(spa->spa_dsl_pool, 0); 1576 --- 2948 unchanged lines hidden --- |