>From 98aa32d0f356ddd0b3d59d856e9f5ceecc110535 Mon Sep 17 00:00:00 2001 From: Niels de Vos Date: Fri, 10 Jan 2014 16:26:18 +0100 Subject: [PATCH] vfs/glusterfs: in case atime is not passed, set it to the mtime The Linux CIFS client does not pass an updated atime when a write() is done. This causes the vfs/glusterfs module to set the atime to -1 on the Gluster backend, resulting in an atime far in the future (year 2106). It is very unfortunate that libgfapi does not have a function that can be used to only set the mtime (or atime for that matter). On the other hand, there is little sense in updating the mtime without modifying the atime too. The practical solution is to use the mtime for the atime as well, but only in the case the atime->tv_sec is set to -1. Signed-off-by: Niels de Vos Reviewed-by: Ira Cooper --- source3/modules/vfs_glusterfs.c | 12 ++++++++++-- 1 files changed, 10 insertions(+), 2 deletions(-) diff --git a/source3/modules/vfs_glusterfs.c b/source3/modules/vfs_glusterfs.c index 3262f11..3cb7e1d 100644 --- a/source3/modules/vfs_glusterfs.c +++ b/source3/modules/vfs_glusterfs.c @@ -734,8 +734,16 @@ static int vfs_gluster_ntimes(struct vfs_handle_struct *handle, { struct timespec times[2]; - times[0].tv_sec = ft->atime.tv_sec; - times[0].tv_nsec = ft->atime.tv_nsec; + if (ft->atime.tv_sec != -1) { + times[0].tv_sec = ft->atime.tv_sec; + times[0].tv_nsec = ft->atime.tv_nsec; + } else { + /* actually atime should not get set, but there is no glfs_* + function that can be used to only set the mtime */ + times[0].tv_sec = ft->mtime.tv_sec; + times[0].tv_nsec = ft->mtime.tv_nsec; + } + times[1].tv_sec = ft->mtime.tv_sec; times[1].tv_nsec = ft->mtime.tv_nsec; -- 1.7.1