diff --git a/WHATS_NEW b/WHATS_NEW index 184eb1965..3119f1299 100644 --- a/WHATS_NEW +++ b/WHATS_NEW @@ -1,5 +1,6 @@ Version 2.02.131 - ===================================== + When layering LV, move LV flags with segments. Ignore persistent cache if configuration changed. (2.02.127) Fix devices/filter to be applied before disk-accessing filters. (2.02.112) Make tags only when requested via 'make tags'. diff --git a/lib/metadata/lv_manip.c b/lib/metadata/lv_manip.c index 832a190a8..7412da79b 100644 --- a/lib/metadata/lv_manip.c +++ b/lib/metadata/lv_manip.c @@ -6254,6 +6254,7 @@ int move_lv_segments(struct logical_volume *lv_to, struct logical_volume *lv_from, uint64_t set_status, uint64_t reset_status) { + const uint64_t MOVE_BITS = (RAID | MIRROR | THIN_VOLUME); struct lv_segment *seg; dm_list_iterate_items(seg, &lv_to->segments) @@ -6271,6 +6272,16 @@ int move_lv_segments(struct logical_volume *lv_to, seg->status |= set_status; } + /* + * Move LV status bits for selected types with their segments + * i.e. when inserting layer to cache LV, we move raid segments + * to a new place, thus 'raid' LV property now belongs to this LV. + * + * Bits should match to those which appears after read from disk. + */ + lv_to->status |= lv_from->status & MOVE_BITS; + lv_from->status &= ~MOVE_BITS; + lv_to->le_count = lv_from->le_count; lv_to->size = lv_from->size;