2004-11-30 09:30:18

by Holger Kiehl

[permalink] [raw]
Subject: Problems with 2.6.10-rc2-bk12 and directory entries

Hello

Using 2.6.10-rc2-bk12 on a dual Xeon which serves files at a high rate
(>200 files/second), I noticed that when doing:

ptr = dirname + strlen(dirname);
dp = opendir(dirname);
while ((dirp = readdir(dp)) != NULL)
{
if ((dirp->d_name[0] == '.') && ((dirp->d_name[1] == '\0') ||
((dirp->d_name[1] == '.') && (dirp->d_name[2] == '\0'))))
{
continue;
}
strcpy(ptr, dirp->d_name);
if (unlink(dirname) == -1)
{
if (errno == ENOENT)
{
print some error
}
}
}

That under higher load it happens that the unlink fails with ENOENT. And
this is true because the file was unlinked by a previous call. So it seems
that readdir() returns some file name that has already been removed.
This is not the only place, I have other code pathes where this also happens,
for example where I move the files away instead of unlinking.

This did not happen with 2.6.7 or any kernels before that. Filesystem is
ext3 without any extensions.

Is this a known problem? What can I do to resolve this?

Thanks,
Holger

PS: Please CC me since I am not on the list.