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

From: Johannes Berg
Date: Thu Aug 25 2005 - 09:13:46 EST


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@xxxxxxxxxxxxxxxx>
*
* 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: signature.asc
Description: This is a digitally signed message part