From ce8d8195dc253a87cceaaeeb1a725090471ae4f8 Mon Sep 17 00:00:00 2001 From: Niklas Hambüchen Date: Sat, 18 Feb 2017 00:49:02 +0100 Subject: posix: use nanosecond accuracy when available MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Programs that set mtime, such as `rsync -a`, don't work correctly on GlusterFS, because it sets the nanoseconds to 000. This creates problems for incremental backups, where files get accidentally copied again and again. For example, consider `myfile` on an ext4 system, being copied to a GlusterFS volume, with `rsync -a` and then `cp -u` in turn. You'd expect that after the first `rsync -a`, `cp -u` agrees that the file need not be copied. BUG: 1422074 Change-Id: I89c7b6a73e2e06c02851ff76b7e5cdfaa271e985 Signed-off-by: Niklas Hambüchen Reviewed-on: https://review.gluster.org/16667 Smoke: Gluster Build System Reviewed-by: Niels de Vos Tested-by: Jeff Darcy NetBSD-regression: NetBSD Build System Reviewed-by: jiffin tony Thottan CentOS-regression: Gluster Build System Reviewed-by: Jeff Darcy --- configure.ac | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'configure.ac') diff --git a/configure.ac b/configure.ac index 6917322bd58..28ff3e5a3f4 100644 --- a/configure.ac +++ b/configure.ac @@ -981,6 +981,13 @@ if test "x${have_posix_fallocate}" = "xyes"; then AC_DEFINE(HAVE_POSIX_FALLOCATE, 1, [define if posix_fallocate exists]) fi +BUILD_NANOSECOND_TIMESTAMPS=no +AC_CHECK_FUNC([utimensat], [have_utimensat=yes]) +if test "x${have_utimensat}" = "xyes"; then + BUILD_NANOSECOND_TIMESTAMPS=yes + AC_DEFINE(HAVE_UTIMENSAT, 1, [define if utimensat exists]) +fi + OLD_CFLAGS=${CFLAGS} CFLAGS="-D_GNU_SOURCE" AC_CHECK_DECL([SEEK_HOLE], , , [#include ]) @@ -1544,4 +1551,5 @@ echo "Experimental xlators : $BUILD_EXPERIMENTAL" echo "Events : $BUILD_EVENTS" echo "EC dynamic support : $EC_DYNAMIC_SUPPORT" echo "Use memory pools : $USE_MEMPOOL" +echo "Nanosecond m/atimes : $BUILD_NANOSECOND_TIMESTAMPS" echo -- cgit