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.85/lib/metadata/lv_manip.c =================================================================== --- LVM2.2.02.85.orig/lib/metadata/lv_manip.c 2011-05-23 15:59:52.000000000 +0200 +++ LVM2.2.02.85/lib/metadata/lv_manip.c 2011-05-23 15:59:56.000000000 +0200 @@ -2678,6 +2678,7 @@ int lv_remove_single(struct cmd_context struct lvinfo info; struct logical_volume *origin = NULL; int was_merging = 0; + const char *snapid = NULL; vg = lv->vg; @@ -2737,6 +2738,10 @@ int lv_remove_single(struct cmd_context /* vg_remove_snapshot() will preload origin if it was merging */ 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); } if (!deactivate_lv(cmd, lv)) { @@ -2755,6 +2760,26 @@ int lv_remove_single(struct cmd_context if (!vg_write(vg) || !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, and was not merging, reload without -real. */ if (origin && (!lv_is_origin(origin) && !was_merging)) { if (!suspend_lv(cmd, origin)) {