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 --- 2722 unchanged lines hidden (view full) --- 2731 /* The sentinel is only available in the MOS config. */ 2732 nvlist_t *mos_config; 2733 if (load_nvlist(spa, spa->spa_config_object, &mos_config) != 0) 2734 return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); 2735 2736 error = spa_dir_prop(spa, DMU_POOL_VDEV_ZAP_MAP, 2737 &spa->spa_all_vdev_zaps); 2738 |
2739 if (error == ENOENT) { 2740 VERIFY(!nvlist_exists(mos_config, 2741 ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS)); 2742 spa->spa_avz_action = AVZ_ACTION_INITIALIZE; 2743 ASSERT0(vdev_count_verify_zaps(spa->spa_root_vdev)); 2744 } else if (error != 0) { |
2745 return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO)); |
2746 } else if (!nvlist_exists(mos_config, ZPOOL_CONFIG_HAS_PER_VDEV_ZAPS)) { |
2747 /* 2748 * An older version of ZFS overwrote the sentinel value, so 2749 * we have orphaned per-vdev ZAPs in the MOS. Defer their 2750 * destruction to later; see spa_sync_config_object. 2751 */ 2752 spa->spa_avz_action = AVZ_ACTION_DESTROY; 2753 /* 2754 * We're assuming that no vdevs have had their ZAPs created --- 3747 unchanged lines hidden (view full) --- 6502 */ 6503 if (list_is_empty(&spa->spa_config_dirty_list) && 6504 spa->spa_avz_action == AVZ_ACTION_NONE) 6505 return; 6506 6507 spa_config_enter(spa, SCL_STATE, FTAG, RW_READER); 6508 6509 ASSERT(spa->spa_avz_action == AVZ_ACTION_NONE || |
6510 spa->spa_avz_action == AVZ_ACTION_INITIALIZE || |
6511 spa->spa_all_vdev_zaps != 0); 6512 6513 if (spa->spa_avz_action == AVZ_ACTION_REBUILD) { 6514 /* Make and build the new AVZ */ 6515 uint64_t new_avz = zap_create(spa->spa_meta_objset, 6516 DMU_OTN_ZAP_METADATA, DMU_OT_NONE, 0, tx); 6517 spa_avz_build(spa->spa_root_vdev, new_avz, tx); 6518 --- 865 unchanged lines hidden --- |