public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* idr_get_new_above not working?
@ 2005-08-15 14:16 John McCutchan
  2005-08-15 16:27 ` [patch] inotify: " Robert Love
  0 siblings, 1 reply; 3+ messages in thread
From: John McCutchan @ 2005-08-15 14:16 UTC (permalink / raw)
  To: Andrew Morton, Robert Love, linux-kernel, jim.houston

Hey,

Inotify is using idr_get_new_above to make sure that the next watch
descriptor is larger/different than any of the previous watch
descriptors. We keep track of the largest wd that we get out of
idr_get_new_above, and pass that to idr_get_new_above. I have noticed
though, that idr_get_new_above always returns the first available id.
This causes a serious problem for inotify, because user space will get a
IGNORE event for a wd K that might refer to the last holder of the K.

-- 
John McCutchan <ttb@tentacle.dhs.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* [patch] inotify: idr_get_new_above not working?
  2005-08-15 14:16 idr_get_new_above not working? John McCutchan
@ 2005-08-15 16:27 ` Robert Love
  2005-08-15 16:35   ` John McCutchan
  0 siblings, 1 reply; 3+ messages in thread
From: Robert Love @ 2005-08-15 16:27 UTC (permalink / raw)
  To: Linus Torvalds, John McCutchan; +Cc: Andrew Morton, linux-kernel, jim.houston

On Mon, 2005-08-15 at 10:16 -0400, John McCutchan wrote:

> Inotify is using idr_get_new_above to make sure that the next watch
> descriptor is larger/different than any of the previous watch
> descriptors. We keep track of the largest wd that we get out of
> idr_get_new_above, and pass that to idr_get_new_above. I have noticed
> though, that idr_get_new_above always returns the first available id.
> This causes a serious problem for inotify, because user space will get a
> IGNORE event for a wd K that might refer to the last holder of the K.

Turns out that the problem was in our court and not the idr layer.
idr_get_new_above() seems to work fine.

One-line patch is attached.  Please merge before 2.6.13.

	Robert Love


We are saving the wrong thing in ->last_wd.  We want the wd, not the return
value.

Signed-off-by: Robert Love <rml@novell.com>

 fs/inotify.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

diff -urN linux-2.6.13-rc6-git2/fs/inotify.c linux/fs/inotify.c
--- linux-2.6.13-rc6-git2/fs/inotify.c	2005-08-09 16:52:16.000000000 -0400
+++ linux/fs/inotify.c	2005-08-15 12:21:18.000000000 -0400
@@ -402,7 +402,7 @@
 		return ERR_PTR(ret);
 	}
 
-	dev->last_wd = ret;
+	dev->last_wd = watch->wd;
 	watch->mask = mask;
 	atomic_set(&watch->count, 0);
 	INIT_LIST_HEAD(&watch->d_list);



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [patch] inotify: idr_get_new_above not working?
  2005-08-15 16:27 ` [patch] inotify: " Robert Love
@ 2005-08-15 16:35   ` John McCutchan
  0 siblings, 0 replies; 3+ messages in thread
From: John McCutchan @ 2005-08-15 16:35 UTC (permalink / raw)
  To: Robert Love; +Cc: Linus Torvalds, Andrew Morton, linux-kernel, jim.houston

On Mon, 2005-08-15 at 12:27 -0400, Robert Love wrote:
> On Mon, 2005-08-15 at 10:16 -0400, John McCutchan wrote:
> 
> > Inotify is using idr_get_new_above to make sure that the next watch
> > descriptor is larger/different than any of the previous watch
> > descriptors. We keep track of the largest wd that we get out of
> > idr_get_new_above, and pass that to idr_get_new_above. I have noticed
> > though, that idr_get_new_above always returns the first available id.
> > This causes a serious problem for inotify, because user space will get a
> > IGNORE event for a wd K that might refer to the last holder of the K.
> 
> Turns out that the problem was in our court and not the idr layer.
> idr_get_new_above() seems to work fine.
> 
> One-line patch is attached.  Please merge before 2.6.13.

My bad! Patch looks correct.

Signed-off-by: John McCutchan <ttb@tentacle.dhs.org>


-- 
John McCutchan <ttb@tentacle.dhs.org>

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2005-08-15 16:35 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2005-08-15 14:16 idr_get_new_above not working? John McCutchan
2005-08-15 16:27 ` [patch] inotify: " Robert Love
2005-08-15 16:35   ` John McCutchan

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox