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.67/lib/metadata/lv_manip.c =================================================================== --- LVM2.2.02.67.orig/lib/metadata/lv_manip.c 2010-06-09 11:05:54.000000000 +0200 +++ LVM2.2.02.67/lib/metadata/lv_manip.c 2010-06-09 11:06:01.000000000 +0200 @@ -2211,6 +2211,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; @@ -2270,6 +2271,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)) { @@ -2288,6 +2293,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)) {