Message ID | 20180210134149.43A04D05@centrum.sk |
---|---|
State | Changes Requested |
Headers | show |
Series | [LEDE-DEV,LEDE-DEV,fstools] mount_extroot: repeat detection for slow devices | expand |
On 10 February 2018 at 13:41, <sam_@centrum.sk> wrote:
> I'm using extroot on SD card in 4G dongle attached to USB of my TP-Link Archer C2. For reasons unknown to me it started to take more than 10 seconds to show among devices, this patch adds 2 more detection attempts/delays to already existing 5s.
Just set delay_root to an appropriate value, as mentioned in
https://wiki.openwrt.org/doc/uci/fstab#example_configuration
Regards
Jonas
Thanks for responding, I've tried that. As I stated, until some time there was no problem for this SD card+4G dongle to be found even with single 5 second delay. Then after (what I suspect) electricity blackout, mount_extroot was not able to find corresponding device no matter how much time I assigned to delay_root. But upon full boot up, device was there, I could mount its fs (tried both f2fs and ext4) and read/write files. Only with repeated calls to make_devs() this card+dongle combination is properly detected for mount_extroot to complete successfully. Should that matter/help dongle is huawei_E3372h-153 with 8GB SanDisk microSD. sam_
diff --git a/block.c b/block.c index b377429..c01deb0 100644 --- a/block.c +++ b/block.c @@ -497,6 +497,15 @@ return probe_path(path); } +static void _add_absent(struct probe_info *pr) +{ + struct probe_info *existing; + list_for_each_entry(existing, &devices, list) + if (!strcasecmp(existing->dev, pr->dev)) + return; + list_add_tail(&pr->list, &devices); +} + static int _cache_load(const char *path) { int gl_flags = GLOB_NOESCAPE | GLOB_MARK; @@ -509,7 +518,7 @@ for (j = 0; j < gl.gl_pathc; j++) { struct probe_info *pr = _probe_path(gl.gl_pathv[j]); if (pr) - list_add_tail(&pr->list, &devices); + _add_absent(pr); } globfree(&gl); @@ -1407,6 +1416,7 @@ struct probe_info *pr; struct mount *m; int err = -1; + int delay_count = 3; // better safe than sorry, 2 should be enough, hell, even 1 /* Load @cfg/etc/config/fstab */ if (config_load(cfg)) @@ -1426,7 +1436,7 @@ /* Find block device pointed by the mount config */ pr = find_block_info(m->uuid, m->label, m->device); - if (!pr && delay_root){ + while (!pr && delay_root && delay_count--) { ULOG_INFO("extroot: device not present, retrying in %u seconds\n", delay_root); sleep(delay_root); make_devs();