From 833a287337262306ec525e7861ddc067ea4d82a1 Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Sat, 7 May 2011 13:32:05 +0000 Subject: [PATCH] Make vg_mark_partial_lvs also clear existing PARTIAL_LV flags, so it can be issued repeatedly on the same VG, keeping the PARTIAL_LV flags up to date. --- lib/metadata/metadata-exported.h | 2 ++ lib/metadata/metadata.c | 13 +++++++++---- lib/metadata/metadata.h | 1 - lib/mirror/mirrored.c | 2 +- 4 files changed, 12 insertions(+), 6 deletions(-) diff --git a/lib/metadata/metadata-exported.h b/lib/metadata/metadata-exported.h index 331dd74af..155eb7dc0 100644 --- a/lib/metadata/metadata-exported.h +++ b/lib/metadata/metadata-exported.h @@ -763,6 +763,8 @@ int vg_check_write_mode(struct volume_group *vg); int lv_has_unknown_segments(const struct logical_volume *lv); int vg_has_unknown_segments(const struct volume_group *vg); +int vg_mark_partial_lvs(struct volume_group *vg, int clear); + struct vgcreate_params { const char *vg_name; uint32_t extent_size; diff --git a/lib/metadata/metadata.c b/lib/metadata/metadata.c index 9668102f2..756ed6044 100644 --- a/lib/metadata/metadata.c +++ b/lib/metadata/metadata.c @@ -2138,11 +2138,16 @@ static int _lv_mark_if_partial_single(struct logical_volume *lv, void *data) * propagated transitively, so LVs referencing other LVs are marked * partial as well, if any of their referenced LVs are marked partial. */ -int vg_mark_partial_lvs(struct volume_group *vg) +int vg_mark_partial_lvs(struct volume_group *vg, int clear) { + struct lv_list *lvl; + + if (clear) + dm_list_iterate_items(lvl, &vg->lvs) + lvl->lv->status &= ~PARTIAL_LV; + if (!_lv_postorder_vg(vg, _lv_mark_if_partial_single, NULL)) return_0; - return 1; } @@ -2825,7 +2830,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd, if (vg_missing_pv_count(correct_vg)) { log_verbose("There are %d physical volumes missing.", vg_missing_pv_count(correct_vg)); - vg_mark_partial_lvs(correct_vg); + vg_mark_partial_lvs(correct_vg, 1); } return correct_vg; } else { @@ -3179,7 +3184,7 @@ static struct volume_group *_vg_read(struct cmd_context *cmd, if (vg_missing_pv_count(correct_vg)) { log_verbose("There are %d physical volumes missing.", vg_missing_pv_count(correct_vg)); - vg_mark_partial_lvs(correct_vg); + vg_mark_partial_lvs(correct_vg, 1); } if ((correct_vg->status & PVMOVE) && !pvmove_mode()) { diff --git a/lib/metadata/metadata.h b/lib/metadata/metadata.h index e6b16b2cf..4b298832a 100644 --- a/lib/metadata/metadata.h +++ b/lib/metadata/metadata.h @@ -471,7 +471,6 @@ struct id pv_vgid(const struct physical_volume *pv); struct physical_volume *pv_by_path(struct cmd_context *cmd, const char *pv_name); int add_pv_to_vg(struct volume_group *vg, const char *pv_name, struct physical_volume *pv); -int vg_mark_partial_lvs(struct volume_group *vg); int is_mirror_image_removable(struct logical_volume *mimage_lv, void *baton); uint64_t find_min_mda_size(struct dm_list *mdas); diff --git a/lib/mirror/mirrored.c b/lib/mirror/mirrored.c index be9e540f7..4c74a4424 100644 --- a/lib/mirror/mirrored.c +++ b/lib/mirror/mirrored.c @@ -343,7 +343,7 @@ static int _mirrored_transient_status(struct lv_segment *seg, char *params) /* update PARTIAL_LV flags across the VG */ if (failed) - vg_mark_partial_lvs(lv->vg); + vg_mark_partial_lvs(lv->vg, 0); return 1; }