Umm... it's not Linux, but it is POSIX. POSIX states that if a file
is removed or created in a directory in the middle of a readir() scan,
that it's undefined whether or not that file which has been removed or
created will be returned by readdir(). But you're not allowed to
randomly shuffle things around and make files disappear or be returned
multiple times. Otherwise, it becomes impossible for readdir() to be
used reliably --- after all, even if an individual process isn't
deleting or creating files while doing a readdir(), it can't protect
itself from other processes happening to create or delete files while
it's doing an readdir() scan.
> Frankly, I don't see what could be done, short of doing qsort() by inumber
> or something equivalent...
Yup, that's what you'd have to do. Readdir() semantics are a bitch,
and a pain in the *ss for filesystems that are doing something other
than a FFS-style linear directory. Telldir()/seedir() semantics makes
things even worse....
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to email@example.com
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/