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

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

574 vdev_set_state(rvd, B_TRUE, VDEV_STATE_CANT_OPEN,
575 VDEV_AUX_CORRUPT_DATA);
576 error = EIO;
577 goto out;
578 }
579
580 if (!mosconfig) {
581 nvlist_t *newconfig;
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

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

574 vdev_set_state(rvd, B_TRUE, VDEV_STATE_CANT_OPEN,
575 VDEV_AUX_CORRUPT_DATA);
576 error = EIO;
577 goto out;
578 }
579
580 if (!mosconfig) {
581 nvlist_t *newconfig;
582 uint64_t hostid;
582
583 if (load_nvlist(spa, spa->spa_config_object, &newconfig) != 0) {
584 vdev_set_state(rvd, B_TRUE, VDEV_STATE_CANT_OPEN,
585 VDEV_AUX_CORRUPT_DATA);
586 error = EIO;
587 goto out;
588 }
589
583
584 if (load_nvlist(spa, spa->spa_config_object, &newconfig) != 0) {
585 vdev_set_state(rvd, B_TRUE, VDEV_STATE_CANT_OPEN,
586 VDEV_AUX_CORRUPT_DATA);
587 error = EIO;
588 goto out;
589 }
590
591 if (nvlist_lookup_uint64(newconfig, ZPOOL_CONFIG_HOSTID,
592 &hostid) == 0) {
593 char *hostname;
594 unsigned long myhostid = 0;
595
596 VERIFY(nvlist_lookup_string(newconfig,
597 ZPOOL_CONFIG_HOSTNAME, &hostname) == 0);
598
599 (void) ddi_strtoul(hw_serial, NULL, 10, &myhostid);
600 if ((unsigned long)hostid != myhostid) {
601 cmn_err(CE_WARN, "pool '%s' could not be "
602 "loaded as it was last accessed by "
603 "another system (host: %s hostid: 0x%lx). "
604 "See: http://www.sun.com/msg/ZFS-8000-EY",
605 spa->spa_name, hostname,
606 (unsigned long)hostid);
607 error = EBADF;
608 goto out;
609 }
610 }
611
590 spa_config_set(spa, newconfig);
591 spa_unload(spa);
592 spa_deactivate(spa);
593 spa_activate(spa);
594
595 return (spa_load(spa, newconfig, state, B_TRUE));
596 }
597

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

1361 if (spa->spa_root_vdev != NULL) {
1362 spa_config_enter(spa, RW_READER, FTAG);
1363 config = spa_config_generate(spa, NULL, -1ULL, B_TRUE);
1364 spa_config_exit(spa, FTAG);
1365 VERIFY(nvlist_add_string(config, ZPOOL_CONFIG_POOL_NAME,
1366 poolname) == 0);
1367 VERIFY(nvlist_add_uint64(config, ZPOOL_CONFIG_POOL_STATE,
1368 state) == 0);
612 spa_config_set(spa, newconfig);
613 spa_unload(spa);
614 spa_deactivate(spa);
615 spa_activate(spa);
616
617 return (spa_load(spa, newconfig, state, B_TRUE));
618 }
619

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

1383 if (spa->spa_root_vdev != NULL) {
1384 spa_config_enter(spa, RW_READER, FTAG);
1385 config = spa_config_generate(spa, NULL, -1ULL, B_TRUE);
1386 spa_config_exit(spa, FTAG);
1387 VERIFY(nvlist_add_string(config, ZPOOL_CONFIG_POOL_NAME,
1388 poolname) == 0);
1389 VERIFY(nvlist_add_uint64(config, ZPOOL_CONFIG_POOL_STATE,
1390 state) == 0);
1391 VERIFY(nvlist_add_uint64(config, ZPOOL_CONFIG_TIMESTAMP,
1392 spa->spa_uberblock.ub_timestamp) == 0);
1369
1370 /*
1371 * Add the list of hot spares.
1372 */
1373 spa_add_spares(spa, config);
1374 }
1375
1376 spa_unload(spa);

--- 1889 unchanged lines hidden ---
1393
1394 /*
1395 * Add the list of hot spares.
1396 */
1397 spa_add_spares(spa, config);
1398 }
1399
1400 spa_unload(spa);

--- 1889 unchanged lines hidden ---