]> granicus.if.org Git - zfs/commitdiff
Illumos 6292 - exporting a pool while an async destroy
authorGeorge Wilson <george.wilson@delphix.com>
Wed, 4 Nov 2015 20:12:40 +0000 (21:12 +0100)
committerBrian Behlendorf <behlendorf1@llnl.gov>
Tue, 12 Jan 2016 17:10:52 +0000 (09:10 -0800)
6292 exporting a pool while an async destroy is running can leave
entries in the deferred tree
Reviewed by: Paul Dagnelie <pcd@delphix.com>
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Andriy Gapon <avg@FreeBSD.org>
Reviewed by: Fabian Keil <fk@fabiankeil.de>
Approved by: Gordon Ross <gordon.ross@nexenta.com>

References:
  https://www.illumos.org/issues/6292
  https://github.com/illumos/illumos-gate/commit/a443cc8

Ported-by: kernelOfTruth kerneloftruth@gmail.com
Signed-off-by: Brian Behlendorf <behlendorf1@llnl.gov>
module/zfs/dsl_scan.c

index 295b8df8bf441285511fe59709134d9d7cf84c8b..477da2a5f1c3f98c28f855b95728fbd817351b8d 100644 (file)
@@ -1470,11 +1470,24 @@ dsl_scan_sync(dsl_pool_t *dp, dmu_tx_t *tx)
                dsl_scan_setup_sync(&func, tx);
        }
 
+       /*
+        * Only process scans in sync pass 1.
+        */
+       if (spa_sync_pass(dp->dp_spa) > 1)
+               return;
+
+       /*
+        * If the spa is shutting down, then stop scanning. This will
+        * ensure that the scan does not dirty any new data during the
+        * shutdown phase.
+        */
+       if (spa_shutting_down(spa))
+               return;
+
        /*
         * If the scan is inactive due to a stalled async destroy, try again.
         */
-       if ((!scn->scn_async_stalled && !dsl_scan_active(scn)) ||
-           spa_sync_pass(dp->dp_spa) > 1)
+       if (!scn->scn_async_stalled && !dsl_scan_active(scn))
                return;
 
        scn->scn_visited_this_txg = 0;