lkml.org 
[lkml]   [2004]   [Apr]   [1]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: Linux 2.6 nanosecond time stamp weirdness breaks GCC build
Date
On Thu, Apr 01, 2004 at 10:09:57PM +0200, Andi Kleen wrote:

> just round up to the next second instead of rounding down when going
> from 1s resolution to ns.

Please don't do that. Longstanding tradition in timestamp code is to
truncate toward minus infinity when converting from a
higher-resolution timestamp to a lower-resolution timestamp. This
is consistent behavior, and is easy to explain: let's stick to it as a
uniform practice.

There are two basic principles here. First, ordinary files should not
change spontaneously: hence a file's timestamp should not change
merely because its inode is no longer cached. Second, a file's
timestamp should never be "in the future": hence one should never
round such timestamps up.

The only way I can see to satisfy these two principles is to truncate
the timestamp right away, when it is first put into the inode cache.
That way, the copy in main memory equals what will be put onto disk.
This is the approach taken by other operating systems like Solaris,
and it explains why parallel GCC builds won't have this problem on
these other systems.

Switching subjects slightly, in
<http://mail.gnu.org/archive/html/bug-coreutils/2004-03/msg00095.html>
I recently contributed code to coreutils that fixes some bugs with "cp
--update" and "mv --update" when files are copied from
high-resolution-timestamp file systems to low-resolution-timestamp
file systems. This code dynamically determines the timestamp
resolution of a file system by examining (and possibly mutating) its
timestamps. The current Linux+ext3 behavior (which I did not know
about) breaks this code, because it can cause "cp" to falsely think
that ext3 has nanosecond-resolution timestamps.

How long has the current Linux+ext3 behavior been in place? If it's
widespread, I'll probably have to think about adding a workaround to
coreutils. Does the behavior affect all Linux filesystems, or just
ext3?

I'll CC: this message to bug-coreutils to give them a heads-up.
-
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 14:02    [from the cache]
©2003-2011 Jasper Spaans