Subject: Re: split LFS vnode locks
To: YAMAMOTO Takashi <yamt@mwd.biglobe.ne.jp>
From: Jason R Thorpe <thorpej@wasabisystems.com>
List: tech-kern
Date: 12/15/2002 17:28:24
On Mon, Dec 16, 2002 at 10:07:26AM +0900, YAMAMOTO Takashi wrote:

 > > I don't know enough about lfs to understand exactly the problem, but I
 > > think this won't work.
 > > 
 > > You CAN NOT sleep with a vnode lock held.
 > > 
 > > lfs_reserve() calls tsleep, thus it MUST unlock the vnode.
 > > 
 > > There is no way around it.
 > 
 > mmmm, ok, i see.
 > then, probably we have to have way to restart vnode ops from
 > namei lookup instead because we can't continue vnode ops safely
 > after we release vnode locks once.  right?
 > 
 > VOP_RESERVE can be an alternative, but anyway,
 > i should modify vnodeop i/f only for lfs.
 > that's what i wanted to avoid... :-)

Of *course* you can sleep while holding a vnode lock.  If you
couldn't, then what on earth would be the point of even having
them in our current kernel?

And, as far as I know, we have a lot of code in our kernel NOW
that sleeps while holding vnode locks...

So, there is nothing wrong with this at all, as far as I can tell.  Though,
an interlock should be used where the XXX in the patch says there should be
one :-)

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