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

raid: fix validation checks for segment data_offset member

Commit 222e1e3ace was not
valuing special case of data_ofset member equal to 1.
This commit is contained in:
Heinz Mauelshagen 2017-10-09 14:00:46 +02:00
parent 554a761db2
commit 2f754b73ff

View File

@ -143,7 +143,7 @@ static void _check_raid1_seg(struct lv_segment *seg, int *error_count)
raid_seg_error("no meta areas");
if (seg->stripe_size)
raid_seg_error_val("non-zero stripe size", seg->stripe_size);
if ((seg->lv->status & LV_RESHAPE_DATA_OFFSET) || seg->data_offset)
if ((seg->lv->status & LV_RESHAPE_DATA_OFFSET) || seg->data_offset > 1)
raid_seg_error_val("data_offset", seg->data_offset);
_check_raid_region_recovery(seg, error_count);
}
@ -170,7 +170,7 @@ static void _check_raid45610_seg(struct lv_segment *seg, int *error_count)
/* END: checks applying to any raid4/5/6/10 */
if (seg->lv->status & LV_RESHAPE_DATA_OFFSET) {
if (seg->data_offset & (seg->lv->vg->extent_size - 1))
if (seg->data_offset > 1 && (seg->data_offset & (seg->lv->vg->extent_size - 1)))
raid_seg_error_val("data_offset", seg->data_offset);
} else if (seg->data_offset)
raid_seg_error_val("data_offset", seg->data_offset);