Skip to contentSkip to conversation

getdents, unlink and tmpfs vs otherFS

DISCUSSION Michael Tokarev 1 participant 1 message Jun 27, 2005

lore
Share & tools
lore
#0 lore raw

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