Remove shared snapshots when origin or the snapshot store is being removed. Signed-off-by: Mikulas Patocka --- lib/metadata/lv_manip.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) Index: LVM2.2.02.85/lib/metadata/lv_manip.c =================================================================== --- LVM2.2.02.85.orig/lib/metadata/lv_manip.c 2011-05-23 15:59:56.000000000 +0200 +++ LVM2.2.02.85/lib/metadata/lv_manip.c 2011-05-23 16:00:05.000000000 +0200 @@ -2807,8 +2807,24 @@ int lv_remove_with_dependencies(struct c const force_t force, unsigned level) { struct dm_list *snh, *snht; + struct lv_list *lvl; if (lv_is_cow(lv)) { + struct logical_volume *origin = origin_from_cow(lv); + /* Remove shared snapshot's virtual snapshots first */ + if (lv_is_multisnap_origin(origin)) { + dm_list_iterate_items(lvl, &lv->vg->lvs) { + struct logical_volume *snap_lv = lvl->lv; + struct lv_segment *snap_seg; + if (lv_is_multisnap_cow(snap_lv) && + (snap_seg = first_seg(snap_lv)) && + snap_seg->origin == origin) + if (!lv_remove_with_dependencies(cmd, snap_lv, + force, level + 1)) + return_0; + } + } + /* A merging snapshot cannot be removed directly */ if (lv_is_merging_cow(lv) && !level) { log_error("Can't remove merging snapshot logical volume \"%s\"",