tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: PUFFS lookup/reclaim race



On Fri, Jul 13, 2012 at 09:27:46AM +0000, Emmanuel Dreyfus wrote:
 > > Yeah: don't return copies of things that are basically pointers (in
 > > this case, the cookie) without doing proper usage tracking on them. It
 > > isn't valid to reclaim something that someone else is using; 
 > 
 > The problem is that the kernel reclaims a vnode that is not yet
 > been used by lookup. 
 > 
 > When kernel sends a lookup reuest to userland, it causes a node
 > to be referenced in userland, but it does not know what vnode
 > is associated before it gets the lookup reply. If the vnode
 > already existed, it can be reclaimed before the lookup reply,
 > there is no way to hold a reference on it, as we do not yet
 > know what vnode we have to work with.

No, but you can (and need to) hold a reference on the "cookie". Isn't
that supposed to be enough to make the kernel reload the vnode?
Because if it isn't, the whole scheme is flawed.

Correct locking requires that you hold a reference to the lookup
result before unlocking the container directory, which happens shortly
after VOP_LOOKUP returns.

-- 
David A. Holland
dholland%netbsd.org@localhost


Home | Main Index | Thread Index | Old Index