]> git.proxmox.com Git - mirror_zfs.git/commitdiff
Report MMP_STATE_NO_HOSTID immediately
authorOlaf Faaland <faaland1@llnl.gov>
Sat, 15 Jul 2017 01:15:00 +0000 (18:15 -0700)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 25 Jul 2017 17:22:28 +0000 (13:22 -0400)
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

module/zfs/spa.c
tests/zfs-tests/tests/functional/mmp/mmp_inactive_import.ksh

index f576293ebf3c3d21493f2c5b79ff0bd3ffdbd4e4..f1f1444f1c94587a41213f7e1c06016ffa4bdf4a 100644 (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);
        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 &&
                    spa_get_hostid() == 0) {
                        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));
                }
 
+               error = spa_activity_check(spa, ub, config);
+               if (error) {
+                       nvlist_free(label);
+                       return (error);
+               }
+
                fnvlist_add_uint64(spa->spa_load_info,
                    ZPOOL_CONFIG_MMP_STATE, MMP_STATE_INACTIVE);
                fnvlist_add_uint64(spa->spa_load_info,
index 71f3af5c50575f704a3c154f9b48180d4fd85877..78ae5f614aaf2ed22cb52cabeb7da6b3894cd286 100755 (executable)
@@ -28,7 +28,7 @@
 #      4. Verify multihost=off and hostid allowed (no activity check)
 #      5. Verify multihost=on and hostids match (no 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
@@ -87,11 +87,11 @@ log_must mmp_set_hostid $HOSTID2
 log_mustnot import_activity_check $TESTPOOL ""
 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 mmp_clear_hostid
 MMP_IMPORTED_MSG="Set the system hostid"
 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"