Subject: Re: Buffers and vnodes
To: Bill Stouder-Studenmund <wrstuden@netbsd.org>
From: Andrew Doran <ad@netbsd.org>
List: tech-kern
Date: 06/27/2007 01:48:54
> On Mon, Jun 25, 2007 at 02:13:51PM +0100, Andrew Doran wrote:
>> Hi,
>>
>> One of the remaining problem areas in vfs wrt locking is the buffer
>> cache.
>> With vfs & ffs run without the kernel lock, eventually the system will
>> deadlock with one or more threads stuck in in biowait. So I guess that
>> somewhere the necessary locks are not being taken, and it's losing
>> state.
>>
>> I've been looking into simplifying the locking, as it's unclear what's
>> covered by the long term lock (B_BUSY) and the short term lock
>> (b_interlock). One thing I'd like to do is replace b_interlock with a
>> pointer to the interlock for the vnode that the buffer is currently
>> associated with.
>>
>> That would simplify things, but the catch is that buffers don't have to
>> be
>> associated with vnodes. Rather than handle that as a seperate case,
>> would it
>> make sense to dictate that buffers must always be associated with a
>> vnode?
>> That would also simplify reference counting around character / block
>> devices, meaning that we could reliably prevent unloading an LKM device
>> that's in use.
>
> Sounds good. I assume buffers that are unassociated now would end up being
> associated with the device node?

Right. So to legitimately call the strategy routine for a device you'd
need to have it opened via a vnode, not just the device open routine.

Andrew