diff options
author | Lennart Poettering <lennart@poettering.net> | 2020-01-29 19:20:33 +0100 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2020-01-29 19:29:55 +0100 |
commit | 4fcb96ce253f5a944b2e23ab9dfcec787bf350f4 (patch) | |
tree | cecb429520577401e72ff0f8e059b3001adf2c3a /src/nspawn | |
parent | e475f72977ba62c2d61e91b7e61165a0acc108a3 (diff) | |
download | systemd-4fcb96ce253f5a944b2e23ab9dfcec787bf350f4.tar.gz |
nspawn: fsck all images when mounting things
Also, start logging about mount errors, things are hard to debug
otherwise.
Diffstat (limited to 'src/nspawn')
-rw-r--r-- | src/nspawn/nspawn.c | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c index ef6d573bb3..2a63315a4c 100644 --- a/src/nspawn/nspawn.c +++ b/src/nspawn/nspawn.c @@ -3309,10 +3309,12 @@ static int outer_child( r = dissected_image_mount(dissected_image, directory, arg_uid_shift, DISSECT_IMAGE_MOUNT_ROOT_ONLY|DISSECT_IMAGE_DISCARD_ON_LOOP| - (arg_read_only ? DISSECT_IMAGE_READ_ONLY : 0)| + (arg_read_only ? DISSECT_IMAGE_READ_ONLY : DISSECT_IMAGE_FSCK)| (arg_start_mode == START_BOOT ? DISSECT_IMAGE_VALIDATE_OS : 0)); + if (r == -EUCLEAN) + return log_error_errno(r, "File system check for image failed: %m"); if (r < 0) - return r; + return log_error_errno(r, "Failed to mount image root file system: %m"); } r = determine_uid_shift(directory); @@ -3396,9 +3398,11 @@ static int outer_child( if (dissected_image) { /* Now we know the uid shift, let's now mount everything else that might be in the image. */ r = dissected_image_mount(dissected_image, directory, arg_uid_shift, - DISSECT_IMAGE_MOUNT_NON_ROOT_ONLY|DISSECT_IMAGE_DISCARD_ON_LOOP|(arg_read_only ? DISSECT_IMAGE_READ_ONLY : 0)); + DISSECT_IMAGE_MOUNT_NON_ROOT_ONLY|DISSECT_IMAGE_DISCARD_ON_LOOP|(arg_read_only ? DISSECT_IMAGE_READ_ONLY : DISSECT_IMAGE_FSCK)); + if (r == -EUCLEAN) + return log_error_errno(r, "File system check for image failed: %m"); if (r < 0) - return r; + return log_error_errno(r, "Failed to mount image file system: %m"); } if (arg_unified_cgroup_hierarchy == CGROUP_UNIFIED_UNKNOWN) { |