From f94d3180b05c3fb7da0dae900b8caa2017f8e21c Mon Sep 17 00:00:00 2001 From: Julian Sparber Date: Thu, 12 Feb 2026 17:32:32 +0100 Subject: [PATCH] repart-varlink: Consider only managed parititions for size errors Report DiskTooSmall only if partitions managed by repart don't fit the disk. Because if the disk is already full with forigin partitions we would always report DiskTooSmall instead of InsufficentFreeSpace. --- src/repart/repart.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/repart/repart.c b/src/repart/repart.c index a3083ee1e12..8050427eea2 100644 --- a/src/repart/repart.c +++ b/src/repart/repart.c @@ -10369,14 +10369,16 @@ static int vl_method_run( r = context_ponder(context); if (r == -ENOSPC) { - uint64_t current_size, minimal_size; + uint64_t current_size, foreign_size, minimal_size; - r = determine_auto_size(context, LOG_DEBUG, ¤t_size, /* ret_foreign_size= */ NULL, &minimal_size); + r = determine_auto_size(context, LOG_DEBUG, ¤t_size, &foreign_size, &minimal_size); if (r < 0) return r; + uint64_t needed_size = LESS_BY(minimal_size, foreign_size); + /* Check if space issue is caused by the whole disk being too small */ - if (minimal_size > context->total) + if (needed_size > context->total) return sd_varlink_errorbo( link, "io.systemd.Repart.DiskTooSmall", -- 2.47.3