Subject: Re: kern/10731: writing to ffs on vnd can hang all processes
To: None <itojun@iijlab.net>
From: Atsushi Onoe <onoe@sm.sony.co.jp>
List: tech-kern
Date: 08/01/2000 13:52:34
> >>Synopsis:       writing to ffs on vnd can hang all processes
> >>Description:
> >	writing many files to ffs on vnd eventually need to write block
> >	to the files where vnd resides on.  In that circumstance, getblk()
> >	in kern/vfs_bio.c is called.  The function set B_BUSY of some
> >	blocks within the file where vnd resides on, and then it calls
> >	allocbuf().
> 
> 	millert@openbsd.org and couple of folks did some analysis on this
> 	problem earlier this year.  what I have heard from him was that, if we
> 	need a write to the same block via vnd, and via native filesystem, that
> 	is just like writing to raw device and block device at the same time.
> 	not sure if the claim is totally valid or not, but it made sense to
> 	me.  we should fix it, but i'm not sure how (or should we require
> 	no writes to lower layer?)

Hmm, it might not be the case.  I don't need to write to native file system
at that point, but kernel need to write just to make a free buffer.

Though none of these looks right, possible solutions are:

	- make sure no dirty block on ffs on vnd left before the any
	  write attempt of blocks within the file mounted via vnd.
	  (e.g. with sync mount option)

	- gather all dirty block on ffs on vnd at flush.

	- try keep a couple of free blocks anytime instead of write and
	  free on demand.
	  (still possible deadlock)

Atsushi Onoe