summaryrefslogtreecommitdiffstats
path: root/xlators/mount/fuse/src
diff options
context:
space:
mode:
authorKotresh HR <khiremat@redhat.com>2019-11-18 05:24:33 -0500
committerAmar Tumballi <amarts@gmail.com>2019-12-10 05:07:19 +0000
commit400cf809ed24ffb506fed6edd510643be406e3ea (patch)
treeafeb5988eac19556f1837b4b4965dfd78128a100 /xlators/mount/fuse/src
parentd30c0b5fa4dba283587cb77a95a79b395cad8e1b (diff)
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 <khiremat@redhat.com>
Diffstat (limited to 'xlators/mount/fuse/src')
-rw-r--r--xlators/mount/fuse/src/fuse-bridge.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/xlators/mount/fuse/src/fuse-bridge.c b/xlators/mount/fuse/src/fuse-bridge.c
index 5b24310f880..5bfaf2c2ac1 100644
--- a/xlators/mount/fuse/src/fuse-bridge.c
+++ b/xlators/mount/fuse/src/fuse-bridge.c
@@ -1647,6 +1647,14 @@ fattr_to_gf_set_attr(int32_t valid)
gf_valid |= GF_SET_ATTR_CTIME;
#endif
+#if FUSE_KERNEL_MINOR_VERSION >= 9
+ if (valid & FATTR_ATIME_NOW)
+ gf_valid |= GF_ATTR_ATIME_NOW;
+
+ if (valid & FATTR_MTIME_NOW)
+ gf_valid |= GF_ATTR_MTIME_NOW;
+#endif
+
if (valid & FATTR_SIZE)
gf_valid |= GF_SET_ATTR_SIZE;