]> sourceware.org Git - lvm2.git/commitdiff
thin: enforce local activation when creation new thin
authorZdenek Kabelac <zkabelac@redhat.com>
Tue, 13 Oct 2015 23:00:35 +0000 (01:00 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Tue, 13 Oct 2015 23:00:35 +0000 (01:00 +0200)
As we need to check how full thin-pool is - require thin-pool is
locally active.

lib/metadata/lv_manip.c

index 8a0bbcd2d0f12a59ffd791e601066765f6cdba83..7a3d9b9506de724392264eeab39019ceaf3cb275 100644 (file)
@@ -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;
+                               }
                        }
                }
 
This page took 0.04468 seconds and 5 git commands to generate.