All of lore.kernel.org
 help / color / mirror / Atom feed
From: John McCutchan <ttb@tentacle.dhs.org>
To: jim.houston@comcast.net
Cc: linux-kernel@vger.kernel.org, george@mvista.com, rml@novell.com,
	akpm@osdl.org, johannes@sipsolutions.net
Subject: Re: Inotify problem [was Re: 2.6.13-rc6-mm1]
Date: Fri, 26 Aug 2005 13:52:44 -0400	[thread overview]
Message-ID: <1125078764.13243.6.camel@vertex> (raw)
In-Reply-To: <1125075832.2783.99.camel@new.localdomain>

On Fri, 2005-08-26 at 13:03 -0400, Jim Houston wrote:
> Hi Everyone,
> 
> I'm answering this from my home email. I have not heard from my
> co-workers in Florida yet, and I imagine that they are busy cleaning up
> after hurricane Katrina and waiting for the power to come back on.
> 
> It looks like we have an "off by one" problem with idr_get_new_above()
> which may be part of the inotify problem.  I'm not sure if the problem
> is the behavior or the name & comments.  The start_id parameter is the
> starting point for the idr allocation search, and if it is available, it
> will be allocated.  If you pass in the last id allocated as the start_id
> and it has already been freed (by an idr_remove call), it will be
> allocated again.  The obvious fix would be to increment start_id
> in idr_get_new_above().

Thanks for your suggestion, it has fixed the inotify problem. But where
to put the fix is turning into a bit of a mess. Some callers like
drivers/md/dm.c:682 call idr_get_new_above as if it will return >=
starting_id. The comment says that it will return > starting_id, and the
function name leads people to believe the same thing. In the patch below
I change inotify do add one to the value was pass into idr. I also
change the comment to more accurately reflect what the function does.
The function name doesn't fit, but it never did.

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

Index: linux/fs/inotify.c
===================================================================
--- linux.orig/fs/inotify.c	2005-08-26 13:38:29.000000000 -0400
+++ linux/fs/inotify.c	2005-08-26 13:38:55.000000000 -0400
@@ -353,7 +353,7 @@
 	do {
 		if (unlikely(!idr_pre_get(&dev->idr, GFP_KERNEL)))
 			return -ENOSPC;
-		ret = idr_get_new_above(&dev->idr, watch, dev->last_wd, &watch->wd);
+		ret = idr_get_new_above(&dev->idr, watch, dev->last_wd+1, &watch->wd);
 	} while (ret == -EAGAIN);
 
 	return ret;
Index: linux/lib/idr.c
===================================================================
--- linux.orig/lib/idr.c	2005-08-26 13:38:22.000000000 -0400
+++ linux/lib/idr.c	2005-08-26 13:39:08.000000000 -0400
@@ -207,7 +207,7 @@
 }
 
 /**
- * idr_get_new_above - allocate new idr entry above a start id
+ * idr_get_new_above - allocate new idr entry above or equal to a start id
  * @idp: idr handle
  * @ptr: pointer you want associated with the ide
  * @start_id: id to start search at


  reply	other threads:[~2005-08-26 17:52 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-08-26 17:03 Inotify problem [was Re: 2.6.13-rc6-mm1] Jim Houston
2005-08-26 17:52 ` John McCutchan [this message]
2005-08-26 17:56   ` Robert Love
     [not found] <fa.h7s290f.i6qp37@ifi.uio.no>
     [not found] ` <fa.e1uvbs1.l407h7@ifi.uio.no>
2005-08-25 10:07   ` Reuben Farrelly
2005-08-25 12:18     ` Johannes Berg
2005-08-25 13:40       ` John McCutchan
2005-08-25 13:47         ` Robert Love
2005-08-25 14:03           ` Johannes Berg
2005-08-25 14:06             ` John McCutchan
2005-08-25 14:13               ` Johannes Berg
2005-08-25 14:39                 ` John McCutchan
2005-08-25 14:13           ` John McCutchan
2005-08-25 14:41             ` Johannes Berg
2005-08-25 15:16               ` John McCutchan
2005-08-25 13:50         ` Johannes Berg
2005-08-25 14:03           ` John McCutchan
2005-08-25 13:33     ` John McCutchan
2005-08-25 15:18       ` Robert Love
2005-08-25 18:54         ` George Anzinger
2005-08-25 19:03           ` Johannes Berg
2005-08-25 19:06             ` John McCutchan
2005-08-25 19:04           ` John McCutchan
2005-08-25 23:10             ` George Anzinger
2005-08-25 23:20               ` Johannes Berg

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1125078764.13243.6.camel@vertex \
    --to=ttb@tentacle.dhs.org \
    --cc=akpm@osdl.org \
    --cc=george@mvista.com \
    --cc=jim.houston@comcast.net \
    --cc=johannes@sipsolutions.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rml@novell.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.