getdents, unlink and tmpfs vs otherFS

From: Michael Tokarev
Date: Mon Jun 27 2005 - 11:18:01 EST


I've got a weird problem a while back - my initrd script
does not work when the root is on cciss device. It turned
out to be a problem with $SUBJ. /dev/cciss/ is quite large
(alot of disks and partitions), and when initrd is on tmpfs
(initramfs it really is), and run-init is executed, it tries
to remove /dev/cciss, it fails. And here's why.

uclibc does the following on readdir():

open(.., O_DIRECTORY) = 3
getdents(3, /* 197 entries */, 3933) = 3932
lseek(3, 2728, SEEK_SET) = 2728
unlink(..)
....
getdents(3, /* 85 entries */, 3933) = 1700
unlink()
....
getdents(3, /* 196 entries */, 3933) = 3920
lseek(3, 6816, SEEK_SET) = 6816
....

and finally rmdir() which fails with "Directory
not empty" error.

And eg glibc, or dietlibc, or klibc - it's all
the same but without all the lseek()s, and with
final rmdir() successeful.

It's on tmpfs.

On ext[23], final rmdir succed on both cases,
ie, with and without lseek.

Is it a bug in tmpfs, or in uclibc?

Thanks.

/mjt
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/