[Bugs] [Bug 1401777] New: atime becomes zero when truncating file via ganesha ( or gluster-NFS)

bugzilla at redhat.com bugzilla at redhat.com
Tue Dec 6 04:48:57 UTC 2016


https://bugzilla.redhat.com/show_bug.cgi?id=1401777

            Bug ID: 1401777
           Summary: atime becomes zero when truncating file via ganesha
                    (or gluster-NFS)
           Product: GlusterFS
           Version: mainline
         Component: posix
          Keywords: Patch, Triaged
          Assignee: ndevos at redhat.com
          Reporter: ndevos at redhat.com
                CC: bugs at gluster.org
            Blocks: 1401122



+++ This bug was initially created as a clone of Bug #1401122 +++

Description of problem:
Ganesha and gluster-NFS can both issue an fop_setattr(GF_SET_ATTR_MTIME)
without also setting GF_SET_ATTR_ATIME.  This will cause posix_setattr() to
issue lutimes() with zero value for atime.
There are slightly different ways to cause the issue in gluster-NFS and
Ganesha, but end result is the same.


Version-Release number of selected component (if applicable):
All versions of gluster


How reproducible: Every time


Steps to Reproduce (gluster-NFS):
1. cp /vmlinuz /nfs/
2. dd if=/vmlinuz of=/nfs/vmlinuz conv=nocreat
3. stat /nfs/vmlinuz

Steps to Reproduce (Ganesha):
1. cp /vmlinuz /ganesha/
2. truncate -s 1000 /ganesha/vmlinuz
3. stat /ganesha/vmlinuz

Actual results:
root at vsan125:~# stat /nfs/vmlinuz
  File: ‘/nfs/vmlinuz’
  Size:  6579344      Blocks: 12851       IO Block: 1048576 regular file
Device: 1ch/28d Inode: 13728026437677438595  Links: 1
Access: (0600/-rw-------)  Uid: (65534/  nobody)   Gid: (4294967294/ UNKNOWN)
Access: 1969-12-31 16:00:00.000000000 -0800
Modify: 2016-12-02 11:07:36.000000000 -0800
Change: 2016-12-02 11:07:36.000000000 -0800
 Birth: -


Expected results:
Access time should not be 0.

Additional info:
Strace of glusterfsd setting atime to zero (in posix_do_utimes):
16332 utimensat(AT_FDCWD,
"/brick/gv5/.glusterfs/ac/b6/acb67218-b076-464e-b6a4-d153d7391e76", {{0, 0},
{1480627988, 0}}, AT_SYMLINK_NOFOLLOW

I have attached a proposed solution.

--- Additional comment from Niels de Vos on 2016-12-06 05:47 CET ---

This patch uses the atime+mtime for missing values from the locally executed
lstat() instead of the values from the passed IATT. It otherwise is pretty much
the same as the other proposed change.


Referenced Bugs:

https://bugzilla.redhat.com/show_bug.cgi?id=1401122
[Bug 1401122] atime becomes zero when truncating file via ganesha (or
gluster-NFS)
-- 
You are receiving this mail because:
You are on the CC list for the bug.
Unsubscribe from this bug https://bugzilla.redhat.com/token.cgi?t=H4K25qtZq5&a=cc_unsubscribe


More information about the Bugs mailing list