[Top][All Lists]

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

time coherency issue between libdiskfs and ext2fs

From: Samuel Thibault
Subject: time coherency issue between libdiskfs and ext2fs
Date: Tue, 10 Feb 2009 02:34:16 +0100
User-agent: Mutt/1.5.12-2006-07-14


There is a time coherency issue between libdiskfs and ext2fs: say a
program does:

        fd = open ("foo", O_CREAT | RDONLY, 0777);
        fstat (fd, &stat1);
        close (fd);


        stat ("foo", &stat2);

then timespec_cmp (&stat1.st_atim, &stat2.st_atim) will almost never
return 0, because the tv_nsec field is 0 in stat2 and most probably not
0 in stat1.  The reason is that in the first stat case, that's libdiskfs
that answers, from its struct node values.  In the second case, after
the file got closed, flushed to disk and struct node freed, ext2fs
has to read the values from the disk, but the EXT2 FS doesn't have ns
precision, and thus ext2fs fills the tv_nsec field with 0...

Linux doesn't have the issue because there apparently it's up to the
FS to round values up (I could see that on a machine that has both
second- and ns-precision filesystems).  Maybe we should do the same: in
the diskfs_S_file_utimes () and diskfs_set_node_times () functions, we
could call an FS-provided function that rounds values to what the FS can
actually hold, so as to keep time coherency.  What do you think?

The long story is that the Debian g++-* packages have a bogus
libstdc++.so symlink.  That is because it uses dh_movefiles to move it,
which uses tar, which in that particular case (because the linked path
contains "../") creates a temporary file and later replaces it with a
real symlink, but not if the temporary file seems to have changed in
between, and it does change: the stat time fields get rounded.


reply via email to

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