Patchwork [v2] busybox:udhcpc: fix the root_is_nfs() function

login
register
mail settings
Submitter rongqing.li@windriver.com
Date July 24, 2012, 1:23 a.m.
Message ID <1343092999-27374-1-git-send-email-rongqing.li@windriver.com>
Download mbox | patch
Permalink /patch/32885/
State Accepted
Commit 9921cb0104ea36daf909c110bb6767e5fd307da0
Headers show

Comments

rongqing.li@windriver.com - July 24, 2012, 1:23 a.m.
From: Roy.Li <rongqing.li@windriver.com>

[YOCTO #2788]

The system will be hung when udhcpc starts, if nfs is mounted
at "/" directory and default route is different after starting
udhcpc.

The cause is that root_is_nfs() does not work after kernel-2.6.37,
since the device name has been changed from /dev/root to
${IPADDR}:${NFSDIR} on /proc/mounts. which leads to remove
the default routes to nfs server,

Now we use a loose match to check if rootfs is nfs.

Signed-off-by: Roy.Li <rongqing.li@windriver.com>
---
 meta/recipes-core/busybox/busybox_1.19.4.bb   |    2 +-
 meta/recipes-core/busybox/files/simple.script |    3 ++-
 2 files changed, 3 insertions(+), 2 deletions(-)
Saul Wold - July 26, 2012, 7:22 p.m.
On 07/23/2012 06:23 PM, rongqing.li@windriver.com wrote:
> From: Roy.Li <rongqing.li@windriver.com>
>
> [YOCTO #2788]
>
> The system will be hung when udhcpc starts, if nfs is mounted
> at "/" directory and default route is different after starting
> udhcpc.
>
> The cause is that root_is_nfs() does not work after kernel-2.6.37,
> since the device name has been changed from /dev/root to
> ${IPADDR}:${NFSDIR} on /proc/mounts. which leads to remove
> the default routes to nfs server,
>
> Now we use a loose match to check if rootfs is nfs.
>
> Signed-off-by: Roy.Li <rongqing.li@windriver.com>
> ---
>   meta/recipes-core/busybox/busybox_1.19.4.bb   |    2 +-
>   meta/recipes-core/busybox/files/simple.script |    3 ++-
>   2 files changed, 3 insertions(+), 2 deletions(-)
>
> diff --git a/meta/recipes-core/busybox/busybox_1.19.4.bb b/meta/recipes-core/busybox/busybox_1.19.4.bb
> index 6e69d22..c72f39b 100644
> --- a/meta/recipes-core/busybox/busybox_1.19.4.bb
> +++ b/meta/recipes-core/busybox/busybox_1.19.4.bb
> @@ -1,5 +1,5 @@
>   require busybox.inc
> -PR = "r10"
> +PR = "r11"
>
>   SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
>              file://B921600.patch \
> diff --git a/meta/recipes-core/busybox/files/simple.script b/meta/recipes-core/busybox/files/simple.script
> index 27368f0..6973985 100644
> --- a/meta/recipes-core/busybox/files/simple.script
> +++ b/meta/recipes-core/busybox/files/simple.script
> @@ -10,7 +10,8 @@ RESOLV_CONF="/etc/resolv.conf"
>
>   # return 0 if root is mounted on a network filesystem
>   root_is_nfs() {
> -	grep -qe '^/dev/root.*\(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
> +	sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\1 \2/p' /proc/mounts |
> +	grep -q "^/ \(nfs\|smbfs\|ncp\|coda\)$"
>   }
>
>   have_bin_ip=0
>

Merged into OE-Core

Thanks
	Sau!

Patch

diff --git a/meta/recipes-core/busybox/busybox_1.19.4.bb b/meta/recipes-core/busybox/busybox_1.19.4.bb
index 6e69d22..c72f39b 100644
--- a/meta/recipes-core/busybox/busybox_1.19.4.bb
+++ b/meta/recipes-core/busybox/busybox_1.19.4.bb
@@ -1,5 +1,5 @@ 
 require busybox.inc
-PR = "r10"
+PR = "r11"
 
 SRC_URI = "http://www.busybox.net/downloads/busybox-${PV}.tar.bz2;name=tarball \
            file://B921600.patch \
diff --git a/meta/recipes-core/busybox/files/simple.script b/meta/recipes-core/busybox/files/simple.script
index 27368f0..6973985 100644
--- a/meta/recipes-core/busybox/files/simple.script
+++ b/meta/recipes-core/busybox/files/simple.script
@@ -10,7 +10,8 @@  RESOLV_CONF="/etc/resolv.conf"
 
 # return 0 if root is mounted on a network filesystem
 root_is_nfs() {
-	grep -qe '^/dev/root.*\(nfs\|smbfs\|ncp\|coda\) .*' /proc/mounts
+	sed -n 's/^[^ ]* \([^ ]*\) \([^ ]*\) .*$/\1 \2/p' /proc/mounts |
+	grep -q "^/ \(nfs\|smbfs\|ncp\|coda\)$"
 }
 
 have_bin_ip=0