Extend virtual segments rather than creating new segments. If we extend the virtual snapshot, LVM attempts to create a new segment. This causes crash because the new segment is not initialized. Change lv_extend function to extend the last segment instead of creating new. Signed-off-by: Mikulas Patocka --- lib/metadata/lv_manip.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) Index: LVM2.2.02.60/lib/metadata/lv_manip.c =================================================================== --- LVM2.2.02.60.orig/lib/metadata/lv_manip.c 2010-02-08 20:30:03.000000000 +0100 +++ LVM2.2.02.60/lib/metadata/lv_manip.c 2010-02-08 20:34:07.000000000 +0100 @@ -1628,8 +1628,17 @@ int lv_extend(struct logical_volume *lv, int r = 1; struct alloc_handle *ah; - if (segtype_is_virtual(segtype)) + if (segtype_is_virtual(segtype)) { + struct lv_segment *seg = last_seg(lv); + if (seg && seg->segtype == segtype) { + seg->area_len += extents; + seg->len += extents; + lv->le_count += extents; + lv->size += (uint64_t) extents * lv->vg->extent_size; + return 1; + } return lv_add_virtual_segment(lv, status, extents, segtype); + } if (!(ah = allocate_extents(lv->vg, lv, segtype, stripes, mirrors, 0, 0, extents, allocatable_pvs, alloc, NULL)))