Skip to contentSkip to conversation

init-live.sh: fix automount failed occasionally

PATCH New Hongxu Jia 1 participant 2 messages Jun 18, 2013

lore
Share & tools
lore

Hongxu Jia

author
#0 lore raw

cover init-live.sh: fix automount failed occasionally

The following changes since commit 1dd643b142c69ac9035e29bff11d02201638dc65:

licences: Add SGI license (2013-06-17 16:45:37 +0100)

are available in the git repository at:

git://git.pokylinux.org/poky-contrib hongxu/fix-coldplug
http://git.pokylinux.org/cgit.cgi/poky-contrib/log/?h=hongxu/fix-coldplug

Hongxu Jia (1):
init-live.sh: fix automount failed occasionally

 meta/recipes-core/initrdscripts/files/init-live.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
Signature · 1 line
1.8.1.2
author
#1 lore raw

PATCH 1/1 init-live.sh: fix automount failed occasionally

Reboot system repeatedly, occasionally found usb automount failed, a low probability but it happens.

$ df
Filesystem           1K-blocks      Used Available Use% Mounted on
none                   1024972         4   1024968   0% /dev
/dev/sda3              7689384   3540940   3757840  49% /media/sda3
/dev/sda2            146127424   1238432 137466120   1% /media/sda2
/dev/sda1                17845     14570      2354  86% /media/sda1
/dev/sdb                293400    288560      4840  98% /media/sdb
/dev/sdc4               457632        32    457600   0% /media/sdc4
/dev/sdc1               475018      2321    447749   1% /media/sdc1
/dev/sdd               1382298   1382298         0 100% /media/sdd
/dev/sdc2               475694      2320    448374   1% /media/sdc2
/dev/loop0              270649    181249     75644  71% /
df: /media/sdc3: No such file or directory
tmpfs                  1029352         0   1029352   0% /dev/shm
tmpfs                  1029352      2816   1026536   0% /run
tmpfs                  1029352         0   1029352   0% /sys/fs/cgroup
tmpfs                  1029352         4   1029348   0% /tmp
tmpfs                  1029352         0   1029352   0% /media/ram
tmpfs                  1029352       116   1029236   0% /var/volatile

When boot media has been found, udev will be killed. If udev is busy to mount other medias at the killing time (especially medias is many), the above issue will occur occasionally.

Invoke `udevadm settle' before killing udev will resolve this issue, it watches the udev event queue, and exits if all current events are handled.

Use variable _UDEV_DAEMON' to replace hardcoded udevd' to keep consistent with previous.

[YOCTO #4745]

---
 meta/recipes-core/initrdscripts/files/init-live.sh | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
meta/recipes-core/initrdscripts/files/init-live.sh +3 -1
index 804e16e..82042bf 100644
@@ -75,7 +75,9 @@ read_args() {
 }
 
 boot_live_root() {
-    killall udevd 2>/dev/null
+    # Watches the udev event queue, and exits if all current events are handled
+    udevadm settle --timeout=3 --quiet
+    killall "${_UDEV_DAEMON##*/}" 2>/dev/null
 
     # Move the mount points of some filesystems over to
     # the corresponding directories under the real root filesystem.
Signature · 1 line
1.8.1.2