Skip to content

Commit

Permalink
init: wait for partition and retry scan
Browse files Browse the repository at this point in the history
As Clear Linux boots fast the device is not ready when
the mounting code is reached, so a retry device scan will
be performed every 0.5 sec for at least 40 sec
and synchronize the async task.

Signed-off-by: Miguel Bernal Marin <miguel.bernal.marin@linux.intel.com>
  • Loading branch information
fenrus75 authored and xanmod committed Nov 4, 2021
1 parent e5d5e6b commit b3ac51e
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions init/do_mounts.c
Original file line number Diff line number Diff line change
Expand Up @@ -284,8 +284,18 @@ dev_t name_to_dev_t(const char *name)
if (strcmp(name, "/dev/ram") == 0)
return Root_RAM0;
#ifdef CONFIG_BLOCK
if (strncmp(name, "PARTUUID=", 9) == 0)
return devt_from_partuuid(name + 9);
if (strncmp(name, "PARTUUID=", 9) == 0) {
dev_t res;
int needtowait = 40<<1;
res = devt_from_partuuid(name + 9);
while (!res && needtowait) {
/* waiting 0.5 sec */
msleep(500);
res = devt_from_partuuid(name + 9);
needtowait--;
}
return res;
}
if (strncmp(name, "PARTLABEL=", 10) == 0)
return devt_from_partlabel(name + 10);
if (strncmp(name, "/dev/", 5) == 0)
Expand Down Expand Up @@ -613,7 +623,9 @@ void __init prepare_namespace(void)
* For example, it is not atypical to wait 5 seconds here
* for the touchpad of a laptop to initialize.
*/
async_synchronize_full();
wait_for_device_probe();
async_synchronize_full();

md_run_setup();

Expand Down

0 comments on commit b3ac51e

Please sign in to comment.