1From cb45960e575e7c8c88744e09fda93c934cd1b1c1 Mon Sep 17 00:00:00 2001
2From: Jeffy Chen <jeffy.chen@rock-chips.com>
3Date: Fri, 9 Nov 2018 12:14:29 +0800
4Subject: [PATCH 1/3] init/do_mounts.c: Retry all fs after failed to mount with
5 "rootfstype="
6
7Retry all filesystems when failed to mount with specified ones.
8
9Change-Id: Ic1b794cc61d61f1d0715e3b32400b3e96b0dddea
10Signed-off-by: Jeffy Chen <jeffy.chen@rock-chips.com>
11---
12 init/do_mounts.c | 12 +++++++++++-
13 1 file changed, 11 insertions(+), 1 deletion(-)
14
15diff --git a/init/do_mounts.c b/init/do_mounts.c
16index b5f9604d0c98..d85f60d79107 100644
17--- a/init/do_mounts.c
18+++ b/init/do_mounts.c
19@@ -423,12 +423,13 @@ static int __init do_mount_root(const char *name, const char *fs,
20 	return ret;
21 }
22
23-void __init mount_block_root(char *name, int flags)
24+void __init mount_block_root(char *name, int mountflags)
25 {
26 	struct page *page = alloc_page(GFP_KERNEL);
27 	char *fs_names = page_address(page);
28 	char *p;
29 	char b[BDEVNAME_SIZE];
30+	int flags = mountflags;
31
32 	scnprintf(b, BDEVNAME_SIZE, "unknown-block(%u,%u)",
33 		  MAJOR(ROOT_DEV), MINOR(ROOT_DEV));
34@@ -464,6 +465,15 @@ void __init mount_block_root(char *name, int flags)
35 		goto retry;
36 	}
37
38+	/* Retry all filesystems when failed to mount with specified ones */
39+	if (root_fs_names) {
40+		printk("Retrying all filesystems\n");
41+		root_fs_names = NULL;
42+		get_fs_names(fs_names);
43+		flags = mountflags;
44+		goto retry;
45+	}
46+
47 	printk("List of all partitions:\n");
48 	printk_all_partitions();
49 	printk("No filesystem could mount root, tried: ");
50--
512.20.1
52
53