Fix lv-seg relationship on layer removal
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,
Signature · 8 lines
Jun'ichi Nomura, NEC Corporation of America -------------- next part -------------- A non-text attachment was scrubbed... Name: empty-parent-before-layer-removal.patch Type: text/x-patch Size: 912 bytes Desc: not available URL: <http://listman.redhat.com/archives/lvm-devel/attachments/20080221/146aa820/attachment.bin>
PATCH 2/2 Fix lv-seg relationship on layer removal
Quoted 5 lines · Jun'ichi Nomura
When removing a layer, segments are moved from the layer LV to the original LV (parent).
Before doing that, calllv_empty()to cleanup the parent and any relationships.
Quoted 7 lines
Without this, the relationship between the
layer_lvand 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.
Hi Jun'ichi,
Would you please consider writing (or just outlining) a test case that fails without yesterday's change, but succeeds with it?
Future maintainers will be grateful :-)