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>
        
*** 755,764 ****
--- 755,765 ----
  spa_change_guid(spa_t *spa)
  {
          int error;
          uint64_t guid;
  
+         mutex_enter(&spa->spa_vdev_top_lock);
          mutex_enter(&spa_namespace_lock);
          guid = spa_generate_guid(NULL);
  
          error = dsl_sync_task(spa->spa_name, spa_change_guid_check,
              spa_change_guid_sync, &guid, 5);
*** 767,776 ****
--- 768,778 ----
                  spa_config_sync(spa, B_FALSE, B_TRUE);
                  spa_event_notify(spa, NULL, ESC_ZFS_POOL_REGUID);
          }
  
          mutex_exit(&spa_namespace_lock);
+         mutex_exit(&spa->spa_vdev_top_lock);
  
          return (error);
  }
  
  /*
*** 4672,4682 ****
           */
          if (pvd->vdev_children == 1) {
                  if (pvd->vdev_ops == &vdev_spare_ops)
                          cvd->vdev_unspare = B_FALSE;
                  vdev_remove_parent(cvd);
-                 cvd->vdev_resilvering = B_FALSE;
          }
  
  
          /*
           * We don't set tvd until now because the parent we just removed
--- 4674,4683 ----
*** 5300,5309 ****
--- 5301,5317 ----
                  oldvd = spa_vdev_resilver_done_hunt(vd->vdev_child[c]);
                  if (oldvd != NULL)
                          return (oldvd);
          }
  
+         if (vd->vdev_resilvering && vdev_dtl_empty(vd, DTL_MISSING) &&
+             vdev_dtl_empty(vd, DTL_OUTAGE)) {
+                 ASSERT(vd->vdev_ops->vdev_op_leaf);
+                 vd->vdev_resilvering = B_FALSE;
+                 vdev_config_dirty(vd->vdev_top);
+         }
+ 
          /*
           * Check for a completed replacement.  We always consider the first
           * vdev in the list to be the oldest vdev, and the last one to be
           * the newest (see spa_vdev_attach() for how that works).  In
           * the case where the newest vdev is faulted, we will not automatically