Re: Inotify problem [was Re: 2.6.13-rc6-mm1]

Johannes Berg
2005-08-25T14:13:29Z

[-- Attachment #1: Type: text/plain, Size: 1282 bytes --]

On Thu, 2005-08-25 at 10:06 -0400, John McCutchan wrote:
> > it fails on 2.6.13-rc6 as soon as the device is full and doesn't hold
> > any more directories.

Obviously this wasn't true, I was hitting the 8192 watches limit and
misinterpreted the error message. I just tested up to 100000 watches
with this program.

> Could you send me the new test program?

Below.

johannes

/* Author: Johannes Berg <johannes@sipsolutions.net>
*
* This is another small inotify test program that simply
* repeatedly adds watches.
*/

#include <stdio.h>
#include <linux/inotify.h>
#include <linux/inotify-syscalls.h>

int main()
{
int fd;
int wd1, wd2;
int ret, i = 0;
char buf[1024];

fd = inotify_init();

if (fd < 0)
perror("inotify_init");

printf("inotify_init returned fd %d\n", fd);

mkdir("/tmp/inotify-test-dir-rm-rf-this", 0777);

while (1) {
i++;
snprintf(buf,sizeof(buf),"/tmp/inotify-test-dir-rm-rf-this/%d",i>>10);
mkdir(buf,0777);
snprintf(buf,sizeof(buf),"/tmp/inotify-test-dir-rm-rf-this/%d/%d",i>>10,i);
mkdir(buf, 0777);
wd1 = inotify_add_watch(fd, buf, IN_ALL_EVENTS);

if (wd1 < 0) {
perror("inotify_add_watch");
break;
}
printf("inotify_add_watch returned wd1 %d\n", wd1);
}
}

[-- Attachment #2: This is a digitally signed message part --]
[-- Type: application/pgp-signature, Size: 832 bytes --]