diff options
author | Alexander Motin <mav@FreeBSD.org> | 2019-06-03 17:13:35 +0000 |
---|---|---|
committer | Alexander Motin <mav@FreeBSD.org> | 2019-06-03 17:13:35 +0000 |
commit | e5cd1b9d0706ad0124bf40f99dad7a62e3e4f449 (patch) | |
tree | 23270394e4f294799c9a61df1f37788e2d1d8a3e /uts | |
parent | 08bd25db92d3e52e2eae5d5dc3a0fc04ae970164 (diff) | |
download | src-e5cd1b9d0706ad0124bf40f99dad7a62e3e4f449.tar.gz src-e5cd1b9d0706ad0124bf40f99dad7a62e3e4f449.zip |
9690 metaslab of vdev with no space maps was flushed during removal
illumos/illumos-gate@4e75ba682600b2bf19d158577d528c3db65050e8
Reviewed by: Matt Ahrens <matt@delphix.com>
Reviewed by: Brad Lewis <brad.lewis@delphix.com>
Approved by: Robert Mustacchi <rm@joyent.com>
Author: Serapheim Dimitropoulos <serapheim@delphix.com>
Notes
Notes:
svn path=/vendor-sys/illumos/dist/; revision=348555
Diffstat (limited to 'uts')
-rw-r--r-- | uts/common/fs/zfs/vdev.c | 22 |
1 files changed, 10 insertions, 12 deletions
diff --git a/uts/common/fs/zfs/vdev.c b/uts/common/fs/zfs/vdev.c index f6845f3dcbbd..27d1dcf97f5b 100644 --- a/uts/common/fs/zfs/vdev.c +++ b/uts/common/fs/zfs/vdev.c @@ -2823,11 +2823,11 @@ vdev_destroy_spacemaps(vdev_t *vd, dmu_tx_t *tx) } static void -vdev_remove_empty(vdev_t *vd, uint64_t txg) +vdev_remove_empty_log(vdev_t *vd, uint64_t txg) { spa_t *spa = vd->vdev_spa; - dmu_tx_t *tx; + ASSERT(vd->vdev_islog); ASSERT(vd == vd->vdev_top); ASSERT3U(txg, ==, spa_syncing_txg(spa)); @@ -2871,13 +2871,14 @@ vdev_remove_empty(vdev_t *vd, uint64_t txg) ASSERT0(mg->mg_histogram[i]); } - tx = dmu_tx_create_assigned(spa_get_dsl(spa), txg); - vdev_destroy_spacemaps(vd, tx); + dmu_tx_t *tx = dmu_tx_create_assigned(spa_get_dsl(spa), txg); - if (vd->vdev_islog && vd->vdev_top_zap != 0) { + vdev_destroy_spacemaps(vd, tx); + if (vd->vdev_top_zap != 0) { vdev_destroy_unlink_zap(vd, vd->vdev_top_zap, tx); vd->vdev_top_zap = 0; } + dmu_tx_commit(tx); } @@ -2949,14 +2950,11 @@ vdev_sync(vdev_t *vd, uint64_t txg) vdev_dtl_sync(lvd, txg); /* - * Remove the metadata associated with this vdev once it's empty. - * Note that this is typically used for log/cache device removal; - * we don't empty toplevel vdevs when removing them. But if - * a toplevel happens to be emptied, this is not harmful. + * If this is an empty log device being removed, destroy the + * metadata associated with it. */ - if (vd->vdev_stat.vs_alloc == 0 && vd->vdev_removing) { - vdev_remove_empty(vd, txg); - } + if (vd->vdev_islog && vd->vdev_stat.vs_alloc == 0 && vd->vdev_removing) + vdev_remove_empty_log(vd, txg); (void) txg_list_add(&spa->spa_vdev_txg_list, vd, TXG_CLEAN(txg)); } |