Fork before cleaning up the old filesystem, so it becomes asyncronous, which results in a faster boot time. --- sys-utils/switch_root.c | 8 +++++++- 1 files changed, 7 insertions(+), 1 deletions(-) diff --git a/sys-utils/switch_root.c b/sys-utils/switch_root.c index bba1127..4674290 100644 --- a/sys-utils/switch_root.c +++ b/sys-utils/switch_root.c @@ -114,6 +114,7 @@ static int switchroot(const char *newroot) const char *umounts[] = { "/dev", "/proc", "/sys", NULL }; int i; int cfd; + pid_t pid; for (i = 0; umounts[i] != NULL; i++) { char newmount[PATH_MAX]; @@ -135,7 +136,12 @@ static int switchroot(const char *newroot) cfd = open("/", O_RDONLY); if (cfd >= 0) { - recursiveRemove(cfd); + pid = fork(); + if (pid <= 0) { + recursiveRemove(cfd); + if (pid == 0) + exit(EXIT_SUCCESS); + } close(cfd); } -- 1.6.2.2 -- To unsubscribe from this list: send the line "unsubscribe util-linux-ng" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html