Subject: kern/427: System hangs during shutdown if a NQNFS mounted filesystem is busy
To: None <gnats-admin>
From: Ken Hornstein <kenh@excalibur.entropic.com>
List: netbsd-bugs
Date: 08/21/1994 00:35:04
>Number:         427
>Category:       kern
>Synopsis:       System hangs during shutdown if a NQNFS mounted filesystem is busy
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    gnats-admin (Kernel Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Sun Aug 21 00:35:03 1994
>Originator:     Ken Hornstein
>Organization:
Entropic Research Lab
"	"
>Release:        
>Environment:
	
System: NetBSD excalibur 1.0_BETA NetBSD 1.0_BETA (EXCALIBUR) #16: Thu Aug 11 01:27:41 EDT 1994 kenh@excalibur:/usr/src/sys/arch/i386/compile/EXCALIBUR i386


>Description:
Normally if you kill an NQNFS helper daemon, the filesystem associated with
that daemon is unmounted.  If the filesystem busy however, then the system
hangs.  It looks like the nqnfs_clientd() function is looping.  While normally
I'd classify this as a feature, it makes life awfully difficult when it comes
time to shutdown your machine gracefully.
>How-To-Repeat:
Mount a filesystem using NQNFS.  cd into it.  Either shutdown or kill off
the NQNFS daemon.
	
>Fix:
While this is almost certainly the wrong thing to do, the following patch fixes
the problem for shutdown, at least.

--- nfs/nfs_nqlease.c.old	Sun Aug 21 02:30:53 1994
+++ nfs/nfs_nqlease.c	Sun Aug 21 03:07:54 1994
@@ -1064,7 +1064,17 @@
 		    error = tsleep((caddr_t)&nmp->nm_authstr, PSOCK | PCATCH,
 			"nqnfstimr", hz / 3);
 		    if (error == EINTR || error == ERESTART)
-			(void) dounmount(nmp->nm_mountp, 0, p);
+			/*
+			 * If dounmount fails because a filesystem is busy,
+			 * wait 10 seconds, try to unmount again, then force
+			 * an unmount.
+			 */
+			if (dounmount(nmp->nm_mountp, 0, p) == EBUSY) {
+			   tsleep((caddr_t)&nmp->nm_mountp, PSOCK,
+				 "nqnnfsumnt", hz * 10);
+			   if (dounmount(nmp->nm_mountp, 0, p) == EBUSY)
+			      dounmount(nmp->nm_mountp, MNT_FORCE, p);
+			}
 	    }
 	}
 	free((caddr_t)nmp, M_NFSMNT);
>Audit-Trail:
>Unformatted:


------------------------------------------------------------------------------