busy buffer problem on HEAD

Matthew Dillon dillon at apollo.backplane.com
Mon Feb 20 12:15:52 PST 2006


:Booting, logging in as root and running "shutdown -r now" works.
:Booting, logging in as a regular user and running "shutdown -r now" hits
:the "busy buffer problem". This is probably because my regular users home
:directories are on nfs. This didn't happen before the "BIO" commit so
:taht's my suspect.
:
:I've uploaded core dumps to my crash directory on leaf.
:
:        -Richard

    Hmm.  There was some bad code pre-patch that I removed that was probably
    handling that case.  The real problem is that the nfsd processes are 
    getting wiped out by the shutdown before all the buffers are flushed.
    It's kind of a chicken and egg problem.

    This patch might not be quite sufficient, but I'd like you to try it
    anyhow.  It only counts buffers that are undergoing I/O as 'busy' (which
    is what the original code did), but unlike the original code I don't
    try to remove the mount point so its possible that the shutdown sequence
    will block a little further on when it tries to unmount the filesystems.

					-Matt
					Matthew Dillon 
					<dillon at xxxxxxxxxxxxx>

Index: kern/kern_shutdown.c
===================================================================
RCS file: /cvs/src/sys/kern/kern_shutdown.c,v
retrieving revision 1.24
diff -u -r1.24 kern_shutdown.c
--- kern/kern_shutdown.c	17 Feb 2006 19:18:06 -0000	1.24
+++ kern/kern_shutdown.c	20 Feb 2006 20:11:56 -0000
@@ -314,15 +314,13 @@
 			if (((bp->b_flags&B_INVAL) == 0 && BUF_REFCNT(bp)) ||
 			    ((bp->b_flags & (B_DELWRI|B_INVAL)) == B_DELWRI)) {
 				/*
-				 * XXX we need a way to detect this condition
-				 * Maybe use B_DONE ?
+				 * Only count buffers undergoing write I/O
+				 * on the related vnode.
 				 */
-#if 0
-				if (bp->b_dev == NODEV) {
-					mountlist_remove(bp->b_vp->v_mount);
+				if (bp->b_vp == NULL || 
+				    bp->b_vp->v_track_write.bk_active == 0) {
 					continue;
 				}
-#endif
 				nbusy++;
 #if defined(SHOW_BUSYBUFS) || defined(DIAGNOSTIC)
 				printf(





More information about the Bugs mailing list