inotify: fix the running away counter of user watches
Subsystems (2)
PATCH 1/1 inotify: fix the running away counter of user watches
The counter of userspace inotify watches is incremented when a watch is added, but was never decremented. This patch uses the fsnotify callback (freeing_marks, which in turn calls inotify_ignored_and_remove_idr of inotify userspace interface) called when an fsnotify mark is removed.
The bug has been reported in
http://bugzilla.kernel.org/show_bug.cgi?id=12754
---
Sorry for long Cc:, I'm a little confused about "fs_other@" (and the list of participants) in the bug report.
The patch works in my limited testing. I just did:
# echo 10 >/proc/sys/fs/inotify/max_user_watches
# inotify-watch -r /lib # to max the counter
Ctrl-C
# inotify-watch /bin/true # must workin a clean environment (init=/bin/bash).
But I don't know whether it safe to access the counter in this callback, nor am I sure the patch is enough.
fs/notify/inotify/inotify_user.c | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
fs/notify/inotify/inotify_user.c +1 -0
@@ -404,6 +404,7 @@ skip_send_ignore:/* removed from idr, drop that reference */ fsnotify_put_mark (entry); +atomic_dec (&group->inotify_data.user->inotify_watches); }/* ding dong the mark is dead */
Signature · 1 line
1.6.4.rc3.56.g32a7
Quoted 2 lines · Alex Riesen
Sorry for long Cc:, I'm a little confused about "fs_other@" (and the list of participants) in the bug report.
Dumb me. Should have looked at Erics branch first (which _was_ hard to do, infradead.org been that busy).
For reference: fixed in mainline 5549f7cdf84c02939fd368d0842aa2f472bb6e98