mirror of
git://sourceware.org/git/lvm2.git
synced 2024-12-21 13:34:40 +03:00
raid: fix name rotation
Since we now keep lv names valid all the time (as they are part of radix_tree) - there is a problem with this renaming code, that for a moment used duplicated name in vg struct. Fix it by interating LVs backwared - which avoids breaking consitency and also actually makes code more simple.
This commit is contained in:
parent
cbfc31ee2b
commit
c2f41c1a59
@ -2637,6 +2637,7 @@ static int _raid_add_images_without_commit(struct logical_volume *lv,
|
|||||||
struct lv_list *lvl;
|
struct lv_list *lvl;
|
||||||
struct lv_segment_area *new_areas;
|
struct lv_segment_area *new_areas;
|
||||||
struct segment_type *segtype;
|
struct segment_type *segtype;
|
||||||
|
const char *lv_name, *lv_name_tmp;
|
||||||
|
|
||||||
if (lv_is_not_synced(lv)) {
|
if (lv_is_not_synced(lv)) {
|
||||||
log_error("Can't add image to out-of-sync RAID LV:"
|
log_error("Can't add image to out-of-sync RAID LV:"
|
||||||
@ -2704,22 +2705,14 @@ static int _raid_add_images_without_commit(struct logical_volume *lv,
|
|||||||
* commits the LVM metadata before clearing the LVs.
|
* commits the LVM metadata before clearing the LVs.
|
||||||
*/
|
*/
|
||||||
if (seg_is_linear(seg)) {
|
if (seg_is_linear(seg)) {
|
||||||
struct dm_list *l;
|
if (!(lv_name = _generate_raid_name(lv, "rimage", count)))
|
||||||
struct lv_list *lvl_tmp;
|
return_0;
|
||||||
const char *lv_name;
|
|
||||||
|
|
||||||
dm_list_iterate(l, &data_lvs) {
|
dm_list_iterate_back_items(lvl, &data_lvs) {
|
||||||
if (l == dm_list_last(&data_lvs)) {
|
lv_name_tmp = lvl->lv->name;
|
||||||
lvl = dm_list_item(l, struct lv_list);
|
if (!lv_set_name(lvl->lv, lv_name))
|
||||||
if (!(lv_name = _generate_raid_name(lv, "rimage", count)) ||
|
|
||||||
!lv_set_name(lvl->lv, lv_name))
|
|
||||||
return_0;
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
lvl = dm_list_item(l, struct lv_list);
|
|
||||||
lvl_tmp = dm_list_item(l->n, struct lv_list);
|
|
||||||
if (!lv_set_name(lvl->lv, lvl_tmp->lv->name))
|
|
||||||
return_0;
|
return_0;
|
||||||
|
lv_name = lv_name_tmp; /* rotate name in list */
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user