Subject: Re: can we tsleep() in vfs_shutdown ?
To: Jason R Thorpe <thorpej@zembu.com>
From: Manuel Bouyer <bouyer@antioche.lip6.fr>
List: tech-kern
Date: 08/03/2000 23:32:03
On Thu, Aug 03, 2000 at 02:23:03PM -0700, Jason R Thorpe wrote:
> 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

But it's used in many other places ... can't we have problems if we tsleep()
in this context ?

> 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.

Can you give more details about how to do this ? I've never been in this
part of the kernel ... :)

--
Manuel Bouyer <bouyer@antioche.eu.org>
--