public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] init:enable usermodehelper as soon as we have a root filesystem
@ 2011-10-23 14:43 wangyanqing
  0 siblings, 0 replies; 3+ messages in thread
From: wangyanqing @ 2011-10-23 14:43 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

before we have a root filesystem , it is useless to enable usermodehelper,
and it may cause bug if we enable usermodehelper too early.This patch
enable usermodehelper as soon as we have a root filesystem.
---
 init/do_mounts.c |    3 +++
 init/initramfs.c |    2 ++
 init/main.c      |    1 -
 3 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index c0851a8..9575bdd 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -490,4 +490,7 @@ out:
 	devtmpfs_mount("dev");
 	sys_mount(".", "/", NULL, MS_MOVE, NULL);
 	sys_chroot((const char __user __force *)".");
+#ifndef CONFIG_BLK_DEV_INITRD
+	usermodehelper_enable();
+#endif
 }
diff --git a/init/initramfs.c b/init/initramfs.c
index 2531811..881fc4b 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -581,6 +581,7 @@ static int __init populate_rootfs(void)
 		err = unpack_to_rootfs((char *)initrd_start,
 			initrd_end - initrd_start);
 		if (!err) {
+			usermodehelper_enable();
 			free_initrd();
 			return 0;
 		} else {
@@ -603,6 +604,7 @@ static int __init populate_rootfs(void)
 			initrd_end - initrd_start);
 		if (err)
 			printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err);
+		usermodehelper_enable();
 		free_initrd();
 #endif
 	}
diff --git a/init/main.c b/init/main.c
index 03b408d..2e232cb 100644
--- a/init/main.c
+++ b/init/main.c
@@ -730,7 +730,6 @@ static void __init do_basic_setup(void)
 	driver_init();
 	init_irq_proc();
 	do_ctors();
-	usermodehelper_enable();
 	do_initcalls();
 }
 
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* [PATCH] init:enable usermodehelper as soon as we have a root filesystem
@ 2011-10-23 15:09 wangyanqing
  2011-10-27  0:39 ` wangyanqing
  0 siblings, 1 reply; 3+ messages in thread
From: wangyanqing @ 2011-10-23 15:09 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

before we have a filesystem , it is useless to enable usermodehelper,
and it may cause bug if we enable usermodehelper too early (see commit
d5767c53535ac79758084773418e0ad186aba4a2 for the reason why linus mv 
'usermodehelper_enable()' to the end of do_basic_setup, and commit 
b0f84374b6ab0dc9c47975df0b02d46165d558d4).This patch
enable usermodehelper as soon as we have a filesystem.

Signed-off-by: wang yanqing <udknight@gmail.com>
---
 init/do_mounts.c |    3 +++
 init/initramfs.c |    2 ++
 init/main.c      |    1 -
 3 files changed, 5 insertions(+), 1 deletions(-)

diff --git a/init/do_mounts.c b/init/do_mounts.c
index c0851a8..9575bdd 100644
--- a/init/do_mounts.c
+++ b/init/do_mounts.c
@@ -490,4 +490,7 @@ out:
 	devtmpfs_mount("dev");
 	sys_mount(".", "/", NULL, MS_MOVE, NULL);
 	sys_chroot((const char __user __force *)".");
+#ifndef CONFIG_BLK_DEV_INITRD
+	usermodehelper_enable();
+#endif
 }
diff --git a/init/initramfs.c b/init/initramfs.c
index 2531811..881fc4b 100644
--- a/init/initramfs.c
+++ b/init/initramfs.c
@@ -581,6 +581,7 @@ static int __init populate_rootfs(void)
 		err = unpack_to_rootfs((char *)initrd_start,
 			initrd_end - initrd_start);
 		if (!err) {
+			usermodehelper_enable();
 			free_initrd();
 			return 0;
 		} else {
@@ -603,6 +604,7 @@ static int __init populate_rootfs(void)
 			initrd_end - initrd_start);
 		if (err)
 			printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err);
+		usermodehelper_enable();
 		free_initrd();
 #endif
 	}
diff --git a/init/main.c b/init/main.c
index 03b408d..2e232cb 100644
--- a/init/main.c
+++ b/init/main.c
@@ -730,7 +730,6 @@ static void __init do_basic_setup(void)
 	driver_init();
 	init_irq_proc();
 	do_ctors();
-	usermodehelper_enable();
 	do_initcalls();
 }
 
-- 
1.7.3.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] init:enable usermodehelper as soon as we have a root filesystem
  2011-10-23 15:09 wangyanqing
@ 2011-10-27  0:39 ` wangyanqing
  0 siblings, 0 replies; 3+ messages in thread
