tree 5e1ae11c320ea00488b33224cc982d0be2d986d6
parent 755528c860b05fcecda1c88a2bdaffcb50760a7f
author John McCutchan <[EMAIL PROTECTED]> Fri, 26 Aug 2005 22:02:04 -0400
committer Linus Torvalds <[EMAIL PROTECTED]> Sat, 27 Aug 2005 01:32:57 -0700

[PATCH] Document idr_get_new_above() semantics, update inotify

There is an off by one problem with idr_get_new_above.

The comment and function name suggest that it will return an id >
starting_id, but it actually returned an id >= starting_id, and kernel
callers other than inotify treated it as such.

The patch below fixes the comment, and fixes inotifys usage.  The
function name still doesn't match the behaviour, but it never did.

Signed-off-by: John McCutchan <[EMAIL PROTECTED]>
Signed-off-by: Linus Torvalds <[EMAIL PROTECTED]>

 fs/inotify.c |    2 +-
 lib/idr.c    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/fs/inotify.c b/fs/inotify.c
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -353,7 +353,7 @@ static int inotify_dev_get_wd(struct ino
        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;
diff --git a/lib/idr.c b/lib/idr.c
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -207,7 +207,7 @@ build_up:
 }
 
 /**
- * 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
-
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to