summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2021-03-11 11:44:03 +0100
committerLennart Poettering <lennart@poettering.net>2021-03-11 11:48:31 +0100
commit334eb5b0999d51efbc38b775fca92a2556c85830 (patch)
tree2933d14e92e635832533ba2a696144f5435d0cac
parent9842905ede9c7fdc541724ee5c6db7d46a47405d (diff)
downloadsystemd-334eb5b0999d51efbc38b775fca92a2556c85830.tar.gz
dissect-image: fix volatile images
This makes sure nspawn's --volatile=yes switch works again: there we have a read-only image that is overmounted by a tmpfs (with the exception of /usr). This we need to mkdir all mount points even though the image is read-only. Hence, let's drop the optimizatio of avoiding mkdir() on images that are read-only, it's wrong and misleading here, since the image itself might be read-only but our mounts are not.
-rw-r--r--src/shared/dissect-image.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/src/shared/dissect-image.c b/src/shared/dissect-image.c
index d905308762..6f9a457614 100644
--- a/src/shared/dissect-image.c
+++ b/src/shared/dissect-image.c
@@ -1344,12 +1344,10 @@ static int mount_partition(
}
if (directory) {
- if (!FLAGS_SET(flags, DISSECT_IMAGE_READ_ONLY)) {
- /* Automatically create missing mount points inside the image, if necessary. */
- r = mkdir_p_root(where, directory, uid_shift, (gid_t) uid_shift, 0755);
- if (r < 0)
- return r;
- }
+ /* Automatically create missing mount points inside the image, if necessary. */
+ r = mkdir_p_root(where, directory, uid_shift, (gid_t) uid_shift, 0755);
+ if (r < 0 && r != -EROFS)
+ return r;
r = chase_symlinks(directory, where, CHASE_PREFIX_ROOT, &chased, NULL);
if (r < 0)