]> sourceware.org Git - lvm2.git/commitdiff
vdo: properly check percentage for resize
authorZdenek Kabelac <zkabelac@redhat.com>
Mon, 30 Sep 2019 11:25:42 +0000 (13:25 +0200)
committerZdenek Kabelac <zkabelac@redhat.com>
Mon, 30 Sep 2019 11:34:34 +0000 (13:34 +0200)
Avoid checking 'lv_is_active()' since special LV types does this
validation anyway what calling  _percent() function  and call it
ONLY when none of special types is queried.

This restores support for VDO resize (as with support for
separate VDO pool activation, plain query for lv_is_active()
is not working in this case).

lib/metadata/lv_manip.c

index 21d21caaa5824b836212766911cf4071232221d4..47ff1672a71b1a32c8fc25a8e0cbe99b2cc87f96 100644 (file)
@@ -4850,12 +4850,6 @@ static int _lvresize_adjust_policy(const struct logical_volume *lv,
                return 0;
        }
 
-       if (!lv_is_active(lv)) {
-               log_error("Can't read state of locally inactive LV %s.",
-                         display_lvname(lv));
-               return 0;
-       }
-
        if (lv_is_thin_pool(lv)) {
                if (!lv_thin_pool_percent(lv, 1, &percent))
                        return_0;
@@ -4870,9 +4864,12 @@ static int _lvresize_adjust_policy(const struct logical_volume *lv,
        } else if (lv_is_vdo_pool(lv)) {
                if (!lv_vdo_pool_percent(lv, &percent))
                        return_0;
-       } else {
-               if (!lv_snapshot_percent(lv, &percent))
+       } else if (!lv_snapshot_percent(lv, &percent))
                        return_0;
+       else if (!lv_is_active(lv)) {
+               log_error("Can't read state of locally inactive LV %s.",
+                         display_lvname(lv));
+               return 0;
        }
 
        *amount = _adjust_amount(percent, policy_threshold, policy_amount);
This page took 0.040095 seconds and 5 git commands to generate.