From 400cf809ed24ffb506fed6edd510643be406e3ea Mon Sep 17 00:00:00 2001 From: Kotresh HR Date: Mon, 18 Nov 2019 05:24:33 -0500 Subject: ctime: Fix ctime inconsisteny with utimensat Problem: When touch is used to create a file, the ctime is not matching atime and mtime which ideally should match. There is a difference in nano seconds. Cause: When touch is used modify atime or mtime to current time (UTIME_NOW), the current time is taken from kernel. The ctime gets updated to current time when atime or mtime is updated. But the current time to update ctime is taken from utime xlator. Hence the difference in nano seconds. Fix: When utimesat uses UTIME_NOW, use the current time from kernel. fixes: bz#1773530 Change-Id: I9ccfa47dcd39df23396852b4216f1773c49250ce Signed-off-by: Kotresh HR --- libglusterfs/src/glusterfs/xlator.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'libglusterfs/src/glusterfs') diff --git a/libglusterfs/src/glusterfs/xlator.h b/libglusterfs/src/glusterfs/xlator.h index 6608d6cdf0d..c94bd75cf1c 100644 --- a/libglusterfs/src/glusterfs/xlator.h +++ b/libglusterfs/src/glusterfs/xlator.h @@ -32,6 +32,8 @@ #define GF_SET_ATTR_ATIME 0x10 #define GF_SET_ATTR_MTIME 0x20 #define GF_SET_ATTR_CTIME 0x40 +#define GF_ATTR_ATIME_NOW 0x80 +#define GF_ATTR_MTIME_NOW 0x100 #define gf_attr_mode_set(mode) ((mode)&GF_SET_ATTR_MODE) #define gf_attr_uid_set(mode) ((mode)&GF_SET_ATTR_UID) -- cgit