Print this page
3949 ztest fault injection should avoid resilvering devices
3950 ztest: deadman fires when we're doing a scan
3951 ztest hang when running dedup test
3952 ztest: ztest_reguid test and ztest_fault_inject don't place nice together
Reviewed by: Matthew Ahrens <mahrens@delphix.com>
Reviewed by: Adam Leventhal <ahl@delphix.com>

Split Close
Expand all
Collapse all
          --- old/usr/src/uts/common/fs/zfs/spa.c
          +++ new/usr/src/uts/common/fs/zfs/spa.c
↓ open down ↓ 749 lines elided ↑ open up ↑
 750  750   * online when we do this, or else any vdevs that weren't present
 751  751   * would be orphaned from our pool.  We are also going to issue a
 752  752   * sysevent to update any watchers.
 753  753   */
 754  754  int
 755  755  spa_change_guid(spa_t *spa)
 756  756  {
 757  757          int error;
 758  758          uint64_t guid;
 759  759  
      760 +        mutex_enter(&spa->spa_vdev_top_lock);
 760  761          mutex_enter(&spa_namespace_lock);
 761  762          guid = spa_generate_guid(NULL);
 762  763  
 763  764          error = dsl_sync_task(spa->spa_name, spa_change_guid_check,
 764  765              spa_change_guid_sync, &guid, 5);
 765  766  
 766  767          if (error == 0) {
 767  768                  spa_config_sync(spa, B_FALSE, B_TRUE);
 768  769                  spa_event_notify(spa, NULL, ESC_ZFS_POOL_REGUID);
 769  770          }
 770  771  
 771  772          mutex_exit(&spa_namespace_lock);
      773 +        mutex_exit(&spa->spa_vdev_top_lock);
 772  774  
 773  775          return (error);
 774  776  }
 775  777  
 776  778  /*
 777  779   * ==========================================================================
 778  780   * SPA state manipulation (open/create/destroy/import/export)
 779  781   * ==========================================================================
 780  782   */
 781  783  
↓ open down ↓ 3885 lines elided ↑ open up ↑
4667 4669          }
4668 4670  
4669 4671          /*
4670 4672           * If the parent mirror/replacing vdev only has one child,
4671 4673           * the parent is no longer needed.  Remove it from the tree.
4672 4674           */
4673 4675          if (pvd->vdev_children == 1) {
4674 4676                  if (pvd->vdev_ops == &vdev_spare_ops)
4675 4677                          cvd->vdev_unspare = B_FALSE;
4676 4678                  vdev_remove_parent(cvd);
4677      -                cvd->vdev_resilvering = B_FALSE;
4678 4679          }
4679 4680  
4680 4681  
4681 4682          /*
4682 4683           * We don't set tvd until now because the parent we just removed
4683 4684           * may have been the previous top-level vdev.
4684 4685           */
4685 4686          tvd = cvd->vdev_top;
4686 4687          ASSERT(tvd->vdev_parent == rvd);
4687 4688  
↓ open down ↓ 607 lines elided ↑ open up ↑
5295 5296  spa_vdev_resilver_done_hunt(vdev_t *vd)
5296 5297  {
5297 5298          vdev_t *newvd, *oldvd;
5298 5299  
5299 5300          for (int c = 0; c < vd->vdev_children; c++) {
5300 5301                  oldvd = spa_vdev_resilver_done_hunt(vd->vdev_child[c]);
5301 5302                  if (oldvd != NULL)
5302 5303                          return (oldvd);
5303 5304          }
5304 5305  
     5306 +        if (vd->vdev_resilvering && vdev_dtl_empty(vd, DTL_MISSING) &&
     5307 +            vdev_dtl_empty(vd, DTL_OUTAGE)) {
     5308 +                ASSERT(vd->vdev_ops->vdev_op_leaf);
     5309 +                vd->vdev_resilvering = B_FALSE;
     5310 +                vdev_config_dirty(vd->vdev_top);
     5311 +        }
     5312 +
5305 5313          /*
5306 5314           * Check for a completed replacement.  We always consider the first
5307 5315           * vdev in the list to be the oldest vdev, and the last one to be
5308 5316           * the newest (see spa_vdev_attach() for how that works).  In
5309 5317           * the case where the newest vdev is faulted, we will not automatically
5310 5318           * remove it after a resilver completes.  This is OK as it will require
5311 5319           * user intervention to determine which disk the admin wishes to keep.
5312 5320           */
5313 5321          if (vd->vdev_ops == &vdev_replacing_ops) {
5314 5322                  ASSERT(vd->vdev_children > 1);
↓ open down ↓ 1183 lines elided ↑ open up ↑
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX