3246 ZFS I/O deadman thread
[zfs.git] / module / zfs / spa.c
index 5b6465f..0d3537e 100644 (file)
@@ -1013,6 +1013,8 @@ spa_deactivate(spa_t *spa)
        list_destroy(&spa->spa_config_dirty_list);
        list_destroy(&spa->spa_state_dirty_list);
 
+       taskq_cancel_id(system_taskq, spa->spa_deadman_tqid);
+
        for (t = 0; t < ZIO_TYPES; t++) {
                for (q = 0; q < ZIO_TASKQ_TYPES; q++) {
                        if (spa->spa_zio_taskq[t][q] != NULL)
@@ -5770,7 +5772,7 @@ spa_sync_version(void *arg1, void *arg2, dmu_tx_t *tx)
         */
        ASSERT(tx->tx_txg != TXG_INITIAL);
 
-       ASSERT(version <= SPA_VERSION);
+       ASSERT(SPA_VERSION_IS_SUPPORTED(version));
        ASSERT(version >= spa_version(spa));
 
        spa->spa_uberblock.ub_version = version;
@@ -6017,6 +6019,12 @@ spa_sync(spa_t *spa, uint64_t txg)
 
        tx = dmu_tx_create_assigned(dp, txg);
 
+       spa->spa_sync_starttime = gethrtime();
+       taskq_cancel_id(system_taskq, spa->spa_deadman_tqid);
+       spa->spa_deadman_tqid = taskq_dispatch_delay(system_taskq,
+           spa_deadman, spa, TQ_SLEEP, ddi_get_lbolt() +
+           NSEC_TO_TICK(spa->spa_deadman_synctime));
+
        /*
         * If we are upgrading to SPA_VERSION_RAIDZ_DEFLATE this txg,
         * set spa_deflate if we have no raid-z vdevs.
@@ -6145,6 +6153,9 @@ spa_sync(spa_t *spa, uint64_t txg)
        }
        dmu_tx_commit(tx);
 
+       taskq_cancel_id(system_taskq, spa->spa_deadman_tqid);
+       spa->spa_deadman_tqid = 0;
+
        /*
         * Clear the dirty config list.
         */
@@ -6294,7 +6305,7 @@ spa_upgrade(spa_t *spa, uint64_t version)
         * future version would result in an unopenable pool, this shouldn't be
         * possible.
         */
-       ASSERT(spa->spa_uberblock.ub_version <= SPA_VERSION);
+       ASSERT(SPA_VERSION_IS_SUPPORTED(spa->spa_uberblock.ub_version));
        ASSERT(version >= spa->spa_uberblock.ub_version);
 
        spa->spa_uberblock.ub_version = version;