idr_get_new_above not working?
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.
Signature · 1 line
John McCutchan <[email protected]>
PATCH 1/1 inotify: idr_get_new_above not working?
Quoted 7 lines · John McCutchan
Inotify is using
idr_get_new_aboveto 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 ofidr_get_new_above, and pass that toidr_get_new_above. I have noticed though, thatidr_get_new_abovealways 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.
fs/inotify.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
fs/inotify.c +1 -1
@@ -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);
Re: [patch] inotify: idr_get_new_above not working?
Quoted 10 lines · Robert Love
Quoted 7 lines · John McCutchan
Inotify is using
idr_get_new_aboveto 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 ofidr_get_new_above, and pass that toidr_get_new_above. I have noticed though, thatidr_get_new_abovealways 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.
Quoted 4 lines
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.
Signature · 1 line
John McCutchan <[email protected]>