File lvchange-improve-refresh-for-merging-thin-volume.patch of Package lvm2.3893

From 22a901a4b9b35d07e81e9df52fbabd5b40ddafc1 Mon Sep 17 00:00:00 2001
From: Liuhua Wang <lwang@suse.com>
Date: Mon, 18 Jul 2016 18:51:04 +0800
Subject: [PATCH] lvchange: improve refresh for merging thin volume

When running lvchange --refresh on merging thin volume,
try to deactivate snapshot thinLV in case it's preventing
startup of merge process.

References: bsc#984321
Upstrea-commit: 88c19d5d7200b4193693f88f42e05646a52b4563
---
 tools/toollib.c      |   10 +
 0 files changed, 10 insertions(+), 2874 deletions(-)

diff --git a/tools/toollib.c b/tools/toollib.c
index ca198dc..a35c0b1 100644
--- a/tools/toollib.c
+++ b/tools/toollib.c
@@ -850,6 +850,16 @@ int lv_change_activate(struct cmd_context *cmd, struct logical_volume *lv,
 
 int lv_refresh(struct cmd_context *cmd, struct logical_volume *lv)
 {
+    struct logical_volume *snapshot_lv;
+
+    if (lv_is_merging_origin(lv)) {
+        snapshot_lv = find_snapshot(lv)->lv;
+        if (lv_is_thin_type(snapshot_lv) && !deactivate_lv(cmd, snapshot_lv))
+            log_print_unless_silent("Delaying merge for origin volume %s since "
+                "snapshot volume %s is still active.",
+                    display_lvname(lv), display_lvname(snapshot_lv));
+    }
+
 	if (!cmd->partial_activation && (lv->status & PARTIAL_LV)) {
 		log_error("Refusing refresh of partial LV %s."
 			  " Use '--activationmode partial' to override.",
-- 
1.8.4.5
openSUSE Build Service is sponsored by