diff options
-rw-r--r-- | libglusterfs/src/glusterfs/xlator.h | 2 | ||||
-rw-r--r-- | tests/basic/ctime/ctime-utimesat.t | 28 | ||||
-rwxr-xr-x | xlators/features/utime/src/utime-gen-fops-c.py | 10 | ||||
-rw-r--r-- | xlators/mount/fuse/src/fuse-bridge.c | 8 |
4 files changed, 48 insertions, 0 deletions
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) diff --git a/tests/basic/ctime/ctime-utimesat.t b/tests/basic/ctime/ctime-utimesat.t new file mode 100644 index 00000000000..540e57aec83 --- /dev/null +++ b/tests/basic/ctime/ctime-utimesat.t @@ -0,0 +1,28 @@ +#!/bin/bash +. $(dirname $0)/../../include.rc +. $(dirname $0)/../../volume.rc +. $(dirname $0)/../../afr.rc +cleanup; + +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 performance.read-ahead off +TEST $CLI volume set $V0 performance.quick-read off +TEST $CLI volume set $V0 performance.read-after-open off +TEST $CLI volume set $V0 performance.open-behind off +TEST $CLI volume set $V0 performance.write-behind off +TEST $CLI volume set $V0 performance.io-cache 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 + +cleanup diff --git a/xlators/features/utime/src/utime-gen-fops-c.py b/xlators/features/utime/src/utime-gen-fops-c.py index 8730a51d13e..9fb3e1b8b1a 100755 --- a/xlators/features/utime/src/utime-gen-fops-c.py +++ b/xlators/features/utime/src/utime-gen-fops-c.py @@ -95,6 +95,16 @@ gf_utime_@NAME@ (call_frame_t *frame, xlator_t *this, frame->root->flags |= MDATA_CTIME; } + if (valid & (GF_SET_ATTR_ATIME | GF_SET_ATTR_MTIME)) { + if (valid & GF_ATTR_ATIME_NOW) { + frame->root->ctime.tv_sec = stbuf->ia_atime; + frame->root->ctime.tv_nsec = stbuf->ia_atime_nsec; + } else if (valid & GF_ATTR_MTIME_NOW) { + frame->root->ctime.tv_sec = stbuf->ia_mtime; + frame->root->ctime.tv_nsec = stbuf->ia_mtime_nsec; + } + } + STACK_WIND (frame, gf_utime_@NAME@_cbk, FIRST_CHILD(this), FIRST_CHILD(this)->fops->@NAME@, @SHORT_ARGS@); return 0; 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; |