[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Monotone-devel] slow update/status on NFS

From: Zack Weinberg
Subject: Re: [Monotone-devel] slow update/status on NFS
Date: Wed, 23 May 2007 21:16:48 -0700

On 5/23/07, Nathaniel Smith <address@hidden> wrote:
On Wed, May 23, 2007 at 03:12:55PM -0400, Ethan Blanton wrote:
> Is this true on all reasonable filesystems and operating environments?
> I know that there are flavors of Unix out there (maybe *all* flavors
> of Unix older than some age?) which will let you open() and read() a
> directory.

Well, true -- and as mentioned upthread, we might want to notice
symlinks (not to mention even nastier weird files, like fifos that
will just make us block).  So that would suggest a single stat before
opening, not 4...

There are open(2) flags to prevent all of those headaches that I can
think of (O_NOFOLLOW|O_NONBLOCK|O_NOCTTY should do it, in fact), and
it can be nearly twice as fast to do open() and then fstat() as
[l]stat and then open()... and there's no race then, either.  This
*will* open a directory or device file, but that is harmless; we just
don't try to read from it.  It won't open a symlink, which is actually
a bug in Unix (there is no race-free way to read the content of a

Perhaps I should borrow the code I wrote for GCC, lo these many years
ago, to do just this...


reply via email to

[Prev in Thread] Current Thread [Next in Thread]