[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[lvm-devel] [PATCH 2/2] Fix lv-seg relationship on layer removal



When a layer is removed, a linear-mapping segment of its parent
is discarded and segments of the layer are moved to the parent LV.

To discard the linear-mapping layer properly,
we need to call lv_empty() for the parent to release the layer.
Otherwise, the layer LV still has the discarded linear segment
in its segs_using_this_lv list.
(Though it might not have any visible effect because the layer
 is eventually removed.)

Thanks Milan Broz for finding this bug.

Thanks,
-- 
Jun'ichi Nomura, NEC Corporation of America
When removing a layer, segments are moved from the layer LV to
the original LV (parent).
Before doing that, call lv_empty() to cleanup the parent and
any relationships.

Without this, the relationship between the layer_lv and parent remains
and lvconvert will fail, for example:

# lvconvert -m-1 vg/lvol0
  LV lvol0_mimagetmp_2 used by LV lvol0:0-511, but is not listed in LV lvol0 segments list.
  Internal error: LV segments corrupted in lvol0_mimagetmp_2.
  intermediate VG write failed.

Index: LVM2.work/lib/metadata/lv_manip.c
===================================================================
--- LVM2.work.orig/lib/metadata/lv_manip.c
+++ LVM2.work/lib/metadata/lv_manip.c
@@ -2308,6 +2308,9 @@ int remove_layer_from_lv(struct logical_
 	    parent->le_count != layer_lv->le_count)
 		return_0;
 
+	if (!lv_empty(parent))
+		return_0;
+
 	if (!_move_lv_segments(parent, layer_lv, 0, 0))
 		return_0;
 

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]