2005-05-24 16:40:32

by Bryan Wilkerson

[permalink] [raw]
Subject: inotify 0.23 errno 28 (ENOSPC)

Hi,

I read an earlier thread where you said that it was
possible to manually walk a tree and add all
directories to an inotify watch descriptor. I wrote
some code to do this and the ioctl call fails on my
machine after adding 9,977 directories with ENOSPC.

I've attached a small repro case. Just point it at
the base of a large dir tree (e.g. inotify-r ~) to
use.

My kernel is 2.6.12-rc3 with the inotify 0.23 patch.
Let me know if you need more information.

Please cc my e-mail addr in all replies.

Thanks,

-bryan


Attachments:
inotify-r.c (2.09 kB)
1249210018-inotify-r.c

2005-05-24 16:40:28

by Robert Love

[permalink] [raw]
Subject: Re: inotify 0.23 errno 28 (ENOSPC)

On Tue, 2005-05-24 at 09:33 -0700, Bryan Wilkerson wrote:

> I read an earlier thread where you said that it was
> possible to manually walk a tree and add all
> directories to an inotify watch descriptor. I wrote
> some code to do this and the ioctl call fails on my
> machine after adding 9,977 directories with ENOSPC.
>
> I've attached a small repro case. Just point it at
> the base of a large dir tree (e.g. inotify-r ~) to
> use.
>
> My kernel is 2.6.12-rc3 with the inotify 0.23 patch.
> Let me know if you need more information.

This is intended. There is a per-user limit on the number of watches.
By default, that limit is 8192.

You can view and edit the number via
/sys/class/misc/inotify/max_user_watches

Best,

Robert Love


2005-05-24 17:02:11

by Robert Love

[permalink] [raw]
Subject: Re: inotify 0.23 errno 28 (ENOSPC)

On Tue, 2005-05-24 at 18:52 +0200, Arjan van de Ven wrote:

> why isn't this an rlimit instead ?

Definitely could be.

Since inotify is built as a driver, the sysfs entry made sense, and it
sure is easier to implement.

But I'd have no problem with an rlimit. We don't seem to add those
frequently, though.

Robert Love


2005-05-24 17:12:24

by Arjan van de Ven

[permalink] [raw]
Subject: Re: inotify 0.23 errno 28 (ENOSPC)

On Tue, 2005-05-24 at 12:35 -0400, Robert Love wrote:
> On Tue, 2005-05-24 at 09:33 -0700, Bryan Wilkerson wrote:
>
> > I read an earlier thread where you said that it was
> > possible to manually walk a tree and add all
> > directories to an inotify watch descriptor. I wrote
> > some code to do this and the ioctl call fails on my
> > machine after adding 9,977 directories with ENOSPC.
> >
> > I've attached a small repro case. Just point it at
> > the base of a large dir tree (e.g. inotify-r ~) to
> > use.
> >
> > My kernel is 2.6.12-rc3 with the inotify 0.23 patch.
> > Let me know if you need more information.
>
> This is intended. There is a per-user limit on the number of watches.
> By default, that limit is 8192.
>
> You can view and edit the number via
> /sys/class/misc/inotify/max_user_watches

why isn't this an rlimit instead ?