]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart: Fix growing the partition preceding a FreeArea from leftover space (#42969)
authorLennart Poettering <lennart@amutable.com>
Tue, 14 Jul 2026 09:27:57 +0000 (11:27 +0200)
committerGitHub <noreply@github.com>
Tue, 14 Jul 2026 09:27:57 +0000 (11:27 +0200)
The "Donate to preceding partition" logic is dead code since commit

https://github.com/jonas2515/systemd/commit/19903a433507897449c086b72abb5e133e431336
("repart: split out context_grow_partition_one()").
context_grow_partition_one() gets passed a free area and a partition,
and it has
an early-return check to ensure the partition it got passed belongs to
the free
area it got passed. That means we compare the FreeArea a to the FreeArea
a->after->allocated_to_area, which always yields FALSE.

Fix the behavior of donating any left over space to the preceding
partition
by adding that partition to the loop below (and relying on the
partitions list
being ordered according to physical partition offsets).

Since this behavior is not that easy to trigger, mention how to trigger
it in a
comment, and add a test for it as well.

1  2 
src/repart/repart.c
test/units/TEST-58-REPART.sh

Simple merge
Simple merge