| So if I am adding files while reading the directory the directory
| structure gets rewritten and I might return files more than once?
| What happens if files are being deleted? Can files be skipped?!?
|
| Any reason we have never seen this on ext2 on other filesystems on 10+
| versions of UNIX? BitKeeper is pretty paranoid and includes a lot of
| sanity checks.
I think you can see this on any typical UNIX directory. Assume that a
directory is created with some number of entries. Assume then that the
first ten or so are deleted. Then start your program doing readdir().
After reading a few entries, create a file in that directory. When the
deleted directory entry is reused you have already read past it, and
will not see it until the next time you read the directory.
Obviously there is a timing window here, but I used to see this with
usenet news when each article was in a separate file and files were
created and deleted in large numbers. Missing a file doesn't seem to be
a problem, because the behaviour is the same as if the file were created
after the readdir() pass, but getting the same directory entry more than
once is likely to produce anything from confusing output to serious
malfunction, depending on what's done with the informaction.
-- bill davidsen <davidsen@tmr.com> His first management concern is not solving the problem, but covering his ass. If he lived in the middle ages he'd wear his codpiece backward. - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/