All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch kexec] Fix test for loaded kernel
@ 2008-09-12 19:08 Geoff Levand
  2008-09-12 19:33 ` Geoff Levand
  0 siblings, 1 reply; 4+ messages in thread
From: Geoff Levand @ 2008-09-12 19:08 UTC (permalink / raw)
  To: Simon Horman; +Cc: kexec, Cell Broadband Engine OSS Development

Fix these reboot errors with NFS mounted root filesystems:

  nfs: server 192.168.1.1 not responding, still trying

The main kexec code that uses kexec_loaded() expects a non-zero 
return to mean a kexec kernel has been loaded for execution.
Here is the current check:

	if ((result == 0) && (do_shutdown || do_exec) && !kexec_loaded())
		die

In cases where the currently running kernel does not have kexec enabled,
or in cases where the distro init scripts (YDL, maybe others) have unmounted
the sys filesystem prior to running kexec, the open of
"/sys/kernel/kexec_loaded" will fail.  This result should be returned as
(0), meaning NOT LOADED.  The current kexec_loaded() code returns (-1),
meaning LOADED.

With the current code, kexec will continue on.  The next steps are to
shutdown the network, then call sys_kexec.  The shutdown of the network
will succeed, but the call to sys_kexec will fail.  In this case, control
will pass back to the init scripts, but the network will be down.
Systems with NFS mounted root filesystem cannot work in this state.

Signed-off-by: Geoff Levand <geoffrey.levand@am.sony.com>
---
 kexec/kexec.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

--- a/kexec/kexec.c
+++ b/kexec/kexec.c
@@ -805,7 +805,7 @@ static int kexec_loaded(void)
 
 	fp = fopen("/sys/kernel/kexec_loaded", "r");
 	if (fp == NULL)
-		return -1;
+		return 0;
 	fscanf(fp, "%d", &ret);
 	fclose(fp);
 	return ret;



_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [patch kexec] Fix test for loaded kernel
  2008-09-12 19:08 [patch kexec] Fix test for loaded kernel Geoff Levand
@ 2008-09-12 19:33 ` Geoff Levand
  2008-09-15  6:18   ` Mohan Kumar M
  0 siblings, 1 reply; 4+ messages in thread
From: Geoff Levand @ 2008-09-12 19:33 UTC (permalink / raw)
  To: Simon Horman; +Cc: kexec, Cell Broadband Engine OSS Development

Hi Simon,

Sorry, this does not work correctly.  Please ignore. 

Geoff Levand wrote:
> Fix these reboot errors with NFS mounted root filesystems:
> 
>   nfs: server 192.168.1.1 not responding, still trying
> 
> The main kexec code that uses kexec_loaded() expects a non-zero 
> return to mean a kexec kernel has been loaded for execution.
> Here is the current check:
> 
> 	if ((result == 0) && (do_shutdown || do_exec) && !kexec_loaded())
> 		die
> 
> In cases where the currently running kernel does not have kexec enabled,
> or in cases where the distro init scripts (YDL, maybe others) have unmounted
> the sys filesystem prior to running kexec, the open of
> "/sys/kernel/kexec_loaded" will fail.  This result should be returned as
> (0), meaning NOT LOADED.  The current kexec_loaded() code returns (-1),
> meaning LOADED.

Unfortunately, in the case where a kernel has been loaded, but the init
scripts unmount sys_fs, my change will not allow the kexec to continue.

The only way to fix the NFS problem is to change the init scripts to
pass the -x option to kexec.

-Geoff


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [patch kexec] Fix test for loaded kernel
  2008-09-12 19:33 ` Geoff Levand
@ 2008-09-15  6:18   ` Mohan Kumar M
  2008-09-15  7:03     ` Simon Horman
  0 siblings, 1 reply; 4+ messages in thread
From: Mohan Kumar M @ 2008-09-15  6:18 UTC (permalink / raw)
  To: Geoff Levand; +Cc: Simon Horman, kexec, Cell Broadband Engine OSS Development

Hi Geoff,

> 
> The only way to fix the NFS problem is to change the init scripts to
> pass the -x option to kexec.

Can we simply call ifup (that function does not exist now) to bring up 
the network interface while returning from main() in kexec.c? This will 
be executed only if kexec'ing a kernel fails.

Regards,
Mohan.

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

* Re: [patch kexec] Fix test for loaded kernel
  2008-09-15  6:18   ` Mohan Kumar M
@ 2008-09-15  7:03     ` Simon Horman
  0 siblings, 0 replies; 4+ messages in thread
From: Simon Horman @ 2008-09-15  7:03 UTC (permalink / raw)
  To: Mohan Kumar M; +Cc: kexec, Cell Broadband Engine OSS Development, Geoff Levand

On Mon, Sep 15, 2008 at 11:48:56AM +0530, Mohan Kumar M wrote:
> Hi Geoff,
>
>>
>> The only way to fix the NFS problem is to change the init scripts to
>> pass the -x option to kexec.
>
> Can we simply call ifup (that function does not exist now) to bring up  
> the network interface while returning from main() in kexec.c? This will  
> be executed only if kexec'ing a kernel fails.

Good greif, that ifdown() stuff seems horrible. I wonder what the
motivation for it is/was.

-- 
Simon Horman
  VA Linux Systems Japan K.K., Sydney, Australia Satellite Office
  H: www.vergenet.net/~horms/             W: www.valinux.co.jp/en


_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

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

end of thread, other threads:[~2008-09-15  7:03 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-09-12 19:08 [patch kexec] Fix test for loaded kernel Geoff Levand
2008-09-12 19:33 ` Geoff Levand
2008-09-15  6:18   ` Mohan Kumar M
2008-09-15  7:03     ` Simon Horman

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.