Subject: Re: can we tsleep() in vfs_shutdown ?
To: Manuel Bouyer <bouyer@antioche.lip6.fr>
From: Jason R Thorpe <thorpej@zembu.com>
List: tech-kern
Date: 08/03/2000 14:23:03
On Thu, Aug 03, 2000 at 11:09:00PM +0200, Manuel Bouyer wrote:

 > in vfs_shutdown(), to pause between flush attemps there is currently a
 > DELAY(). The problem I can see with this is that we may need some kernel
 > thread to run for the write to complete (e.g. raidframe, maybe usb ?),
 > and vfs_shutdown() doesn't give them a chance to have the CPU.
 > This is supposed to be why system with raid mounted at reboot time don't
 > always reboot cleanly ("syncing buffers x y z t u giving up").

Well, we want to avoid running *user* processes at this point, only
want to allow kernel threads to run.  In fact:

	printf("syncing disks... ");

	/* XXX Should suspend scheduling. */
	(void) spl0();

:-)  So, there should probably be some call that traverses the proc
lists and makes all non-P_SYSTEM processes non-runnable.

Also, proc0 is a valid thread context ... but the first couple of
lines of code at the top of vfs_shutdown() are a problem, too.  It's
probably okay to avoid tsleep'ing in the proc0 case, there.

Other than the "XXX Should suspend scheduling" bit, which should be
added before this gets committed, it looks okay to me.

-- 
        -- Jason R. Thorpe <thorpej@zembu.com>