Skip to contentSkip to conversation

dev-mcsontos-clvmd-stack-overflow - thin: check for active lv

PATCH Marian Csontos 1 participant 1 message Sep 16, 2014

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=75a5de1462c30f364c7d478a4f74f355ce559ae9
Commit:        75a5de1462c30f364c7d478a4f74f355ce559ae9
Parent:        ef6508e9a4ca7e9e2827b59c3e22f6442dcc72d0
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Mon Sep 15 13:42:43 2014 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Mon Sep 15 13:51:19 2014 +0200

thin: check for active lv

Before calling deactivate, check the lv is actually active, as we may reach this 'bad' error path with pool_lv inactive.

---
 WHATS_NEW                 |    1 +
 lib/metadata/pool_manip.c |    3 ++-
 2 files changed, 3 insertions(+), 1 deletions(-)
WHATS_NEW +1 -0
index ac9d9a5..c48b979 100644
@@ -1,5 +1,6 @@
 Version 2.02.112 - 
 =====================================
+  Avoid leaving linear logical volume when thin pool creation fails.
   Demote an error to a warning when devices known to lvmetad are filtered out.
   Re-order filter evaluation, making component filters global.
   Don't leak alloc_handle on raid target error path.
lib/metadata/pool_manip.c +2 -1
index 0ed5d64..0c66c77 100644
@@ -450,7 +450,8 @@ int create_pool(struct logical_volume *pool_lv,
 
 bad:
 	if (activation()) {
-		if (deactivate_lv_local(pool_lv->vg->cmd, pool_lv)) {
+		if (lv_is_active_locally(pool_lv) &&
+		    deactivate_lv_local(pool_lv->vg->cmd, pool_lv)) {
 			log_error("Aborting. Could not deactivate pool %s.",
 				  pool_lv->name);
 			return 0;