return 0;
}
+ /* Make the new root directory a mount point if it isn't */
+ r = fd_make_mount_point(new_root_fd);
+ if (r < 0)
+ return log_error_errno(r, "Failed to make new root directory a mount point: %m");
+
if (FLAGS_SET(flags, SWITCH_ROOT_DESTROY_OLD_ROOT)) {
istmp = fd_is_temporary_fs(old_root_fd);
if (istmp < 0)
}
static int switch_root_initramfs(void) {
- if (mount("/run/initramfs", "/run/initramfs", NULL, MS_BIND, NULL) < 0)
- return log_error_errno(errno, "Failed to mount bind /run/initramfs on /run/initramfs: %m");
-
- if (mount(NULL, "/run/initramfs", NULL, MS_PRIVATE, NULL) < 0)
- return log_error_errno(errno, "Failed to make /run/initramfs private mount: %m");
-
/* Do not detach the old root, because /run/initramfs/shutdown needs to access it.
*
* Disable sync() during switch-root, we after all sync'ed here plenty, and a dumb sync (as opposed