summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZdenek Kabelac <zkabelac@redhat.com>2016-12-17 21:55:02 +0100
committerZdenek Kabelac <zkabelac@redhat.com>2016-12-18 19:13:34 +0100
commit7db46c4a39fd945f295a5bd4191bd48828072d24 (patch)
treee268d907632eaf14eb26079e4f9e0140f289bb2c
parentc71fefad8d5e1d9a075553ab69791ddbf6bcb153 (diff)
downloadlvm2-7db46c4a39fd945f295a5bd4191bd48828072d24.tar.gz
thin: reload external origin with last thin
External origin could be activated as stand-alone device. When the last thin LV is removed, external origin is no longer the external origin and it's layer property was dropped. Ensure dm table is correct by reloading external origin (when it's active).
-rw-r--r--WHATS_NEW1
-rw-r--r--lib/metadata/lv_manip.c10
2 files changed, 11 insertions, 0 deletions
diff --git a/WHATS_NEW b/WHATS_NEW
index 93fc93e6f..6d368908a 100644
--- a/WHATS_NEW
+++ b/WHATS_NEW
@@ -1,5 +1,6 @@
Version 2.02.169 -
=====================================
+ Fix dm table when the last user of active external origin is removed.
Improve reported lvs status for active external origin volume.
Fix table load for splitted RAID LV and require explicit activation.
Always active splitted RAID LV exclusively locally.
diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c
index 1889998e2..92a6d449f 100644
--- a/lib/metadata/lv_manip.c
+++ b/lib/metadata/lv_manip.c
@@ -1264,6 +1264,7 @@ static int _lv_reduce(struct logical_volume *lv, uint32_t extents, int delete)
uint32_t count = extents;
uint32_t reduction;
struct logical_volume *pool_lv;
+ struct logical_volume *external_lv = NULL;
if (lv_is_merging_origin(lv)) {
log_debug_metadata("Dropping snapshot merge of %s to removed origin %s.",
@@ -1275,6 +1276,9 @@ static int _lv_reduce(struct logical_volume *lv, uint32_t extents, int delete)
if (!count)
break;
+ if (seg->external_lv)
+ external_lv = seg->external_lv;
+
if (seg->len <= count) {
if (seg->merge_lv) {
log_debug_metadata("Dropping snapshot merge of removed %s to origin %s.",
@@ -1341,6 +1345,12 @@ static int _lv_reduce(struct logical_volume *lv, uint32_t extents, int delete)
!lv->vg->fid->fmt->ops->lv_setup(lv->vg->fid, lv))
return_0;
+ /* Removal of last user enforces refresh */
+ if (external_lv && !lv_is_external_origin(external_lv) &&
+ lv_is_active(external_lv) &&
+ !lv_update_and_reload(external_lv))
+ return_0;
+
return 1;
}