mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
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.
This commit is contained in:
parent
31564834db
commit
0c8369099b
@ -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.
|
||||
|
@ -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;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user