diff --git a/WHATS_NEW b/WHATS_NEW index a8c0f9d10..da6b0d855 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,6 +1,7 @@ Version 2.02.14 - =================================== - Add some missing bounds checks on 32 bit extent counters. + Fix adjusted_mirror_region_size() to handle 64-bit size. + Add some missing bounds checks on 32-bit extent counters. Add Petabyte and Exabyte support. Fix lvcreate error message when 0 extents requested. lvremove man page: volumes must be cluster inactive before being removed. diff --git a/lib/metadata/mirror.c b/lib/metadata/mirror.c index a4b9361a0..c13c1abc6 100644 --- a/lib/metadata/mirror.c +++ b/lib/metadata/mirror.c @@ -36,20 +36,20 @@ struct lv_segment *find_mirror_seg(struct lv_segment *seg) } /* - * Ensure region size is compatible with volume size. + * Reduce the region size if necessary to ensure + * the volume size is a multiple of the region size. */ uint32_t adjusted_mirror_region_size(uint32_t extent_size, uint32_t extents, uint32_t region_size) { - uint32_t region_max; + uint64_t region_max; region_max = (1 << (ffs((int)extents) - 1)) * extent_size; - if (region_max < region_size) { - region_size = region_max; + if (region_max < UINT32_MAX && region_size > region_max) { + region_size = (uint32_t) region_max; log_print("Using reduced mirror region size of %" PRIu32 - " sectors", region_max); - return region_max; + " sectors", region_size); } return region_size;