diff --git a/include/sys/vdev.h b/include/sys/vdev.h index 7a7c70dc1..d529bbcdd 100644 --- a/include/sys/vdev.h +++ b/include/sys/vdev.h @@ -186,9 +186,8 @@ extern boolean_t vdev_clear_resilver_deferred(vdev_t *vd, dmu_tx_t *tx); typedef enum vdev_config_flag { VDEV_CONFIG_SPARE = 1 << 0, VDEV_CONFIG_L2CACHE = 1 << 1, - VDEV_CONFIG_REMOVING = 1 << 2, - VDEV_CONFIG_MOS = 1 << 3, - VDEV_CONFIG_MISSING = 1 << 4 + VDEV_CONFIG_MOS = 1 << 2, + VDEV_CONFIG_MISSING = 1 << 3 } vdev_config_flag_t; extern void vdev_post_kobj_evt(vdev_t *vd); diff --git a/module/zfs/vdev_label.c b/module/zfs/vdev_label.c index d81bc29f2..f61be65a2 100644 --- a/module/zfs/vdev_label.c +++ b/module/zfs/vdev_label.c @@ -500,7 +500,12 @@ vdev_config_generate(spa_t *spa, vdev_t *vd, boolean_t getstats, fnvlist_add_uint64(nv, ZPOOL_CONFIG_NONALLOCATING, vd->vdev_noalloc); } - if (vd->vdev_removing) { + + /* + * Slog devices are removed synchronously so don't + * persist the vdev_removing flag to the label. + */ + if (vd->vdev_removing && !vd->vdev_islog) { fnvlist_add_uint64(nv, ZPOOL_CONFIG_REMOVING, vd->vdev_removing); } @@ -644,35 +649,22 @@ vdev_config_generate(spa_t *spa, vdev_t *vd, boolean_t getstats, if (!vd->vdev_ops->vdev_op_leaf) { nvlist_t **child; - int c, idx; + uint64_t c; ASSERT(!vd->vdev_ishole); child = kmem_alloc(vd->vdev_children * sizeof (nvlist_t *), KM_SLEEP); - for (c = 0, idx = 0; c < vd->vdev_children; c++) { - vdev_t *cvd = vd->vdev_child[c]; - - /* - * If we're generating an nvlist of removing - * vdevs then skip over any device which is - * not being removed. - */ - if ((flags & VDEV_CONFIG_REMOVING) && - !cvd->vdev_removing) - continue; - - child[idx++] = vdev_config_generate(spa, cvd, + for (c = 0; c < vd->vdev_children; c++) { + child[c] = vdev_config_generate(spa, vd->vdev_child[c], getstats, flags); } - if (idx) { - fnvlist_add_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, - (const nvlist_t * const *)child, idx); - } + fnvlist_add_nvlist_array(nv, ZPOOL_CONFIG_CHILDREN, + (const nvlist_t * const *)child, vd->vdev_children); - for (c = 0; c < idx; c++) + for (c = 0; c < vd->vdev_children; c++) nvlist_free(child[c]); kmem_free(child, vd->vdev_children * sizeof (nvlist_t *));