1
0
mirror of git://sourceware.org/git/lvm2.git synced 2024-12-21 13:34:40 +03:00

lvresize: fix stacked resize

Commit b64703401d cause regression
when handling stacked resize of pool metadata volume that would
be a raid LV.

Fix it by properly setting up size also for layer extension.
This commit is contained in:
Zdenek Kabelac 2016-03-15 23:13:28 +01:00
parent 746f8af2a8
commit 51ed48f855
2 changed files with 29 additions and 15 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.147 - Version 2.02.147 -
================================== ==================================
Fix resize of stacked raid thin data volume (2.02.141).
Fix test for lvremove failure in lvconvert --uncache (2.02.146). Fix test for lvremove failure in lvconvert --uncache (2.02.146).
Version 2.02.146 - 11th March 2016 Version 2.02.146 - 11th March 2016

View File

@ -1704,6 +1704,28 @@ static int _log_parallel_areas(struct dm_pool *mem, struct dm_list *parallel_are
return 1; return 1;
} }
/* Handles also stacking */
static int _setup_lv_size(struct logical_volume *lv, uint32_t extents)
{
struct lv_segment *thin_pool_seg;
lv->le_count = extents;
lv->size = (uint64_t) extents * lv->vg->extent_size;
if (lv_is_thin_pool_data(lv)) {
if (!(thin_pool_seg = get_only_segment_using_this_lv(lv)))
return_0;
/* Update thin pool segment from the layered LV */
thin_pool_seg->lv->le_count =
thin_pool_seg->len =
thin_pool_seg->area_len = lv->le_count;
thin_pool_seg->lv->size = lv->size;
}
return 1;
}
static int _setup_alloced_segment(struct logical_volume *lv, uint64_t status, static int _setup_alloced_segment(struct logical_volume *lv, uint64_t status,
uint32_t area_count, uint32_t area_count,
uint32_t stripe_size, uint32_t stripe_size,
@ -1712,7 +1734,7 @@ static int _setup_alloced_segment(struct logical_volume *lv, uint64_t status,
uint32_t region_size) uint32_t region_size)
{ {
uint32_t s, extents, area_multiple; uint32_t s, extents, area_multiple;
struct lv_segment *seg, *thin_pool_seg; struct lv_segment *seg;
area_multiple = _calc_area_multiple(segtype, area_count, 0); area_multiple = _calc_area_multiple(segtype, area_count, 0);
extents = aa[0].len * area_multiple; extents = aa[0].len * area_multiple;
@ -1732,19 +1754,9 @@ static int _setup_alloced_segment(struct logical_volume *lv, uint64_t status,
dm_list_add(&lv->segments, &seg->list); dm_list_add(&lv->segments, &seg->list);
extents = aa[0].len * area_multiple; extents = aa[0].len * area_multiple;
lv->le_count += extents;
lv->size += (uint64_t) extents * lv->vg->extent_size;
if (lv_is_thin_pool_data(lv)) { if (!_setup_lv_size(lv, lv->le_count + extents))
if (!(thin_pool_seg = get_only_segment_using_this_lv(lv))) return_0;
return_0;
/* Update thin pool segment from the layered LV */
thin_pool_seg->lv->le_count =
thin_pool_seg->len =
thin_pool_seg->area_len = lv->le_count;
thin_pool_seg->lv->size = lv->size;
}
return 1; return 1;
} }
@ -3875,8 +3887,9 @@ static int _lv_extend_layered_lv(struct alloc_handle *ah,
seg->area_len += extents; seg->area_len += extents;
seg->len += extents; seg->len += extents;
lv->le_count += extents;
lv->size += (uint64_t) extents * lv->vg->extent_size; if (!_setup_lv_size(lv, lv->le_count + extents))
return_0;
/* /*
* The MD bitmap is limited to being able to track 2^21 regions. * The MD bitmap is limited to being able to track 2^21 regions.