Deleted Added
full compact
spa.c (236884) spa.c (238926)
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

--- 2158 unchanged lines hidden (view full) ---

2167 return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
2168 spa->spa_meta_objset = spa->spa_dsl_pool->dp_meta_objset;
2169
2170 if (spa_dir_prop(spa, DMU_POOL_CONFIG, &spa->spa_config_object) != 0)
2171 return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
2172
2173 if (spa_version(spa) >= SPA_VERSION_FEATURES) {
2174 boolean_t missing_feat_read = B_FALSE;
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

--- 2158 unchanged lines hidden (view full) ---

2167 return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
2168 spa->spa_meta_objset = spa->spa_dsl_pool->dp_meta_objset;
2169
2170 if (spa_dir_prop(spa, DMU_POOL_CONFIG, &spa->spa_config_object) != 0)
2171 return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
2172
2173 if (spa_version(spa) >= SPA_VERSION_FEATURES) {
2174 boolean_t missing_feat_read = B_FALSE;
2175 nvlist_t *unsup_feat;
2175 nvlist_t *unsup_feat, *enabled_feat;
2176
2177 if (spa_dir_prop(spa, DMU_POOL_FEATURES_FOR_READ,
2178 &spa->spa_feat_for_read_obj) != 0) {
2179 return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
2180 }
2181
2182 if (spa_dir_prop(spa, DMU_POOL_FEATURES_FOR_WRITE,
2183 &spa->spa_feat_for_write_obj) != 0) {
2184 return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
2185 }
2186
2187 if (spa_dir_prop(spa, DMU_POOL_FEATURE_DESCRIPTIONS,
2188 &spa->spa_feat_desc_obj) != 0) {
2189 return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
2190 }
2191
2176
2177 if (spa_dir_prop(spa, DMU_POOL_FEATURES_FOR_READ,
2178 &spa->spa_feat_for_read_obj) != 0) {
2179 return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
2180 }
2181
2182 if (spa_dir_prop(spa, DMU_POOL_FEATURES_FOR_WRITE,
2183 &spa->spa_feat_for_write_obj) != 0) {
2184 return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
2185 }
2186
2187 if (spa_dir_prop(spa, DMU_POOL_FEATURE_DESCRIPTIONS,
2188 &spa->spa_feat_desc_obj) != 0) {
2189 return (spa_vdev_err(rvd, VDEV_AUX_CORRUPT_DATA, EIO));
2190 }
2191
2192 VERIFY(nvlist_alloc(&unsup_feat, NV_UNIQUE_NAME, KM_SLEEP) ==
2193 0);
2192 enabled_feat = fnvlist_alloc();
2193 unsup_feat = fnvlist_alloc();
2194
2195 if (!feature_is_supported(spa->spa_meta_objset,
2196 spa->spa_feat_for_read_obj, spa->spa_feat_desc_obj,
2194
2195 if (!feature_is_supported(spa->spa_meta_objset,
2196 spa->spa_feat_for_read_obj, spa->spa_feat_desc_obj,
2197 unsup_feat))
2197 unsup_feat, enabled_feat))
2198 missing_feat_read = B_TRUE;
2199
2200 if (spa_writeable(spa) || state == SPA_LOAD_TRYIMPORT) {
2201 if (!feature_is_supported(spa->spa_meta_objset,
2202 spa->spa_feat_for_write_obj, spa->spa_feat_desc_obj,
2198 missing_feat_read = B_TRUE;
2199
2200 if (spa_writeable(spa) || state == SPA_LOAD_TRYIMPORT) {
2201 if (!feature_is_supported(spa->spa_meta_objset,
2202 spa->spa_feat_for_write_obj, spa->spa_feat_desc_obj,
2203 unsup_feat))
2203 unsup_feat, enabled_feat)) {
2204 missing_feat_write = B_TRUE;
2204 missing_feat_write = B_TRUE;
2205 }
2205 }
2206
2206 }
2207
2208 fnvlist_add_nvlist(spa->spa_load_info,
2209 ZPOOL_CONFIG_ENABLED_FEAT, enabled_feat);
2210
2207 if (!nvlist_empty(unsup_feat)) {
2211 if (!nvlist_empty(unsup_feat)) {
2208 VERIFY(nvlist_add_nvlist(spa->spa_load_info,
2209 ZPOOL_CONFIG_UNSUP_FEAT, unsup_feat) == 0);
2212 fnvlist_add_nvlist(spa->spa_load_info,
2213 ZPOOL_CONFIG_UNSUP_FEAT, unsup_feat);
2210 }
2211
2214 }
2215
2212 nvlist_free(unsup_feat);
2216 fnvlist_free(enabled_feat);
2217 fnvlist_free(unsup_feat);
2213
2214 if (!missing_feat_read) {
2215 fnvlist_add_boolean(spa->spa_load_info,
2216 ZPOOL_CONFIG_CAN_RDONLY);
2217 }
2218
2219 /*
2220 * If the state is SPA_LOAD_TRYIMPORT, our objective is

--- 4151 unchanged lines hidden ---
2218
2219 if (!missing_feat_read) {
2220 fnvlist_add_boolean(spa->spa_load_info,
2221 ZPOOL_CONFIG_CAN_RDONLY);
2222 }
2223
2224 /*
2225 * If the state is SPA_LOAD_TRYIMPORT, our objective is

--- 4151 unchanged lines hidden ---