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.60/lib/metadata/lv_manip.c =================================================================== --- LVM2.2.02.60.orig/lib/metadata/lv_manip.c 2010-02-08 20:27:32.000000000 +0100 +++ LVM2.2.02.60/lib/metadata/lv_manip.c 2010-02-08 20:28:19.000000000 +0100 @@ -2070,6 +2070,7 @@ int lv_remove_single(struct cmd_context struct lvinfo info; struct logical_volume *origin = NULL; int was_merging = 0, preload_origin = 0; + const char *snapid = NULL; vg = lv->vg; @@ -2140,6 +2141,10 @@ int lv_remove_single(struct cmd_context /* FIXME Seek a simpler way of dealing with this within the tree. */ preload_origin = 1; } + } 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); @@ -2155,6 +2160,26 @@ int lv_remove_single(struct cmd_context if (!preload_origin && !vg_commit(vg)) return_0; + 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 or if we stopped merging, reload */ if (origin && (!lv_is_origin(origin) || was_merging)) { if (!suspend_lv(cmd, origin)) {