mirror of
git://sourceware.org/git/lvm2.git
synced 2025-01-03 05:18:29 +03:00
Fix pvmove region_size overflow for very large PVs.
Fixes problem reported in https://www.redhat.com/archives/dm-devel/2009-November/msg00104.html The region size multiplication can overflow when using 32bit integer.
This commit is contained in:
parent
f145ddc9e7
commit
20babc7b4f
@ -1,5 +1,6 @@
|
||||
Version 2.02.55 -
|
||||
===================================
|
||||
Fix pvmove region_size oveflow for very large PVs.
|
||||
Fix lvcreate and lvresize processing of %PVS argument.
|
||||
Tidy some uses of arg_count and introduce arg_is_set.
|
||||
Export outnl and indent functions for modules.
|
||||
|
@ -290,7 +290,7 @@ static int _mirrored_add_target_line(struct dev_manager *dm, struct dm_pool *mem
|
||||
uint32_t area_count = seg->area_count;
|
||||
unsigned start_area = 0u;
|
||||
int mirror_status = MIRR_RUNNING;
|
||||
uint32_t region_size, region_max;
|
||||
uint32_t region_size;
|
||||
int r;
|
||||
|
||||
if (!*target_state)
|
||||
@ -333,18 +333,11 @@ static int _mirrored_add_target_line(struct dev_manager *dm, struct dm_pool *mem
|
||||
return 0;
|
||||
}
|
||||
region_size = seg->region_size;
|
||||
} else {
|
||||
/* Find largest power of 2 region size unit we can use */
|
||||
region_max = (1 << (ffs((int)seg->area_len) - 1)) *
|
||||
seg->lv->vg->extent_size;
|
||||
|
||||
region_size = mirr_state->default_region_size;
|
||||
if (region_max < region_size) {
|
||||
region_size = region_max;
|
||||
log_verbose("Using reduced mirror region size of %u sectors",
|
||||
region_size);
|
||||
}
|
||||
}
|
||||
} else
|
||||
region_size = adjusted_mirror_region_size(seg->lv->vg->extent_size,
|
||||
seg->area_len,
|
||||
mirr_state->default_region_size);
|
||||
|
||||
if (!dm_tree_node_add_mirror_target(node, len))
|
||||
return_0;
|
||||
|
Loading…
Reference in New Issue
Block a user