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.67/lib/metadata/lv_manip.c =================================================================== --- LVM2.2.02.67.orig/lib/metadata/lv_manip.c 2010-06-09 11:06:01.000000000 +0200 +++ LVM2.2.02.67/lib/metadata/lv_manip.c 2010-06-09 11:06:20.000000000 +0200 @@ -2340,8 +2340,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\"",