]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
repart-varlink: Consider only managed parititions for size errors 39813/head
authorJulian Sparber <julian@sparber.net>
Thu, 12 Feb 2026 16:32:32 +0000 (17:32 +0100)
committerJulian Sparber <julian@sparber.net>
Fri, 20 Feb 2026 10:36:35 +0000 (11:36 +0100)
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

index a3083ee1e12404e5f6e1caffed76fb41eb905f9c..8050427eea2cb06286f0ed84266586bcc1a0ed3c 100644 (file)
@@ -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, &current_size, /* ret_foreign_size= */ NULL, &minimal_size);
+                r = determine_auto_size(context, LOG_DEBUG, &current_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",