usr/src/uts/common/fs/zfs/vdev.c
changeset 13700 2889e2596bd6
parent 13680 2bd022a765e2
child 13764 38b4aca480b3
equal deleted inserted replaced
13699:733714f4dc24 13700:2889e2596bd6
  1326 	 */
  1326 	 */
  1327 	if (vd->vdev_ops->vdev_op_leaf && vdev_readable(vd)) {
  1327 	if (vd->vdev_ops->vdev_op_leaf && vdev_readable(vd)) {
  1328 		uint64_t aux_guid = 0;
  1328 		uint64_t aux_guid = 0;
  1329 		nvlist_t *nvl;
  1329 		nvlist_t *nvl;
  1330 
  1330 
  1331 		if ((label = vdev_label_read_config(vd)) == NULL) {
  1331 		if ((label = vdev_label_read_config(vd, VDEV_BEST_LABEL)) ==
       
  1332 		    NULL) {
  1332 			vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN,
  1333 			vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN,
  1333 			    VDEV_AUX_BAD_LABEL);
  1334 			    VDEV_AUX_BAD_LABEL);
  1334 			return (0);
  1335 			return (0);
  1335 		}
  1336 		}
  1336 
  1337 
  1967 	uint64_t state;
  1968 	uint64_t state;
  1968 
  1969 
  1969 	if (!vdev_readable(vd))
  1970 	if (!vdev_readable(vd))
  1970 		return (0);
  1971 		return (0);
  1971 
  1972 
  1972 	if ((label = vdev_label_read_config(vd)) == NULL) {
  1973 	if ((label = vdev_label_read_config(vd, VDEV_BEST_LABEL)) == NULL) {
  1973 		vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN,
  1974 		vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN,
  1974 		    VDEV_AUX_CORRUPT_DATA);
  1975 		    VDEV_AUX_CORRUPT_DATA);
  1975 		return (-1);
  1976 		return (-1);
  1976 	}
  1977 	}
  1977 
  1978 
  1978 	if (nvlist_lookup_uint64(label, ZPOOL_CONFIG_VERSION, &version) != 0 ||
  1979 	if (nvlist_lookup_uint64(label, ZPOOL_CONFIG_VERSION, &version) != 0 ||
  1979 	    version > SPA_VERSION ||
  1980 	    !SPA_VERSION_IS_SUPPORTED(version) ||
  1980 	    nvlist_lookup_uint64(label, ZPOOL_CONFIG_GUID, &guid) != 0 ||
  1981 	    nvlist_lookup_uint64(label, ZPOOL_CONFIG_GUID, &guid) != 0 ||
  1981 	    guid != vd->vdev_guid ||
  1982 	    guid != vd->vdev_guid ||
  1982 	    nvlist_lookup_uint64(label, ZPOOL_CONFIG_POOL_STATE, &state) != 0) {
  1983 	    nvlist_lookup_uint64(label, ZPOOL_CONFIG_POOL_STATE, &state) != 0) {
  1983 		vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN,
  1984 		vdev_set_state(vd, B_TRUE, VDEV_STATE_CANT_OPEN,
  1984 		    VDEV_AUX_CORRUPT_DATA);
  1985 		    VDEV_AUX_CORRUPT_DATA);