Print this page
5269 zfs: zpool import slow
PORTING: this code relies on the property of taskq_wait to wait
until no more tasks are queued and no more tasks are active. As
we always queue new tasks from within other tasks, task_wait
reliably waits for the full recursion to finish, even though we
enqueue new tasks after taskq_wait has been called.
On platforms other than illumos, taskq_wait may not have this
property.
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Dan McDonald <danmcd@omniti.com>
Reviewed by: George Wilson <george.wilson@delphix.com>

@@ -1736,17 +1736,18 @@
  */
 static boolean_t
 spa_check_logs(spa_t *spa)
 {
         boolean_t rv = B_FALSE;
+        dsl_pool_t *dp = spa_get_dsl(spa);
 
         switch (spa->spa_log_state) {
         case SPA_LOG_MISSING:
                 /* need to recheck in case slog has been restored */
         case SPA_LOG_UNKNOWN:
-                rv = (dmu_objset_find(spa->spa_name, zil_check_log_chain,
-                    NULL, DS_FIND_CHILDREN) != 0);
+                rv = (dmu_objset_find_dp(dp, dp->dp_root_dir_obj,
+                    zil_check_log_chain, NULL, DS_FIND_CHILDREN) != 0);
                 if (rv)
                         spa_set_log_state(spa, SPA_LOG_MISSING);
                 break;
         }
         return (rv);

@@ -2713,10 +2714,11 @@
 
         if (spa_writeable(spa) && (state == SPA_LOAD_RECOVER ||
             spa->spa_load_max_txg == UINT64_MAX)) {
                 dmu_tx_t *tx;
                 int need_update = B_FALSE;
+                dsl_pool_t *dp = spa_get_dsl(spa);
 
                 ASSERT(state != SPA_LOAD_TRYIMPORT);
 
                 /*
                  * Claim log blocks that haven't been committed yet.

@@ -2725,13 +2727,12 @@
                  * invoked from zil_claim_log_block()'s i/o done callback.
                  * Price of rollback is that we abandon the log.
                  */
                 spa->spa_claiming = B_TRUE;
 
-                tx = dmu_tx_create_assigned(spa_get_dsl(spa),
-                    spa_first_txg(spa));
-                (void) dmu_objset_find(spa_name(spa),
+                tx = dmu_tx_create_assigned(dp, spa_first_txg(spa));
+                (void) dmu_objset_find_dp(dp, dp->dp_root_dir_obj,
                     zil_claim, tx, DS_FIND_CHILDREN);
                 dmu_tx_commit(tx);
 
                 spa->spa_claiming = B_FALSE;