systemd/backport-growfs-don-t-actually-resize-on-dry-run.patch
yangmingtaip 96d52d6f72 backport patches from upstream and add patchs to enhance compatibility and features
(cherry picked from commit c6e3325c5fc233470f4e4292f88eea8c7923de13)
2023-01-16 10:02:05 +08:00

38 lines
1.3 KiB
Diff

From e9a1f6237f281b4bf05386bd9b2c921ea999232f Mon Sep 17 00:00:00 2001
From: undef <gitlab@undef.tools>
Date: Thu, 14 Jul 2022 05:53:15 +0000
Subject: [PATCH] growfs: don't actually resize on dry-run
This causes systemd-growfs to exit before resizing the partition when
`--dry-run` is passed. Resizing during a dry run of a change breaks the
users expectations.
(cherry picked from commit d26c0f7243a709cfa7b8bdc87e8131746bb0e2d0)
(cherry picked from commit 00c6c62845c560ef09f845aeedabdc9027be5678)
(cherry picked from commit e39019fd1065c8e2eb078b72359c5e755b013493)
Conflict:NA
Reference:https://github.com/systemd/systemd/commit/e9a1f6237f281b4bf05386bd9b2c921ea999232f
---
src/partition/growfs.c | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/src/partition/growfs.c b/src/partition/growfs.c
index 15c56d0584..a7e745208b 100644
--- a/src/partition/growfs.c
+++ b/src/partition/growfs.c
@@ -241,6 +241,10 @@ static int run(int argc, char *argv[]) {
return log_error_errno(errno, "Failed to query size of \"%s\": %m", devpath);
log_debug("Resizing \"%s\" to %"PRIu64" bytes...", arg_target, size);
+
+ if (arg_dry_run)
+ return 0;
+
r = resize_fs(mountfd, size, &newsize);
if (r < 0)
return log_error_errno(r, "Failed to resize \"%s\" to %"PRIu64" bytes: %m",
--
2.27.0