From 08bde75093665001e7b30a7491c5bb9a53383d56 Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Fri, 12 Sep 2014 11:30:38 +0200 Subject: [PATCH] raid: add missing archive call Before starting to update raid metadata, archive existing unmodified one. --- WHATS_NEW | 1 + lib/metadata/raid_manip.c | 15 +++++++++++++++ 2 files changed, 16 insertions(+) diff --git a/WHATS_NEW b/WHATS_NEW index f65d7fb60..a84ef4bf3 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.112 - ===================================== + Archive metadata before starting their modification in raid target. Add missing vg_revert in suspend_lv() error path in raid target. Add missing backup of lvm2 metadata after some raid modifications. Use vg memory pool for extent allocation. diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 989244cf3..4bfe9c9cc 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -520,6 +520,9 @@ static int _raid_add_images(struct logical_volume *lv, return 0; } + if (!archive(lv->vg)) + return_0; + dm_list_init(&meta_lvs); /* For image addition */ dm_list_init(&data_lvs); /* For image addition */ @@ -909,6 +912,9 @@ static int _raid_remove_images(struct logical_volume *lv, struct dm_list removal_list; struct lv_list *lvl; + if (!archive(lv->vg)) + return_0; + dm_list_init(&removal_list); if (!_raid_extract_images(lv, new_count, pvs, 1, @@ -1313,6 +1319,9 @@ static int _convert_mirror_to_raid1(struct logical_volume *lv, return 0; } + if (!archive(lv->vg)) + return_0; + for (s = 0; s < seg->area_count; s++) { log_debug_metadata("Allocating new metadata LV for %s", seg_lv(seg, s)->name); @@ -1543,6 +1552,9 @@ int lv_raid_replace(struct logical_volume *lv, return 0; } + if (!archive(lv->vg)) + return_0; + /* * How many sub-LVs are being removed? */ @@ -1767,6 +1779,9 @@ int lv_raid_remove_missing(struct logical_volume *lv) return 0; } + if (!archive(lv->vg)) + return_0; + log_debug("Attempting to remove missing devices from %s LV, %s", seg->segtype->ops->name(seg), lv->name);