<div dir="ltr">Overwriting an existing file with O_TRUNC will yield an incorrect atime.<div>Example:</div><div><br></div><div><div>root@vsan123:~# cp /vmlinuz /nfs</div><div>root@vsan123:~# stat /nfs/vmlinuz</div><div>  File: ‘/nfs/vmlinuz’</div><div>  Size: 6565968         Blocks: 12825      IO Block: 1048576 regular file</div><div>Device: 25h/37d Inode: 10266595591654252930  Links: 1</div><div>Access: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/    root)</div><div>Access: 2016-12-01 16:39:48.000000000 -0800</div><div>Modify: 2016-12-01 16:39:48.235275472 -0800</div><div>Change: 2016-12-01 16:39:48.239275472 -0800</div><div> Birth: -</div><div>root@vsan123:~# dd if=/vmlinuz of=/nfs/vmlinuz bs=64k conv=nocreat</div><div>100+1 records in</div><div>100+1 records out</div><div>6565968 bytes (6.6 MB) copied, 0.0271412 s, 242 MB/s</div><div>root@vsan123:~# stat /nfs/vmlinuz</div><div>  File: ‘/nfs/vmlinuz’</div><div>  Size: 6565968         Blocks: 12825      IO Block: 1048576 regular file</div><div>Device: 25h/37d Inode: 10266595591654252930  Links: 1</div><div>Access: (0600/-rw-------)  Uid: (    0/    root)   Gid: (    0/    root)</div><div>Access: 1969-12-31 16:00:00.000000000 -0800</div><div>Modify: 2016-12-01 16:39:57.923275920 -0800</div><div>Change: 2016-12-01 16:39:57.923275920 -0800GF_SET_ATTR_MTIME</div><div> Birth: -</div></div><div><br></div><div>The Access time has been set to zero (or 1970 PST in my case)</div><div><br></div><div>This appears to happen in all versions of gluster.  I think the problem can actually be blamed on posix_setattr().  If one does a FOP_SETATTR and only passes the GF_SET_ATTR_MTIME flag, posix_setattr() will blindly call lutimes() to modify both atime+mtime and atime gets set to 0.</div><div>I think the solution would be to modify posix_setattr() to write back original atime/mtime if one of the flags are not specified.</div><div><br></div><div>I have also seen NFS-Ganesha end up with a zero atime, but it does happen not for the example above on Ganesha.  Ganesha probably does something similar someplace in its code where only GF_SET_ATTR_MTIME is being set.  But, I cannot remember exactly what caused the zero atime on Ganesha.</div><div><br></div><div>All other code in gluster, other than nfsserver, sets both ATIME and MTIME when doing an FOP_SETATTR.  </div><div><br></div><div><br></div><div><br></div></div>