From: Alex Riesen <raa.lkml@gmail.com>
To: linux-kernel <linux-kernel@vger.kernel.org>
Cc: fs_other@kernel-bugs.osdl.org,
Russell Bell <russellbell@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
Al Viro <viro@zeniv.linux.org.uk>,
josef@redhat.com, Eric Paris <eparis@redhat.com>,
Robert Love <rlove@rlove.org>,
John McCutchan <john@johnmccutchan.com>
Subject: [PATCH] inotify: fix the running away counter of user watches
Date: Mon, 27 Jul 2009 19:25:42 +0200 [thread overview]
Message-ID: <20090727172542.GA5104@blimp.localdomain> (raw)
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
Signed-off-by: Alex Riesen <raa.lkml@gmail.com>
---
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 work
in 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(-)
diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index ff27a29..c2d94df 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -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 */
--
1.6.4.rc3.56.g32a7
next reply other threads:[~2009-07-27 18:50 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-07-27 17:25 Alex Riesen [this message]
2009-07-28 6:08 ` Alex Riesen
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=20090727172542.GA5104@blimp.localdomain \
--to=raa.lkml@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=eparis@redhat.com \
--cc=fs_other@kernel-bugs.osdl.org \
--cc=john@johnmccutchan.com \
--cc=josef@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=rlove@rlove.org \
--cc=russellbell@gmail.com \
--cc=viro@zeniv.linux.org.uk \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®