From 4bdebfd15142be390b03924d356a59d2191aeddc Mon Sep 17 00:00:00 2001 From: Mike Snitzer Date: Wed, 17 Feb 2010 23:36:45 +0000 Subject: [PATCH] Do not reload origin again in lv_remove_single() if it had a merging snapshot. vg_remove_snapshot() will have already performed the required reload. --- lib/metadata/lv_manip.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index f161ddb56..4be4df240 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -2064,6 +2064,7 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, struct volume_group *vg; struct lvinfo info; struct logical_volume *origin = NULL; + int was_merging = 0; vg = lv->vg; @@ -2118,6 +2119,7 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, if (lv_is_cow(lv)) { origin = origin_from_cow(lv); + was_merging = lv_is_merging_origin(origin); log_verbose("Removing snapshot %s", lv->name); /* vg_remove_snapshot() will preload origin if it was merging */ if (!vg_remove_snapshot(lv)) @@ -2140,8 +2142,8 @@ int lv_remove_single(struct cmd_context *cmd, struct logical_volume *lv, if (!vg_write(vg) || !vg_commit(vg)) return_0; - /* If no snapshots left, reload without -real. */ - if (origin && (!lv_is_origin(origin))) { + /* If no snapshots left, and was not merging, reload without -real. */ + if (origin && (!lv_is_origin(origin) && !was_merging)) { if (!suspend_lv(cmd, origin)) { log_error("Failed to refresh %s without snapshot.", origin->name); return 0; -- 2.43.5