1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-30 17:18:21 +03:00

lv_manip: hide layered LV temporarily

Since vg_validate() now rejects LVs without segments and
insert_layer_for_segments_on_pv() gets just created
'layer_lv' without segment,  it needs to be hidden
from vg->lvs during processing of _align_segment_boundary_to_pe_range()
as this function calls  lv_validate() and now requires
vg to be consistent.  LV is then put back into vg->lvs.
This commit is contained in:
Zdenek Kabelac 2017-11-01 00:51:39 +01:00
parent 0ba3939542
commit 373372c8ab

View File

@ -7054,9 +7054,19 @@ int insert_layer_for_segments_on_pv(struct cmd_context *cmd,
layer_lv->name, lv_where->name,
pvl ? pv_dev_name(pvl->pv) : "any");
/* Temporarily hide layer_lv from vg->lvs list
* so the lv_split_segment() passes vg_validate()
* since here layer_lv has empty segment list */
if (!(lvl = find_lv_in_vg(lv_where->vg, layer_lv->name)))
return_0;
dm_list_del(&lvl->list);
if (!_align_segment_boundary_to_pe_range(lv_where, pvl))
return_0;
/* Put back layer_lv in vg->lv */
dm_list_add(&lv_where->vg->lvs, &lvl->list);
/* Work through all segments on the supplied PV */
dm_list_iterate_items(seg, &lv_where->segments) {
for (s = 0; s < seg->area_count; s++) {