Send delete message when deleting a virtual snapshot. Signed-off-by: Mikulas Patocka --- lib/metadata/lv_manip.c | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) Index: LVM2.2.02.54/lib/metadata/lv_manip.c =================================================================== --- LVM2.2.02.54.orig/lib/metadata/lv_manip.c 2009-12-16 03:16:33.000000000 +0100 +++ LVM2.2.02.54/lib/metadata/lv_manip.c 2009-12-16 04:10:45.000000000 +0100 @@ -2064,6 +2064,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; @@ -2128,6 +2129,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); @@ -2142,6 +2147,26 @@ 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)) { + /* + * Ignore error. + * Allow deleting a snapshot on overflowed + * snapshot store. + * + 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))