Print this page
6537 Panic on zpool scrub with DEBUG kernel

@@ -19,10 +19,11 @@
  * CDDL HEADER END
  */
 /*
  * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
+ * Copyright 2016 Gary Mills
  */
 
 #include <sys/dsl_scan.h>
 #include <sys/dsl_pool.h>
 #include <sys/dsl_dataset.h>

@@ -1502,11 +1503,12 @@
                  */
                 ddt_sync(spa, tx->tx_txg);
         }
         if (err != 0)
                 return;
-        if (!scn->scn_async_destroying && zfs_free_leak_on_eio &&
+        if (dp->dp_free_dir != NULL && !scn->scn_async_destroying &&
+            zfs_free_leak_on_eio && 
             (dsl_dir_phys(dp->dp_free_dir)->dd_used_bytes != 0 ||
             dsl_dir_phys(dp->dp_free_dir)->dd_compressed_bytes != 0 ||
             dsl_dir_phys(dp->dp_free_dir)->dd_uncompressed_bytes != 0)) {
                 /*
                  * We have finished background destroying, but there is still

@@ -1528,11 +1530,11 @@
                 dsl_dir_diduse_space(dp->dp_free_dir, DD_USED_HEAD,
                     -dsl_dir_phys(dp->dp_free_dir)->dd_used_bytes,
                     -dsl_dir_phys(dp->dp_free_dir)->dd_compressed_bytes,
                     -dsl_dir_phys(dp->dp_free_dir)->dd_uncompressed_bytes, tx);
         }
-        if (!scn->scn_async_destroying) {
+        if (dp->dp_free_dir != NULL && !scn->scn_async_destroying) {
                 /* finished; verify that space accounting went to zero */
                 ASSERT0(dsl_dir_phys(dp->dp_free_dir)->dd_used_bytes);
                 ASSERT0(dsl_dir_phys(dp->dp_free_dir)->dd_compressed_bytes);
                 ASSERT0(dsl_dir_phys(dp->dp_free_dir)->dd_uncompressed_bytes);
         }