X-Git-Url: http://www.chiark.greenend.org.uk/ucgi/~ianmdlvl/git?p=elogind.git;a=blobdiff_plain;f=src%2Fcore%2Fmount-setup.c;h=e86a89321e91c169af1afe57b1f7a48d07d035f1;hp=c10c6dad1c853f5c4fe3f4310a01de2ebfd7be30;hb=b3ac5f8cb98757416d8660023d6564a7c411f0a0;hpb=86fc77c47f2d22cd01d0871866869cb194af0884;ds=sidebyside diff --git a/src/core/mount-setup.c b/src/core/mount-setup.c index c10c6dad1..e86a89321 100644 --- a/src/core/mount-setup.c +++ b/src/core/mount-setup.c @@ -400,6 +400,15 @@ int mount_setup(bool loaded_policy) { * udevd. */ dev_setup(); + /* Mark the root directory as shared in regards to mount + * propagation. The kernel defaults to "private", but we think + * it makes more sense to have a default of "shared" so that + * nspawn and the container tools work out of the box. If + * specific setups need other settings they can reset the + * propagation mode to private if needed. */ + if (mount(NULL, "/", NULL, MS_REC|MS_SHARED, NULL) < 0) + log_warning("Failed to set up the root directory for shared mount propagation: %m"); + /* Create a few directories we always want around */ mkdir_label("/run/systemd", 0755); mkdir_label("/run/systemd/system", 0755);