Report MMP_STATE_NO_HOSTID immediately

There is no need to perform the activity check before detecting that the
user must set the system hostid, because the pool's multihost property
is on, but spa_get_hostid() returned 0.  The initial call to
vdev_uberblock_load() provided the information required.

Reviewed-by: Giuseppe Di Natale <dinatale2@llnl.gov>
Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov>
Signed-off-by: Olaf Faaland <faaland1@llnl.gov>
Closes #6388
This commit is contained in:
Olaf Faaland 2017-07-14 18:15:00 -07:00 committed by Brian Behlendorf
parent 0582e40322
commit e889f0f520
2 changed files with 9 additions and 9 deletions

View File

@ -2653,12 +2653,6 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
*/ */
activity_check = spa_activity_check_required(spa, ub, config); activity_check = spa_activity_check_required(spa, ub, config);
if (activity_check) { if (activity_check) {
error = spa_activity_check(spa, ub, config);
if (error) {
nvlist_free(label);
return (error);
}
if (ub->ub_mmp_magic == MMP_MAGIC && ub->ub_mmp_delay && if (ub->ub_mmp_magic == MMP_MAGIC && ub->ub_mmp_delay &&
spa_get_hostid() == 0) { spa_get_hostid() == 0) {
nvlist_free(label); nvlist_free(label);
@ -2667,6 +2661,12 @@ spa_load_impl(spa_t *spa, uint64_t pool_guid, nvlist_t *config,
return (spa_vdev_err(rvd, VDEV_AUX_ACTIVE, EREMOTEIO)); return (spa_vdev_err(rvd, VDEV_AUX_ACTIVE, EREMOTEIO));
} }
error = spa_activity_check(spa, ub, config);
if (error) {
nvlist_free(label);
return (error);
}
fnvlist_add_uint64(spa->spa_load_info, fnvlist_add_uint64(spa->spa_load_info,
ZPOOL_CONFIG_MMP_STATE, MMP_STATE_INACTIVE); ZPOOL_CONFIG_MMP_STATE, MMP_STATE_INACTIVE);
fnvlist_add_uint64(spa->spa_load_info, fnvlist_add_uint64(spa->spa_load_info,

View File

@ -28,7 +28,7 @@
# 4. Verify multihost=off and hostid allowed (no activity check) # 4. Verify multihost=off and hostid allowed (no activity check)
# 5. Verify multihost=on and hostids match (no activity check) # 5. Verify multihost=on and hostids match (no activity check)
# 6. Verify multihost=on and hostids differ (activity check) # 6. Verify multihost=on and hostids differ (activity check)
# 7. Verify multihost=on and hostid zero fails (activity check) # 7. Verify multihost=on and hostid zero fails (no activity check)
# #
. $STF_SUITE/include/libtest.shlib . $STF_SUITE/include/libtest.shlib
@ -87,11 +87,11 @@ log_must mmp_set_hostid $HOSTID2
log_mustnot import_activity_check $TESTPOOL "" log_mustnot import_activity_check $TESTPOOL ""
log_must import_activity_check $TESTPOOL "-f" log_must import_activity_check $TESTPOOL "-f"
# 7. Verify multihost=on and hostid zero fails (activity check) # 7. Verify multihost=on and hostid zero fails (no activity check)
log_must zpool export -F $TESTPOOL log_must zpool export -F $TESTPOOL
log_must mmp_clear_hostid log_must mmp_clear_hostid
MMP_IMPORTED_MSG="Set the system hostid" MMP_IMPORTED_MSG="Set the system hostid"
log_must check_pool_import $TESTPOOL "-f" "action" $MMP_IMPORTED_MSG log_must check_pool_import $TESTPOOL "-f" "action" $MMP_IMPORTED_MSG
log_mustnot import_activity_check $TESTPOOL "-f" log_mustnot import_no_activity_check $TESTPOOL "-f"
log_pass "multihost=on|off inactive pool activity checks passed" log_pass "multihost=on|off inactive pool activity checks passed"