From: Gabor Juhos Date: Tue, 10 Sep 2013 14:56:10 +0000 (+0200) Subject: coldplug: only start hotplug timer after udevtrigger finished X-Git-Url: http://git.archive.openwrt.org/?p=project%2Fprocd.git;a=commitdiff_plain;h=66d3d15c27e258fe51ef27267a1ddb004137dd65 coldplug: only start hotplug timer after udevtrigger finished Currently the last event timer for hotplug is started after the udevtrigger process is forked. Starting the timer means that the first hotplug event must come in before the timer expires. During this time the kernel must load the binary of the udevtrigger from the underlying rootfs which can be time consuming on slow systems. On such systems, the timer expires before the first hotplug event happens which results in broken behaviour. Due to the missing device nodes, not the ubus nor the procd code works correctly in that case. Change the code to only start the hotplug last event timer after the udevtrigger process finishes. This ensures that the delay caused by accessing the underlying filesystem does not affects the desired behaviour. Signed-off-by: Gabor Juhos --- diff --git a/coldplug.c b/coldplug.c index d5997f8..b8c0eaf 100644 --- a/coldplug.c +++ b/coldplug.c @@ -34,6 +34,7 @@ static void coldplug_complete(struct uloop_timeout *t) static void udevtrigger_complete(struct uloop_process *proc, int ret) { DEBUG(2, "Finished udevtrigger\n"); + hotplug_last_event(coldplug_complete); } void procd_coldplug(void) @@ -59,7 +60,6 @@ void procd_coldplug(void) return; } - hotplug_last_event(coldplug_complete); uloop_process_add(&udevtrigger); DEBUG(2, "Launched coldplug instance, pid=%d\n", (int) udevtrigger.pid);