diff --git a/include/sys/vdev_rebuild.h b/include/sys/vdev_rebuild.h index 17ed94dd9..51e669c2c 100644 --- a/include/sys/vdev_rebuild.h +++ b/include/sys/vdev_rebuild.h @@ -90,7 +90,7 @@ typedef struct vdev_rebuild { boolean_t vdev_rebuild_active(vdev_t *); int vdev_rebuild_load(vdev_t *); -void vdev_rebuild(vdev_t *); +void vdev_rebuild(vdev_t *, uint64_t); void vdev_rebuild_stop_wait(vdev_t *); void vdev_rebuild_stop_all(spa_t *); void vdev_rebuild_restart(spa_t *); diff --git a/module/zfs/spa.c b/module/zfs/spa.c index 386394e09..843b1b9d6 100644 --- a/module/zfs/spa.c +++ b/module/zfs/spa.c @@ -8484,7 +8484,7 @@ spa_vdev_attach(spa_t *spa, uint64_t guid, nvlist_t *nvroot, int replacing, if (rebuild) { newvd->vdev_rebuild_txg = txg; - vdev_rebuild(tvd); + vdev_rebuild(tvd, txg); } else { newvd->vdev_resilver_txg = txg; diff --git a/module/zfs/vdev_rebuild.c b/module/zfs/vdev_rebuild.c index 30be1f851..0e14d29d7 100644 --- a/module/zfs/vdev_rebuild.c +++ b/module/zfs/vdev_rebuild.c @@ -278,7 +278,7 @@ vdev_rebuild_log_notify(spa_t *spa, vdev_t *vd, const char *name) * active for the duration of the rebuild, then revert to the enabled state. */ static void -vdev_rebuild_initiate(vdev_t *vd) +vdev_rebuild_initiate(vdev_t *vd, uint64_t txg) { spa_t *spa = vd->vdev_spa; @@ -286,8 +286,7 @@ vdev_rebuild_initiate(vdev_t *vd) ASSERT(MUTEX_HELD(&vd->vdev_rebuild_lock)); ASSERT(!vd->vdev_rebuilding); - dmu_tx_t *tx = dmu_tx_create_dd(spa_get_dsl(spa)->dp_mos_dir); - VERIFY0(dmu_tx_assign(tx, DMU_TX_WAIT | DMU_TX_SUSPEND)); + dmu_tx_t *tx = dmu_tx_create_assigned(spa_get_dsl(spa), txg); vd->vdev_rebuilding = B_TRUE; @@ -1015,7 +1014,7 @@ vdev_rebuild_active(vdev_t *vd) * top-level vdev is currently actively rebuilding. */ void -vdev_rebuild(vdev_t *vd) +vdev_rebuild(vdev_t *vd, uint64_t txg) { vdev_rebuild_t *vr = &vd->vdev_rebuild_config; vdev_rebuild_phys_t *vrp __maybe_unused = &vr->vr_rebuild_phys; @@ -1039,7 +1038,7 @@ vdev_rebuild(vdev_t *vd) if (!vd->vdev_rebuild_reset_wanted) vd->vdev_rebuild_reset_wanted = B_TRUE; } else { - vdev_rebuild_initiate(vd); + vdev_rebuild_initiate(vd, txg); } mutex_exit(&vd->vdev_rebuild_lock); }