mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH] fs/notify/inotify: decrement user inotify count on close
@ 2009-07-02  4:56 Keith Packard
  2009-07-02 12:14 ` Eric Paris
  0 siblings, 1 reply; 4+ messages in thread
From: Keith Packard @ 2009-07-02  4:56 UTC (permalink / raw)
  To: linux-kernel; +Cc: john, rlove, eparis, Keith Packard

The per-user inotify_devs value is incremented each time a new file is
allocated, but never decremented. This led to inotify_init failing after a
limited number of calls.

Signed-off-by: Keith Packard <keithp@keithp.com>
---
 fs/notify/inotify/inotify_user.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/fs/notify/inotify/inotify_user.c b/fs/notify/inotify/inotify_user.c
index ff231ad..ff27a29 100644
--- a/fs/notify/inotify/inotify_user.c
+++ b/fs/notify/inotify/inotify_user.c
@@ -296,12 +296,15 @@ static int inotify_fasync(int fd, struct file *file, int on)
 static int inotify_release(struct inode *ignored, struct file *file)
 {
 	struct fsnotify_group *group = file->private_data;
+	struct user_struct *user = group->inotify_data.user;
 
 	fsnotify_clear_marks_by_group(group);
 
 	/* free this group, matching get was inotify_init->fsnotify_obtain_group */
 	fsnotify_put_group(group);
 
+	atomic_dec(&user->inotify_devs);
+
 	return 0;
 }
 
-- 
1.6.3.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fs/notify/inotify: decrement user inotify count on close
  2009-07-02  4:56 [PATCH] fs/notify/inotify: decrement user inotify count on close Keith Packard
@ 2009-07-02 12:14 ` Eric Paris
  2009-07-26 15:46   ` Alex Riesen
  0 siblings, 1 reply; 4+ messages in thread
From: Eric Paris @ 2009-07-02 12:14 UTC (permalink / raw)
  To: Keith Packard; +Cc: linux-kernel, john, rlove, eparis

On Wed, 2009-07-01 at 21:56 -0700, Keith Packard wrote:
> The per-user inotify_devs value is incremented each time a new file is
> allocated, but never decremented. This led to inotify_init failing after a
> limited number of calls.
> 
> Signed-off-by: Keith Packard <keithp@keithp.com>

Thanks, I will push to Linus later today, sorry about the regression!

-Eric


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fs/notify/inotify: decrement user inotify count on close
  2009-07-02 12:14 ` Eric Paris
@ 2009-07-26 15:46   ` Alex Riesen
  2009-07-26 15:57     ` Alex Riesen
  0 siblings, 1 reply; 4+ messages in thread
From: Alex Riesen @ 2009-07-26 15:46 UTC (permalink / raw)
  To: Eric Paris; +Cc: Keith Packard, linux-kernel, john, rlove, eparis

On Thu, Jul 2, 2009 at 14:14, Eric Paris<eparis@redhat.com> wrote:
> On Wed, 2009-07-01 at 21:56 -0700, Keith Packard wrote:
>> The per-user inotify_devs value is incremented each time a new file is
>> allocated, but never decremented. This led to inotify_init failing after a
>> limited number of calls.
>>
>> Signed-off-by: Keith Packard <keithp@keithp.com>
>
> Thanks, I will push to Linus later today, sorry about the regression!
>

Hmm... Either the patch wasn't enough, or it was broken again.
On v2.6.31-rc4, I get this:

  # echo 10 >/proc/sys/fs/inotify/max_user_watches
  # inotifywatch -r /usr/lib # generate watches up to the limit
  Establishing watches...
  Failed to watch /bin; upper limit on inotify watches reached!
  Please increase the amount of inotify watches allowed per user via
`/proc/sys/fs/inotify/max_user_watches'.
  # inotifywatch /bin/true # just one watch for just one file

AFAIU, the second inotifywatch should work, and the watches of the first,
failed, run must be cleared.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] fs/notify/inotify: decrement user inotify count on close
  2009-07-26 15:46   ` Alex Riesen
@ 2009-07-26 15:57     ` Alex Riesen
  0 siblings, 0 replies; 4+ messages in thread
From: Alex Riesen @ 2009-07-26 15:57 UTC (permalink / raw)
  To: Eric Paris; +Cc: Keith Packard, linux-kernel, john, rlove, eparis

On Sun, Jul 26, 2009 at 17:46, Alex Riesen<raa.lkml@gmail.com> wrote:
> On Thu, Jul 2, 2009 at 14:14, Eric Paris<eparis@redhat.com> wrote:
>> On Wed, 2009-07-01 at 21:56 -0700, Keith Packard wrote:
>>> The per-user inotify_devs value is incremented each time a new file is
>>> allocated, but never decremented. This led to inotify_init failing after a
>>> limited number of calls.
>>>
>>> Signed-off-by: Keith Packard <keithp@keithp.com>
>>
>> Thanks, I will push to Linus later today, sorry about the regression!
>>
>
> Hmm... Either the patch wasn't enough, or it was broken again.

The bug seem to be known since 2.6.28:

   http://bugzilla.kernel.org/show_bug.cgi?id=12754

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2009-07-26 15:57 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-07-02  4:56 [PATCH] fs/notify/inotify: decrement user inotify count on close Keith Packard
2009-07-02 12:14 ` Eric Paris
2009-07-26 15:46   ` Alex Riesen
2009-07-26 15:57     ` Alex Riesen

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®