Subject: kern/3918: Kernel hangs if nfs swap file spec not available
To: None <gnats-bugs@gnats.netbsd.org>
From: None <ian.dall@dsto.defence.gov.au>
List: netbsd-bugs
Date: 07/26/1997 22:02:22
>Number:         3918
>Category:       kern
>Synopsis:       If there is no swap file spec returned by bootparams, the kernel hangs during boot.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    kern-bug-people (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sat Jul 26 06:05:02 1997
>Last-Modified:
>Originator:     Ian Dall
>Organization:
	
>Release:        1.2
>Environment:
	
NetBSD 1.2G (XKERNEL) #3: Thu Jul  3 23:39:59 CST 1997
root@sibyl.chez-dall.org.au:/usr3/netbsd-1.2/lsrc/sys/arch/sun3/compile/XKERNEL
Model: Sun 3/50 (hostid 12009662)


>Description:
	
If there is no server with a swap file spec in its /etc/bootparams file,
then a diskless client will hang attempting to boot. In nfs_boot_init()
in sys/nfs/nfs_boot.c, there is a comment to the effect that
missing swap is not fatal and the error return from bp_getfile()
is ignored. However, bp_getfile() calls krpc_call() which never
returns in the case where the rpc just times out.

>How-To-Repeat:
	
In a network with diskless machines running netbsd, configure the server's
/etc/bootparams file:

<client>  root=<server>:<client root directory>

with no "swap=" entry. Signal rpc.bootparamd to take note of the changed file.

Reboot the diskless client. It will hang producing "RPC timeout for
server ..."  messages.

>Fix:
	

It is no longer necessary for the kernel to get its swap file via
bootparams and the value returned seems to be unused. Swap is set by
swapctl.

The simplest solution appears to be to simply remove the code to get the
swap file via bootparams from nfs_boot.c. An alternative is to set
a maximum number of retries in kprpc_call(), but this may have undesirable
effect when a server is down or misconfigured and doesn't supply
a response to the "root" request either.

A patch for the former solution follows:

--- ../../../src/sys/nfs/nfs_boot.c	Wed May 28 21:12:11 1997
+++ nfs_boot.c	Thu Jul  3 23:38:40 1997
@@ -268,11 +268,13 @@
 		goto out;
 	}
 
+#if 0
 	error = bp_getfile(&nd->nd_boot, "swap", &nd->nd_swap);
 	if (error) {
 		printf("nfs_boot: bootparam get swap: %d", error);
 		error = 0;
 	}
+#endif
 
  out:
 	if (so) soclose(so);

>Audit-Trail:
>Unformatted: