chiark / gitweb /
switch-root: umount the old root correctly
authorDan Dedrick <dan.dedrick@gmail.com>
Tue, 29 Jul 2014 19:31:23 +0000 (15:31 -0400)
committerZbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl>
Sun, 3 Aug 2014 05:32:08 +0000 (01:32 -0400)
The unmount occurs after the pivot_root, so the path used to unmount
should take into account the new root directory. This will allow the
umount to actually succeed.

src/core/switch-root.c

index f82243f8b1a6ab9616ac0d194f58bbc71174f972..f508cc203006273d2a086b91750cdecc4284fdd1 100644 (file)
@@ -129,8 +129,8 @@ int switch_root(const char *new_root) {
 
                 /* Immediately get rid of the old root. Since we are
                  * running off it we need to do this lazily. */
 
                 /* Immediately get rid of the old root. Since we are
                  * running off it we need to do this lazily. */
-                if (umount2(temporary_old_root, MNT_DETACH) < 0) {
-                        log_error("Failed to umount old root dir %s: %m", temporary_old_root);
+                if (umount2("/mnt", MNT_DETACH) < 0) {
+                        log_error("Failed to umount old root dir /mnt: %m");
                         return -errno;
                 }
 
                         return -errno;
                 }