Skip to contentSkip to conversation

master - thin: enforce local activation when creation new thin

PATCH Zdenek Kabelac 1 participant 1 message Oct 13, 2015

lore
Share & tools
lore
#0 lore raw
Gitweb:        http://git.fedorahosted.org/git/?p=lvm2.git;a=commitdiff;h=7c36d7c90c77f8225432b451cb831711cea01883
Commit:        7c36d7c90c77f8225432b451cb831711cea01883
Parent:        bbef4edd06097a71601b1470a713ded17deb7cba
Author:        Zdenek Kabelac <[email protected]>
AuthorDate:    Wed Oct 14 01:00:35 2015 +0200
Committer:     Zdenek Kabelac <[email protected]>
CommitterDate: Wed Oct 14 01:00:35 2015 +0200

thin: enforce local activation when creation new thin

As we need to check how full thin-pool is - require thin-pool is locally active.

---
 lib/metadata/lv_manip.c |   19 +++++++++++++------
 1 files changed, 13 insertions(+), 6 deletions(-)
lib/metadata/lv_manip.c +13 -6
index 8a0bbcd..7a3d9b9 100644
@@ -7088,16 +7088,23 @@ static struct logical_volume *_lv_create_an_lv(struct volume_group *vg,
 		}
 
 		if (seg_is_thin_volume(lp)) {
+			thin_pool_was_active = lv_is_active(pool_lv);
 			if (lv_is_new_thin_pool(pool_lv)) {
-				thin_pool_was_active = lv_is_active(pool_lv);
 				if (!check_new_thin_pool(pool_lv))
 					return_NULL;
 				/* New pool is now inactive */
-			} else if (!pool_below_threshold(first_seg(pool_lv))) {
-				log_error("Cannot create new thin volume, free space in "
-					  "thin pool %s reached threshold.",
-					  display_lvname(pool_lv));
-				return NULL;
+			} else {
+				if (!activate_lv_excl_local(cmd, pool_lv)) {
+					log_error("Aborting. Failed to locally activate thin pool %s.",
+						  display_lvname(pool_lv));
+					return 0;
+				}
+				if (!pool_below_threshold(first_seg(pool_lv))) {
+					log_error("Cannot create new thin volume, free space in "
+						  "thin pool %s reached threshold.",
+						  display_lvname(pool_lv));
+					return NULL;
+				}
 			}
 		}