futimens, utimensat: work around ntfs-3g bug
authorEric Blake <ebb9@byu.net>
Wed, 30 Dec 2009 13:48:46 +0000 (06:48 -0700)
committerEric Blake <ebb9@byu.net>
Wed, 30 Dec 2009 14:00:54 +0000 (07:00 -0700)
commit0e3e69f9f9b31a7d8516bb9699471db6a43bd3c8
tree5a159af1bef93721162619b110f551b0bc7e5ed3
parente0bf16819c83c3ef1d11bf373f5f90a1f09c534c
futimens, utimensat: work around ntfs-3g bug

With ntfs-3g, use of a single UTIME_OMIT failed to make any change
to the remaining two timestamps.  Furthermore, the previous fix
for ctime happens to be specific to xfs, rather than global to
the kernel.  Therefore, to be valid, a cache would have to be
per-device, which gets too expensive, especially considering that
the cost of a preparatory stat pulls the file into kernel cache
to speed up the resulting utimensat.  So, blindly massage UTIME_OMIT
on Linux, even on working filesystems like ext4.

The bugs in xfs and ntfs-3g were reported to the kernel folks,
and fixes written, but it will be several years before gnulib
can assume that file systems in use have picked up the fixes.

* lib/utimensat.c (rpl_utimensat): Drop attempts to cache whether
a ctime bug is present, and expand workaround to cover ntfs-3g.
* lib/utimens.c (fdutimens, lutimens): Likewise.
(utimensat_ctime_really, detect_ctime_bug): Drop cache mechanism.
(validate_timespec): Adjust return value.
* m4/futimens.m4 (gl_FUNC_FUTIMENS): Update comment.
* m4/utimensat.m4 (gl_FUNC_UTIMENSAT): Likewise.
Reported by ctrn3e8 <ctrn3e8@gmail.com>.

Signed-off-by: Eric Blake <ebb9@byu.net>
ChangeLog
lib/utimens.c
lib/utimensat.c
m4/futimens.m4
m4/utimensat.m4