diff options
author | Zdenek Kabelac <zkabelac@redhat.com> | 2016-12-10 20:01:05 +0100 |
---|---|---|
committer | Zdenek Kabelac <zkabelac@redhat.com> | 2016-12-11 23:17:22 +0100 |
commit | 0c8369099bc6105f39982b3e36dd9a53c347b07a (patch) | |
tree | 567faa3f3bcb2e8aa7858d9e6b33239e19ba5498 | |
parent | 31564834db7610b37f52040fbba89f4c71de4c34 (diff) | |
download | lvm2-0c8369099bc6105f39982b3e36dd9a53c347b07a.tar.gz |
raid: fix raid1 to mirror conversion
Fix order of operation when converting raid1 into old mirror.
Before any later metadata modification are initiated prepare
mirror_log device with all clearing.
Then directly convert raid1 into mirror with mirror_log.
This convertion now properly see as precommitted metadata
new 'mirror' and committed old 'raid' and is able to
preload all LVs.
-rw-r--r-- | WHATS_NEW | 1 | ||||
-rw-r--r-- | lib/metadata/raid_manip.c | 13 |
2 files changed, 8 insertions, 6 deletions
@@ -1,5 +1,6 @@ Version 2.02.169 - ===================================== + Fix lvconvert raid1 to mirror table reload order. Add internal function for separate mirror log preparation. Fix segfault in lvmetad from missing NULL in daemon_reply_simple. Simplify internal _info_run() and use _setup_task_run() for mknod. diff --git a/lib/metadata/raid_manip.c b/lib/metadata/raid_manip.c index 7c4ce6125..5cbd8198a 100644 --- a/lib/metadata/raid_manip.c +++ b/lib/metadata/raid_manip.c @@ -2207,6 +2207,7 @@ static int _convert_raid1_to_mirror(struct logical_volume *lv, int update_and_reload, struct dm_list *removal_lvs) { + struct logical_volume *log_lv; struct lv_segment *seg = first_seg(lv); if (!seg_is_raid1(seg)) { @@ -2227,7 +2228,10 @@ static int _convert_raid1_to_mirror(struct logical_volume *lv, return 0; } - init_mirror_in_sync(new_image_count > seg->area_count ? 0 : 1); + if (!(log_lv = prepare_mirror_log(lv, (new_image_count <= seg->area_count) /* in sync */, + new_region_size, + allocate_pvs, lv->vg->alloc))) + return_0; /* TODO remove log_lv on error path */ /* Change image pair count to requested # of images */ if (new_image_count != seg->area_count) { @@ -2255,11 +2259,8 @@ static int _convert_raid1_to_mirror(struct logical_volume *lv, seg->status &= ~RAID; lv->status |= (MIRROR | MIRRORED); - /* Add mirror_log LV (should happen in wih image allocation */ - if (!add_mirror_log(lv->vg->cmd, lv, 1, seg->region_size, allocate_pvs, lv->vg->alloc)) { - log_error("Unable to add mirror log to %s.", display_lvname(lv)); - return 0; - } + if (!attach_mirror_log(first_seg(lv), log_lv)) + return_0; return update_and_reload ? _lv_update_reload_fns_reset_eliminate_lvs(lv, removal_lvs) : 1; } |