mount_root: code failed in failsafe
authorJohn Crispin <john@phrozen.org>
Tue, 10 May 2016 13:39:37 +0000 (15:39 +0200)
committerJohn Crispin <john@phrozen.org>
Tue, 10 May 2016 16:45:56 +0000 (18:45 +0200)
the code checks if we are in PREINIT before mounting root.
change this to check if root is actually mounted.
this is a regression caused by ssh login during failsafe.

Signed-off-by: John Crispin <john@phrozen.org>
mount_root.c

index 47a3409dfcd48361dd77dfd40a41b5068b4bb08d..77d683ba30bc028fd4c22c971181ecc6988226da 100644 (file)
 static int
 start(int argc, char *argv[1])
 {
-       struct volume *root;
+       struct volume *root = volume_find("rootfs");
        struct volume *data = volume_find("rootfs_data");
 
-       if (!getenv("PREINIT"))
+       if (data && find_mount_point(data->blk, 0))
+               return -1;
+
+       if (root && find_mount_point(root->blk, 0))
                return -1;
 
        if (!data) {
-               root = volume_find("rootfs");
                volume_init(root);
                ULOG_NOTE("mounting /dev/root\n");
                mount("/dev/root", "/", NULL, MS_NOATIME | MS_REMOUNT, 0);