If there is no free area for log, code should break the loop.
(Otherwise it uses uninitializes areas later.)
Easily reproducible using lvconvert --repair
- kill device with log
- run lvconvert --repair vg/lv (with no PV usable for log)
if ((contiguous || cling) && (preferred_count < ix_offset))
break;
+ log_needs_allocating = (ah->log_count && !ah->log_area.len) ?
+ 1 : 0;
+
+ if (ix + ix_offset < ah->area_count +
+ (log_needs_allocating ? ah->log_count : 0))
+ break;
+
/* sort the areas so we allocate from the biggest */
if (ix > 1)
qsort(areas + ix_offset, ix, sizeof(*areas),
* FIXME decide which PV to use at top of function instead
*/
- log_needs_allocating = (ah->log_count && !ah->log_area.len) ?
- 1 : 0;
-
too_small_for_log_count = 0;
if (!log_needs_allocating) {