From: Larry McVoy <lm@bitmover.com>
To: bill davidsen <davidsen@tmr.com>
Cc: linux-kernel@vger.kernel.org,
BitKeeper Development Source <dev@bitmover.com>
Subject: Re: Kernel Compile in tmpfs crumples in 2.4.12 w/epoll patch
Date: Mon, 22 Oct 2001 10:12:12 -0700 [thread overview]
Message-ID: <20011022101212.B24778@work.bitmover.com> (raw)
In-Reply-To: <9qv1to$ase$1@penguin.transmeta.com> <200110221703.f9MH3Gm15955@deathstar.prodigy.com>
In-Reply-To: <200110221703.f9MH3Gm15955@deathstar.prodigy.com>; from davidsen@tmr.com on Mon, Oct 22, 2001 at 01:03:16PM -0400
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
next prev parent reply other threads:[~2001-10-22 17:11 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-10-19 0:06 Kernel Compile in tmpfs crumples in 2.4.12 w/epoll patch David E. Weekly
2001-10-19 0:22 ` Davide Libenzi
2001-10-19 1:26 ` safemode
2001-10-19 5:12 ` Daniel T. Chen
2001-10-19 8:28 ` Christoph Rohland
2001-10-20 15:17 ` Jan-Frode Myklebust
2001-10-21 8:25 ` Christoph Rohland
2001-10-21 10:07 ` Jan-Frode Myklebust
2001-10-20 22:35 ` wild pointer!!!!! Kalyan
2001-10-21 12:21 ` Paul Mackerras
2001-10-21 12:15 ` Kernel Compile in tmpfs crumples in 2.4.12 w/epoll patch safemode
[not found] ` <E15vHVx-0001Nc-00@ii.uib.no>
2001-10-21 12:34 ` Jan-Frode Myklebust
2001-10-21 12:53 ` safemode
[not found] ` <E15vI6n-0001oC-00@ii.uib.no>
2001-10-21 13:10 ` bk regression fails on tmpfs /tmp, was: " Jan-Frode Myklebust
2001-10-21 13:36 ` safemode
2001-10-21 16:35 ` Larry McVoy
2001-10-21 17:50 ` Linus Torvalds
2001-10-21 20:15 ` Daniel Phillips
2001-10-22 17:03 ` bill davidsen
2001-10-22 17:12 ` Larry McVoy [this message]
2001-10-22 17:29 ` Alexander Viro
2001-10-23 5:25 ` Keith Owens
2001-10-22 9:44 ` Christoph Rohland
2001-10-22 10:01 ` Alexander Viro
2001-10-22 13:29 ` Wayne Scott
2001-10-22 17:31 ` bill davidsen
2001-10-30 17:29 ` Theodore Tso
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20011022101212.B24778@work.bitmover.com \
--to=lm@bitmover.com \
--cc=davidsen@tmr.com \
--cc=dev@bitmover.com \
--cc=linux-kernel@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox