From f5a3bef276fe610b34b7ea6c53d332c429c31f01 Mon Sep 17 00:00:00 2001 From: Petr Rockai Date: Mon, 10 Jun 2013 17:31:13 +0200 Subject: [PATCH] format1: Fix snapshot reload in lv_remove. The special suspend/resume code in lv_remove for LVM1 snapshots was interpsersed with a vg_commit call. However, while with LVM1 metadata, vg_commit is technically a no-op, the activation code relied on the ondisk and incore metadata being the same, since on LVM1, a "commit" happens in vg_write already. Since the "ondisk" metadata was previously not available with format1 (and incore was silently used instead, via lvmcache), the problem was masked. --- lib/metadata/lv_manip.c | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 8f2f2ca2a..966b8fa6d 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -3557,20 +3557,18 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, } /* store it on disks */ - if (!vg_write(vg)) + if (!vg_write(vg) || !vg_commit(vg)) return_0; /* format1 */ - if (format1_reload_required && !suspend_lv(cmd, format1_origin)) - log_error("Failed to refresh %s without snapshot.", format1_origin->name); + if (format1_reload_required) { + if (!suspend_lv(cmd, format1_origin)) + log_error("Failed to refresh %s without snapshot.", format1_origin->name); - if (!vg_commit(vg)) - return_0; - - /* format1 */ - if (format1_reload_required && !resume_lv(cmd, format1_origin)) { - log_error("Failed to resume %s.", format1_origin->name); - return 0; + if (!resume_lv(cmd, format1_origin)) { + log_error("Failed to resume %s.", format1_origin->name); + return 0; + } } /* Release unneeded blocks in thin pool */