Send delete message when deleting a virtual snapshot. Signed-off-by: Mikulas Patocka --- lib/metadata/lv_manip.c | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) Index: LVM2.2.02.53/lib/metadata/lv_manip.c =================================================================== --- LVM2.2.02.53.orig/lib/metadata/lv_manip.c 2009-10-13 23:38:52.000000000 +0200 +++ LVM2.2.02.53/lib/metadata/lv_manip.c 2009-10-13 23:39:26.000000000 +0200 @@ -2059,6 +2059,7 @@ int lv_remove_single(struct cmd_context struct volume_group *vg; struct lvinfo info; struct logical_volume *origin = NULL; + const char *snapid = NULL; vg = lv->vg; @@ -2123,6 +2124,10 @@ int lv_remove_single(struct cmd_context log_verbose("Removing snapshot %s", lv->name); if (!vg_remove_snapshot(lv)) return_0; + } else if (lv_is_multisnap_cow(lv)) { + struct lv_segment *seg = first_seg(lv); + origin = seg->origin; + snapid = dm_pool_strdup(cmd->mem, seg->snapid); } log_verbose("Releasing logical volume \"%s\"", lv->name); @@ -2137,6 +2142,20 @@ int lv_remove_single(struct cmd_context backup(vg); + if (snapid) { + /* + * Send delete message to the kernel. If origin is not active, + * it will be deleted on next activation. + */ + if (lv_is_active(origin)) { + if (!lv_multisnap_delete(cmd, origin, snapid)) { + log_error("Failed to remove snapid %s from %s.", + snapid, origin->name); + return_0; + } + } + } + /* If no snapshots left, reload without -real. */ if (origin && !lv_is_origin(origin)) { if (!suspend_lv(cmd, origin))