From 2b6391538c53e19a6fccdb4e3638ba9dd221819a Mon Sep 17 00:00:00 2001 From: Zdenek Kabelac Date: Mon, 30 Oct 2017 17:23:56 +0100 Subject: [PATCH] raid: setup LV size earlier New validation code which does require to not store LV with no size (no segments) revealed this size setup code needs to happen earlier. --- lib/metadata/lv_manip.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index a3634ac0c..f0e492bcf 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -4028,6 +4028,15 @@ static int _lv_extend_layered_lv(struct alloc_handle *ah, fa += stripes; } + seg->len += extents; + if (seg_is_raid(seg)) + seg->area_len = seg->len; + else + seg->area_len += extents / area_multiple; + + if (!_setup_lv_size(lv, lv->le_count + extents)) + return_0; + if (clear_metadata) { /* * We must clear the metadata areas upon creation. @@ -4092,15 +4101,6 @@ static int _lv_extend_layered_lv(struct alloc_handle *ah, lv_set_hidden(seg_metalv(seg, s)); } - seg->len += extents; - if (seg_is_raid(seg)) - seg->area_len = seg->len; - else - seg->area_len += extents / area_multiple; - - if (!_setup_lv_size(lv, lv->le_count + extents)) - return_0; - return 1; }