Skip to content
This repository has been archived by the owner on Apr 15, 2020. It is now read-only.

Commit

Permalink
mount tmpfs onto /root after pivot_root
Browse files Browse the repository at this point in the history
Otherwise we end up losing that mount, and we can again lock on attempts
to open /root/.dbus-keyrings/org_freedesktop_general.lock O_WRONLY with
/ readonly.

Signed-off-by: Serge Hallyn <serge.hallyn@ubuntu.com>
  • Loading branch information
hallyn committed Apr 6, 2015
1 parent a368d8b commit 7a140e8
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions fs.c
Expand Up @@ -985,16 +985,6 @@ int setup_cgroup_mounts(void)
return -1;
}

/*
* Mount a tmpfs on top of /root in case / is still ro when we
* started, so we can write the org_freedesktop_general.lock
*/
if (dir_exists("/root")) {
if (mount("root", "/root", "tmpfs", 0, "size=10000") < 0) {
nih_warn("Failed to mount a writeable tmpfs onto /root");
}
}

for (i=0; i<num_controllers; i++) {
if (!do_mount_subsys(i)) {
nih_fatal("Failed mounting cgroups");
Expand All @@ -1008,6 +998,16 @@ int setup_cgroup_mounts(void)
return -1;
}

/*
* Mount a tmpfs on top of /root in case / is still ro when we
* started, so we can write the org_freedesktop_general.lock
*/
if (dir_exists("/root")) {
if (mount("root", "/root", "tmpfs", 0, "size=10000") < 0) {
nih_warn("Failed to mount a writeable tmpfs onto /root");
}
}

return 0;
}

Expand Down

0 comments on commit 7a140e8

Please sign in to comment.