aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn McCutchan <ttb@tentacle.dhs.org>2005-08-26 14:02:04 -0400
committerLinus Torvalds <torvalds@g5.osdl.org>2005-08-26 14:32:57 -0400
commit7c657f2f25d50c602df9291bc6242b98fc090759 (patch)
tree5e1ae11c320ea00488b33224cc982d0be2d986d6
parent755528c860b05fcecda1c88a2bdaffcb50760a7f (diff)
[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 <ttb@tentacle.dhs.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
-rw-r--r--fs/inotify.c2
-rw-r--r--lib/idr.c2
2 files changed, 2 insertions, 2 deletions
diff --git a/fs/inotify.c b/fs/inotify.c
index 868901b1e779..2e4e2a57708c 100644
--- a/fs/inotify.c
+++ b/fs/inotify.c
@@ -353,7 +353,7 @@ static int inotify_dev_get_wd(struct inotify_device *dev,
353 do { 353 do {
354 if (unlikely(!idr_pre_get(&dev->idr, GFP_KERNEL))) 354 if (unlikely(!idr_pre_get(&dev->idr, GFP_KERNEL)))
355 return -ENOSPC; 355 return -ENOSPC;
356 ret = idr_get_new_above(&dev->idr, watch, dev->last_wd, &watch->wd); 356 ret = idr_get_new_above(&dev->idr, watch, dev->last_wd+1, &watch->wd);
357 } while (ret == -EAGAIN); 357 } while (ret == -EAGAIN);
358 358
359 return ret; 359 return ret;
diff --git a/lib/idr.c b/lib/idr.c
index c5be889de449..6415d053e2bf 100644
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -207,7 +207,7 @@ build_up:
207} 207}
208 208
209/** 209/**
210 * idr_get_new_above - allocate new idr entry above a start id 210 * idr_get_new_above - allocate new idr entry above or equal to a start id
211 * @idp: idr handle 211 * @idp: idr handle
212 * @ptr: pointer you want associated with the ide 212 * @ptr: pointer you want associated with the ide
213 * @start_id: id to start search at 213 * @start_id: id to start search at