From: wangyanqing @ 2011-10-27  0:39 UTC (permalink / raw)
  To: Linus Torvalds; +Cc: linux-kernel

On Sun, Oct 23, 2011 at 11:09:57PM +0800, wangyanqing wrote:
> before we have a filesystem , it is useless to enable usermodehelper,
> and it may cause bug if we enable usermodehelper too early (see commit
> d5767c53535ac79758084773418e0ad186aba4a2 for the reason why linus mv 
> 'usermodehelper_enable()' to the end of do_basic_setup, and commit 
> b0f84374b6ab0dc9c47975df0b02d46165d558d4).This patch
> enable usermodehelper as soon as we have a filesystem.
> 
> Signed-off-by: wang yanqing <udknight@gmail.com>
> ---
>  init/do_mounts.c |    3 +++
>  init/initramfs.c |    2 ++
>  init/main.c      |    1 -
>  3 files changed, 5 insertions(+), 1 deletions(-)
> 
> diff --git a/init/do_mounts.c b/init/do_mounts.c
> index c0851a8..9575bdd 100644
> --- a/init/do_mounts.c
> +++ b/init/do_mounts.c
> @@ -490,4 +490,7 @@ out:
>  	devtmpfs_mount("dev");
>  	sys_mount(".", "/", NULL, MS_MOVE, NULL);
>  	sys_chroot((const char __user __force *)".");
> +#ifndef CONFIG_BLK_DEV_INITRD
> +	usermodehelper_enable();
> +#endif
>  }
> diff --git a/init/initramfs.c b/init/initramfs.c
> index 2531811..881fc4b 100644
> --- a/init/initramfs.c
> +++ b/init/initramfs.c
> @@ -581,6 +581,7 @@ static int __init populate_rootfs(void)
>  		err = unpack_to_rootfs((char *)initrd_start,
>  			initrd_end - initrd_start);
>  		if (!err) {
> +			usermodehelper_enable();
>  			free_initrd();
>  			return 0;
>  		} else {
> @@ -603,6 +604,7 @@ static int __init populate_rootfs(void)
>  			initrd_end - initrd_start);
>  		if (err)
>  			printk(KERN_EMERG "Initramfs unpacking failed: %s\n", err);
> +		usermodehelper_enable();
>  		free_initrd();
>  #endif
>  	}
> diff --git a/init/main.c b/init/main.c
> index 03b408d..2e232cb 100644
> --- a/init/main.c
> +++ b/init/main.c
> @@ -730,7 +730,6 @@ static void __init do_basic_setup(void)
>  	driver_init();
>  	init_irq_proc();
>  	do_ctors();
> -	usermodehelper_enable();
>  	do_initcalls();
>  }
>  
> -- 
> 1.7.3.4
> 
Hi,Linus.Sorry, but I just want to know whether this patch is wrong? And any suggestion is welcome, thanks!

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-10-27  0:40 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-10-23 14:43 [PATCH] init:enable usermodehelper as soon as we have a root filesystem wangyanqing
  -- strict thread matches above, loose matches on Subject: below --
2011-10-23 15:09 wangyanqing
2011-10-27  0:39 ` wangyanqing

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox