[lkml]   [2001]   [Oct]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
Messages in this thread
SubjectRe: Kernel Compile in tmpfs crumples in 2.4.12 w/epoll patch
On Mon, Oct 22, 2001 at 06:01:32AM -0400, Alexander Viro wrote:
> If you are changing directory between the calls of getdents(2) - you have
> no warranty that offsets will stay stable. It's not just Linux.

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....

- Ted
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

 \ /
  Last update: 2005-03-22 13:12    [W:0.058 / U:1.116 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site