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

mirror: validate region_size for mirrors

Check for region size properties of mirror segments.
This commit is contained in:
Zdenek Kabelac 2018-04-19 17:38:04 +02:00
parent 1693fef529
commit 79d214032b
2 changed files with 9 additions and 0 deletions

View File

@ -1,5 +1,6 @@
Version 2.02.178 -
=====================================
Extend validation of region_size for mirror segment.
Reload whole device stack when reinitilizing mirror log.
Mirrors without monitoring are WARNING and not blocking on error.
Detect too big region_size with clustered mirrors.

View File

@ -391,6 +391,14 @@ static void _check_lv_segment(struct logical_volume *lv, struct lv_segment *seg,
if (!(seg2 = first_seg(seg->log_lv)) || (find_mirror_seg(seg2) != seg))
seg_error("log LV does not point back to mirror segment");
}
if (seg_is_mirror(seg)) {
if (!seg->region_size)
seg_error("region size is zero");
else if (seg->region_size > seg->lv->size)
seg_error("region size is bigger then LV itself");
else if (!is_power_of_2(seg->region_size))
seg_error("region size is non power of 2");
}
} else { /* !mirrored */
if (seg->log_lv) {
if (lv_is_raid_image(lv))