Re: PUFFS lookup/reclaim race

2012-07-18 Thread David Holland
On Tue, Jul 17, 2012 at 09:30:52AM +, Emmanuel Dreyfus wrote: > > You also need to make sure that the kernel knows how many references > > to C it's been given, so it can drop that many when it calls > > PUFFS_RECLAIM. > > Do you mean I should have the kernel conunting successful lookups,

Re: PUFFS lookup/reclaim race

2012-07-17 Thread Emmanuel Dreyfus
On Tue, Jul 17, 2012 at 07:48:46AM +, David Holland wrote: > You also need to make sure that the kernel knows how many references > to C it's been given, so it can drop that many when it calls > PUFFS_RECLAIM. Do you mean I should have the kernel conunting successful lookups, and send the rec

Re: PUFFS lookup/reclaim race

2012-07-17 Thread David Holland
On Tue, Jul 17, 2012 at 07:38:01AM +, David Holland 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

Re: PUFFS lookup/reclaim race

2012-07-17 Thread David Holland
On Fri, Jul 13, 2012 at 09:27:46AM +, 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 proble

Re: PUFFS lookup/reclaim race

2012-07-14 Thread Emmanuel Dreyfus
Emmanuel Dreyfus wrote: > 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

Re: PUFFS lookup/reclaim race

2012-07-13 Thread Emmanuel Dreyfus
On Fri, Jul 13, 2012 at 07:58:54AM +, David Holland 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 kern

Re: PUFFS lookup/reclaim race

2012-07-13 Thread Emmanuel Dreyfus
On Fri, Jul 13, 2012 at 07:30:47AM +0100, David Laight wrote: > Reference count the cookie somehow? I already do this [in uncommitted code] and it does not help since this is a mismatch between kernel and userland refcounts. > Maybe a 3-way handshake somewhere - so userspace doesn't actually free

Re: PUFFS lookup/reclaim race

2012-07-13 Thread David Holland
On Fri, Jul 13, 2012 at 12:34:20AM +, Emmanuel Dreyfus wrote: > Understanding how it happens is nice, now the next question is: how > can I fix it? The only way I can think of is to prevent inactive from > recycling the vnode if a lookup is in progress anywhere in the filesystem. > Any bett

Re: PUFFS lookup/reclaim race

2012-07-12 Thread David Laight
On Fri, Jul 13, 2012 at 12:34:20AM +, Emmanuel Dreyfus wrote: > Hi > > I spend days tracking down a race condition in PUFFS lookup. Here is how it > fails: > > - vnode V for file F is associated with cookie C > > - enter puffs_vnop_lookup(), looking up file F > - puffs_vnop_lookup() sends PU

PUFFS lookup/reclaim race

2012-07-12 Thread Emmanuel Dreyfus
Hi I spend days tracking down a race condition in PUFFS lookup. Here is how it fails: - vnode V for file F is associated with cookie C - enter puffs_vnop_lookup(), looking up file F - puffs_vnop_lookup() sends PUFFS_LOOKUP to userland - userland finds cookie C for F, sends reply to kernel - some