summaryrefslogtreecommitdiff
path: root/src/nspawn
diff options
context:
space:
mode:
authorLennart Poettering <lennart@poettering.net>2019-03-25 17:04:38 +0100
committerLennart Poettering <lennart@poettering.net>2019-03-25 19:33:55 +0100
commit64e82c1976ebab0c7788149da42e5193e9ca2dfb (patch)
tree1907a6227d0fc5c33c79425d908ff3de07d64333 /src/nspawn
parentf0a95a2c6d64436611bca31de1f7662a4066695c (diff)
downloadsystemd-64e82c1976ebab0c7788149da42e5193e9ca2dfb.tar.gz
mount-util: beef up bind_remount_recursive() to be able to toggle more than MS_RDONLY
The function is otherwise generic enough to toggle other bind mount flags beyond MS_RDONLY (for example: MS_NOSUID or MS_NODEV), hence let's beef it up slightly to support that too.
Diffstat (limited to 'src/nspawn')
-rw-r--r--src/nspawn/nspawn-mount.c6
-rw-r--r--src/nspawn/nspawn.c2
2 files changed, 4 insertions, 4 deletions
diff --git a/src/nspawn/nspawn-mount.c b/src/nspawn/nspawn-mount.c
index a3447d948a..707d0643b4 100644
--- a/src/nspawn/nspawn-mount.c
+++ b/src/nspawn/nspawn-mount.c
@@ -730,7 +730,7 @@ static int mount_bind(const char *dest, CustomMount *m) {
return r;
if (m->read_only) {
- r = bind_remount_recursive(where, true, NULL);
+ r = bind_remount_recursive(where, MS_RDONLY, MS_RDONLY, NULL);
if (r < 0)
return log_error_errno(r, "Read-only bind mount failed: %m");
}
@@ -938,7 +938,7 @@ static int setup_volatile_state(
/* --volatile=state means we simply overmount /var with a tmpfs, and the rest read-only. */
- r = bind_remount_recursive(directory, true, NULL);
+ r = bind_remount_recursive(directory, MS_RDONLY, MS_RDONLY, NULL);
if (r < 0)
return log_error_errno(r, "Failed to remount %s read-only: %m", directory);
@@ -1004,7 +1004,7 @@ static int setup_volatile_yes(
bind_mounted = true;
- r = bind_remount_recursive(t, true, NULL);
+ r = bind_remount_recursive(t, MS_RDONLY, MS_RDONLY, NULL);
if (r < 0) {
log_error_errno(r, "Failed to remount %s read-only: %m", t);
goto fail;
diff --git a/src/nspawn/nspawn.c b/src/nspawn/nspawn.c
index 5ff02130d6..96a93cde25 100644
--- a/src/nspawn/nspawn.c
+++ b/src/nspawn/nspawn.c
@@ -3323,7 +3323,7 @@ static int outer_child(
return r;
if (arg_read_only && arg_volatile_mode == VOLATILE_NO) {
- r = bind_remount_recursive(directory, true, NULL);
+ r = bind_remount_recursive(directory, MS_RDONLY, MS_RDONLY, NULL);
if (r < 0)
return log_error_errno(r, "Failed to make tree read-only: %m");
}