When turning merging origin into non-merging origin, there is bad sequence: snapshots are suspended, new origin is created, snapshots are resumed, new origin is resumed. So it allocates memory while suspended. To fix it, move vg_commit after suspend_resume, so that the suspend code will treat it as precommitted vg and will preload new origin prior to suspend. Signed-off-by: Mikulas Patocka --- lib/metadata/lv_manip.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) Index: LVM2.2.02.44/lib/metadata/lv_manip.c =================================================================== --- LVM2.2.02.44.orig/lib/metadata/lv_manip.c 2009-02-20 14:30:28.000000000 +0100 +++ LVM2.2.02.44/lib/metadata/lv_manip.c 2009-02-20 14:30:33.000000000 +0100 @@ -2071,15 +2071,21 @@ int lv_remove_single(struct cmd_context backup(vg); - if (!vg_commit(vg)) - 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)) + if (!suspend_lv(cmd, origin)) { log_error("Failed to refresh %s without snapshot.", origin->name); - else if (!resume_lv(cmd, origin)) + return 0; + } + if (!vg_commit(vg)) + return 0; + if (!resume_lv(cmd, origin)) { log_error("Failed to resume %s.", origin->name); + return 0; + } + } else { + if (!vg_commit(vg)) + return 0; } log_print("Logical volume \"%s\" successfully removed", lv->name);