1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-22 17:35:59 +03:00

Fix for bug 619221 - log device splitting regression

An incorrect fix on July 13, 2010 for an annoyance has caused a regression.
The offending check-in was part of the 2.02.71 release of LVM.  That
check-in caused any PVs specified on the command line to be ignored when
performing a mirror split.

This patch reverses the aforementioned check-in (solving the regressions)
and posits a new solution to the list reversal problem.  The original
problem was that we would always take the lowest mimage LVs from a mirror
when performing a split, but what we really want is to take the highest
mimage LVs.  This patch accomplishes that by working through the list in
reverse order - choosing the higher numbered mimages first.  (This also
reduces the amount of processing necessary.)

Signed-off-by: Jonathan Brassow <jbrassow@redhat.com>
Reviewed-by: Takahiro Yasui <takahiro.yasui@hds.com>
This commit is contained in:
Jonathan Earl Brassow 2010-08-06 15:38:32 +00:00
parent 2b34836c61
commit c63e78714a
3 changed files with 10 additions and 21 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.73 -
================================
Split-mirror operations were ignoring user-specified PVs.
Fix data corruption bug in cluster mirrors.
Require logical volume(s) to be explicitly named for lvconvert --merge.
Avoid changing aligned pe_start as a side-effect of very verbose logging.

View File

@ -524,34 +524,22 @@ static int _move_removable_mimages_to_end(struct logical_volume *lv,
uint32_t count,
struct dm_list *removable_pvs)
{
int i, images;
int i;
struct logical_volume *sub_lv;
struct lv_segment *mirrored_seg = first_seg(lv);
if (!removable_pvs)
return 1;
/*
* When we shift an image to the end, we must start from
* the begining of the list again. We must visit the
* images up to the last one we just moved.
*/
for (images = mirrored_seg->area_count; images && count; images--) {
for (i = 0; i < images; i++) {
sub_lv = seg_lv(mirrored_seg, i);
for (i = mirrored_seg->area_count - 1; (i >= 0) && count; i--) {
sub_lv = seg_lv(mirrored_seg, i);
if (!is_temporary_mirror_layer(sub_lv) &&
is_mirror_image_removable(sub_lv, removable_pvs)) {
if (!shift_mirror_images(mirrored_seg, i))
return_0;
count--;
break;
}
if (!is_temporary_mirror_layer(sub_lv) &&
is_mirror_image_removable(sub_lv, removable_pvs)) {
if (!shift_mirror_images(mirrored_seg, i))
return_0;
count--;
}
/* Did we shift any images? */
if (i == images)
return 0;
}
return !count;

View File

@ -1015,7 +1015,7 @@ static int _lvconvert_mirrors_aux(struct cmd_context *cmd,
lv->le_count,
lp->region_size);
if (!operable_pvs && !lp->keep_mimages)
if (!operable_pvs)
operable_pvs = lp->pvh;
seg = first_seg(lv);