lkml.org 
[lkml]   [2001]   [Oct]   [22]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: Kernel Compile in tmpfs crumples in 2.4.12 w/epoll patch
On Mon, Oct 22, 2001 at 01:03:16PM -0400, bill davidsen wrote:
> In article <9qv1to$ase$1@penguin.transmeta.com> torvalds@transmeta.com wrote:
> | If somebody has a good suggestion for what could be used as a reasonably
> | efficient "cookie" for virtual filesystems like tmpfs, speak up. In the
> | meantime, one way to _mostly_ avoid this should be to give a big buffer
> | to readdir(), so that you end up getting all entries in one go (which
> | will be protected by the semaphore inside the kernel), rather than
> | having to do multiple readdir() calls.
>
> Generally "do it all at one go" solutions don't scale, and sooner of
> later break on a large case.

OK, here's what we are proposing to do in BitKeeper as a work around:

replace readdir() with an internal getdir() function

getdir() returns all directory entries in a sorted list
getdir() works by doing

for (;;) {
lstat(dir);
while (e = readdir(..)) save(e->d_name);
lstat(dir)
if (dir size && dir mtime have NOT changed) break;
cleanup the array and go start over
}
sort entries
return sorted list

The basic idea being that we first of all narrow the race window and
second of all detect the race in all cases where the mods to the dir
result in either a changed mtime or a changed size. So yes, that leaves
us open to cases where the size didn't change but the contents did but
I'll be ding danged if I can see a way around that.

As for the sorting, we want deterministic ordering of the entries for
our own reasons. It also means that we can do the duplicate suppression
in the list processing.

Anyone see a fixable flaw in this approach?
--
---
Larry McVoy lm at bitmover.com http://www.bitmover.com/lm
-
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/

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