From c65f854af628fbe04b087179c4e660fcc0a817a1 Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 21 Apr 2021 16:46:56 +0200 Subject: [PATCH] tree-wide: enable automatic growing of file systems in images in various tools that deal with OS images Let's enable this in all tools that intend to write to the OS images. It's not conditionalized for now, as there already is conditionalization in the existance or absence of the flag in the GPT partition table (and it's opt-in), hence it should be OK to just enable this by default for now if the flag is set. --- src/core/namespace.c | 3 ++- src/firstboot/firstboot.c | 3 ++- src/journal/journalctl.c | 2 +- src/machine-id-setup/machine-id-setup-main.c | 3 ++- src/nspawn/nspawn.c | 4 ++-- src/sysusers/sysusers.c | 3 ++- src/tmpfiles/tmpfiles.c | 3 ++- 7 files changed, 13 insertions(+), 8 deletions(-) diff --git a/src/core/namespace.c b/src/core/namespace.c index 77fb0d4394..acf8d14b67 100644 --- a/src/core/namespace.c +++ b/src/core/namespace.c @@ -1818,7 +1818,8 @@ int setup_namespace( DISSECT_IMAGE_DISCARD_ON_LOOP | DISSECT_IMAGE_RELAX_VAR_CHECK | DISSECT_IMAGE_FSCK | - DISSECT_IMAGE_USR_NO_ROOT; + DISSECT_IMAGE_USR_NO_ROOT | + DISSECT_IMAGE_GROWFS; size_t n_mounts; int r; diff --git a/src/firstboot/firstboot.c b/src/firstboot/firstboot.c index ba0b360cc1..ffb92a02c4 100644 --- a/src/firstboot/firstboot.c +++ b/src/firstboot/firstboot.c @@ -1357,7 +1357,8 @@ static int run(int argc, char *argv[]) { DISSECT_IMAGE_REQUIRE_ROOT | DISSECT_IMAGE_VALIDATE_OS | DISSECT_IMAGE_RELAX_VAR_CHECK | - DISSECT_IMAGE_FSCK, + DISSECT_IMAGE_FSCK | + DISSECT_IMAGE_GROWFS, &unlink_dir, &loop_device, &decrypted_image); diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c index b4a8bd1bfb..c8fb726d42 100644 --- a/src/journal/journalctl.c +++ b/src/journal/journalctl.c @@ -2154,7 +2154,7 @@ int main(int argc, char *argv[]) { DISSECT_IMAGE_REQUIRE_ROOT | DISSECT_IMAGE_VALIDATE_OS | DISSECT_IMAGE_RELAX_VAR_CHECK | - (arg_action == ACTION_UPDATE_CATALOG ? DISSECT_IMAGE_FSCK : DISSECT_IMAGE_READ_ONLY), + (arg_action == ACTION_UPDATE_CATALOG ? DISSECT_IMAGE_FSCK|DISSECT_IMAGE_GROWFS : DISSECT_IMAGE_READ_ONLY), &unlink_dir, &loop_device, &decrypted_image); diff --git a/src/machine-id-setup/machine-id-setup-main.c b/src/machine-id-setup/machine-id-setup-main.c index 9539c39c4e..5af6bfeafe 100644 --- a/src/machine-id-setup/machine-id-setup-main.c +++ b/src/machine-id-setup/machine-id-setup-main.c @@ -146,7 +146,8 @@ static int run(int argc, char *argv[]) { DISSECT_IMAGE_REQUIRE_ROOT | DISSECT_IMAGE_VALIDATE_OS | DISSECT_IMAGE_RELAX_VAR_CHECK | - DISSECT_IMAGE_FSCK, + DISSECT_IMAGE_FSCK | + DISSECT_IMAGE_GROWFS, &unlink_dir, &loop_device, &decrypted_image); diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index ed9b31e63b..767e711150 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -3588,7 +3588,7 @@ static int outer_child( DISSECT_IMAGE_MOUNT_ROOT_ONLY| DISSECT_IMAGE_DISCARD_ON_LOOP| DISSECT_IMAGE_USR_NO_ROOT| - (arg_read_only ? DISSECT_IMAGE_READ_ONLY : DISSECT_IMAGE_FSCK)| + (arg_read_only ? DISSECT_IMAGE_READ_ONLY : DISSECT_IMAGE_FSCK|DISSECT_IMAGE_GROWFS)| (arg_start_mode == START_BOOT ? DISSECT_IMAGE_VALIDATE_OS : 0)); if (r < 0) return r; @@ -3681,7 +3681,7 @@ static int outer_child( DISSECT_IMAGE_MOUNT_NON_ROOT_ONLY| DISSECT_IMAGE_DISCARD_ON_LOOP| DISSECT_IMAGE_USR_NO_ROOT| - (arg_read_only ? DISSECT_IMAGE_READ_ONLY : DISSECT_IMAGE_FSCK)); + (arg_read_only ? DISSECT_IMAGE_READ_ONLY : DISSECT_IMAGE_FSCK|DISSECT_IMAGE_GROWFS)); if (r == -EUCLEAN) return log_error_errno(r, "File system check for image failed: %m"); if (r < 0) diff --git a/src/sysusers/sysusers.c b/src/sysusers/sysusers.c index 8d3086e209..642cf5be97 100644 --- a/src/sysusers/sysusers.c +++ b/src/sysusers/sysusers.c @@ -1997,7 +1997,8 @@ static int run(int argc, char *argv[]) { DISSECT_IMAGE_REQUIRE_ROOT | DISSECT_IMAGE_VALIDATE_OS | DISSECT_IMAGE_RELAX_VAR_CHECK | - DISSECT_IMAGE_FSCK, + DISSECT_IMAGE_FSCK | + DISSECT_IMAGE_GROWFS, &unlink_dir, &loop_device, &decrypted_image); diff --git a/src/tmpfiles/tmpfiles.c b/src/tmpfiles/tmpfiles.c index b6de1e74b2..98f14bbbe7 100644 --- a/src/tmpfiles/tmpfiles.c +++ b/src/tmpfiles/tmpfiles.c @@ -3446,7 +3446,8 @@ static int run(int argc, char *argv[]) { DISSECT_IMAGE_REQUIRE_ROOT | DISSECT_IMAGE_VALIDATE_OS | DISSECT_IMAGE_RELAX_VAR_CHECK | - DISSECT_IMAGE_FSCK, + DISSECT_IMAGE_FSCK | + DISSECT_IMAGE_GROWFS, &unlink_dir, &loop_device, &decrypted_image);