path: root/tests/basic
diff options
authorKotresh HR <>2019-11-18 05:24:33 -0500
committerAmar Tumballi <>2019-12-10 05:07:19 +0000
commit400cf809ed24ffb506fed6edd510643be406e3ea (patch)
treeafeb5988eac19556f1837b4b4965dfd78128a100 /tests/basic
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 <>
Diffstat (limited to 'tests/basic')
1 files changed, 28 insertions, 0 deletions
diff --git a/tests/basic/ctime/ctime-utimesat.t b/tests/basic/ctime/ctime-utimesat.t
new file mode 100644
index 0000000..540e57a
--- /dev/null
+++ b/tests/basic/ctime/ctime-utimesat.t
@@ -0,0 +1,28 @@
+. $(dirname $0)/../../include.rc
+. $(dirname $0)/../../volume.rc
+. $(dirname $0)/../../afr.rc
+TEST glusterd
+TEST pidof glusterd
+TEST $CLI volume create $V0 replica 3 $H0:$B0/${V0}{0,1,2}
+TEST $CLI volume set $V0 performance.stat-prefetch off
+TEST $CLI volume set $V0 off
+TEST $CLI volume set $V0 performance.quick-read off
+TEST $CLI volume set $V0 off
+TEST $CLI volume set $V0 off
+TEST $CLI volume set $V0 performance.write-behind off
+TEST $CLI volume set $V0 off
+TEST $CLI volume start $V0
+TEST glusterfs --volfile-id=$V0 --volfile-server=$H0 --entry-timeout=0 $M0;
+touch $M0/FILE
+atime=$(stat -c "%.X" $M0/FILE)
+EXPECT $atime stat -c "%.Y" $M0/FILE
+EXPECT $atime stat -c "%.Z" $M0/FILE