Print this page
6537 Panic on zpool scrub with DEBUG kernel

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/dsl_scan.c
          +++ new/usr/src/uts/common/fs/zfs/dsl_scan.c
↓ open down ↓ 13 lines elided ↑ open up ↑
  14   14   * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
  15   15   * If applicable, add the following below this CDDL HEADER, with the
  16   16   * fields enclosed by brackets "[]" replaced with your own identifying
  17   17   * information: Portions Copyright [yyyy] [name of copyright owner]
  18   18   *
  19   19   * CDDL HEADER END
  20   20   */
  21   21  /*
  22   22   * Copyright (c) 2008, 2010, Oracle and/or its affiliates. All rights reserved.
  23   23   * Copyright (c) 2011, 2015 by Delphix. All rights reserved.
       24 + * Copyright 2016 Gary Mills
  24   25   */
  25   26  
  26   27  #include <sys/dsl_scan.h>
  27   28  #include <sys/dsl_pool.h>
  28   29  #include <sys/dsl_dataset.h>
  29   30  #include <sys/dsl_prop.h>
  30   31  #include <sys/dsl_dir.h>
  31   32  #include <sys/dsl_synctask.h>
  32   33  #include <sys/dnode.h>
  33   34  #include <sys/dmu_tx.h>
↓ open down ↓ 1463 lines elided ↑ open up ↑
1497 1498  
1498 1499                  /*
1499 1500                   * Write out changes to the DDT that may be required as a
1500 1501                   * result of the blocks freed.  This ensures that the DDT
1501 1502                   * is clean when a scrub/resilver runs.
1502 1503                   */
1503 1504                  ddt_sync(spa, tx->tx_txg);
1504 1505          }
1505 1506          if (err != 0)
1506 1507                  return;
1507      -        if (!scn->scn_async_destroying && zfs_free_leak_on_eio &&
     1508 +        if (dp->dp_free_dir != NULL && !scn->scn_async_destroying &&
     1509 +            zfs_free_leak_on_eio && 
1508 1510              (dsl_dir_phys(dp->dp_free_dir)->dd_used_bytes != 0 ||
1509 1511              dsl_dir_phys(dp->dp_free_dir)->dd_compressed_bytes != 0 ||
1510 1512              dsl_dir_phys(dp->dp_free_dir)->dd_uncompressed_bytes != 0)) {
1511 1513                  /*
1512 1514                   * We have finished background destroying, but there is still
1513 1515                   * some space left in the dp_free_dir. Transfer this leaked
1514 1516                   * space to the dp_leak_dir.
1515 1517                   */
1516 1518                  if (dp->dp_leak_dir == NULL) {
1517 1519                          rrw_enter(&dp->dp_config_rwlock, RW_WRITER, FTAG);
↓ open down ↓ 5 lines elided ↑ open up ↑
1523 1525                  }
1524 1526                  dsl_dir_diduse_space(dp->dp_leak_dir, DD_USED_HEAD,
1525 1527                      dsl_dir_phys(dp->dp_free_dir)->dd_used_bytes,
1526 1528                      dsl_dir_phys(dp->dp_free_dir)->dd_compressed_bytes,
1527 1529                      dsl_dir_phys(dp->dp_free_dir)->dd_uncompressed_bytes, tx);
1528 1530                  dsl_dir_diduse_space(dp->dp_free_dir, DD_USED_HEAD,
1529 1531                      -dsl_dir_phys(dp->dp_free_dir)->dd_used_bytes,
1530 1532                      -dsl_dir_phys(dp->dp_free_dir)->dd_compressed_bytes,
1531 1533                      -dsl_dir_phys(dp->dp_free_dir)->dd_uncompressed_bytes, tx);
1532 1534          }
1533      -        if (!scn->scn_async_destroying) {
     1535 +        if (dp->dp_free_dir != NULL && !scn->scn_async_destroying) {
1534 1536                  /* finished; verify that space accounting went to zero */
1535 1537                  ASSERT0(dsl_dir_phys(dp->dp_free_dir)->dd_used_bytes);
1536 1538                  ASSERT0(dsl_dir_phys(dp->dp_free_dir)->dd_compressed_bytes);
1537 1539                  ASSERT0(dsl_dir_phys(dp->dp_free_dir)->dd_uncompressed_bytes);
1538 1540          }
1539 1541  
1540 1542          if (scn->scn_phys.scn_state != DSS_SCANNING)
1541 1543                  return;
1542 1544  
1543 1545          if (scn->scn_done_txg == tx->tx_txg) {
↓ open down ↓ 273 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX