Bug 1422074 - GlusterFS truncates nanoseconds to microseconds when setting mtime
Summary: GlusterFS truncates nanoseconds to microseconds when setting mtime
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: GlusterFS
Classification: Community
Component: core
Version: mainline
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: bugs@gluster.org
QA Contact:
URL: http://lists.gluster.org/pipermail/gl...
Whiteboard:
Depends On:
Blocks: 1419733 1422075
TreeView+ depends on / blocked
 
Reported: 2017-02-14 12:26 UTC by Niels de Vos
Modified: 2017-05-30 18:43 UTC (History)
6 users (show)

Fixed In Version: glusterfs-3.11.0
Clone Of: 1419733
: 1422075 (view as bug list)
Environment:
Last Closed: 2017-05-30 18:43:01 UTC
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Embargoed:


Attachments (Terms of Use)

Description Niels de Vos 2017-02-14 12:26:28 UTC
+++ This bug was initially created as a clone of Bug #1419733 +++

Description of problem:

Programs that set mtime, such as `rsync -a`, don't work correctly on GlusterFS, because it sets the nanoseconds to 000.

This creates problems for incremental backups, where files get accidentally copied again and again.

For example, consider `myfile` on an ext4 system, being copied to a GlusterFS volume, with `rsync -a` and then `cp -u` in turn. You'd expect that after the first `rsync -a`, `cp -u` agrees that the file need not be copied.

$ cp -u -v myfile /mnt
'myfile' -> '/mnt/myfile'
$ cp -u -v myfile /mnt
$ rsync -a myfile /mnt
$ cp -u -v myfile /mnt
'myfile' -> '/mnt/myfile'

It copied it again!

Version-Release number of selected component (if applicable):
3.9.1

How reproducible:
Always


Steps to Reproduce:

With gluster mounted on /mnt:

1. rm -f /mnt/myfile && touch /mnt/file
2. # now `stat /mnt/file` shows nanoseconds mtime
3. touch -d '2017-01-01 00:00:00.123456001' /mnt/file

Actual results:
stat shows .123456000, the 001 is gone

Expected results:
stat shows '2017-01-01 00:00:00.123456001'

Additional info:

JoeJulian on IRC pointed at the code:
https://github.com/gluster/glusterfs/blob/c8a23cc6cd289dd28deb136bf2550f28e2761ef3/libglusterfs/src/common-utils.c#L3800-L3841 with the comment:

        /* The granularity is micro seconds as per the current
         * requiremnt. Hence using 'utimes'. This can be updated
         * to 'utimensat' if we need timestamp in nanoseconds.
         */

Please support nano-seconds! It would unbreak lots of backup tools, avoiding unnecessary copying and surprising behaviour.

Comment 1 Worker Ant 2017-02-18 12:29:07 UTC
REVIEW: https://review.gluster.org/16667 (posix: use nanosecond accuracy when available) posted (#1) for review on master by Anonymous Coward

Comment 2 Worker Ant 2017-02-18 20:59:26 UTC
REVIEW: https://review.gluster.org/16667 (posix: use nanosecond accuracy when available) posted (#2) for review on master by Anonymous Coward

Comment 3 Worker Ant 2017-02-28 15:29:04 UTC
REVIEW: https://review.gluster.org/16667 (posix: use nanosecond accuracy when available) posted (#3) for review on master by Niklas Hambüchen

Comment 4 Worker Ant 2017-02-28 15:29:08 UTC
REVIEW: https://review.gluster.org/16789 (tests: Fix and enable split-brain-healing mtime check) posted (#1) for review on master by Niklas Hambüchen

Comment 5 Worker Ant 2017-02-28 15:35:31 UTC
REVIEW: https://review.gluster.org/16789 (tests: Fix and enable split-brain-healing mtime check) posted (#2) for review on master by Niklas Hambüchen

Comment 6 Worker Ant 2017-02-28 15:35:35 UTC
REVIEW: https://review.gluster.org/16667 (posix: use nanosecond accuracy when available) posted (#4) for review on master by Niklas Hambüchen

Comment 7 Worker Ant 2017-02-28 16:39:02 UTC
REVIEW: https://review.gluster.org/16789 (tests: Fix and enable split-brain-healing mtime check) posted (#3) for review on master by Niklas Hambüchen

Comment 8 Worker Ant 2017-03-01 17:29:42 UTC
COMMIT: https://review.gluster.org/16789 committed in master by Jeff Darcy (jdarcy) 
------
commit c78d07fb8efdd5f63284332473852619d5da4244
Author: Niklas Hambüchen <mail>
Date:   Tue Feb 28 14:05:59 2017 +0100

    tests: Fix and enable split-brain-healing mtime check
    
    This test was commented out with the belief that it depended
    on utimensat() support, but in fact it was not necessary because
    `stat -c %Y` only outputs second resolution.
    
    Simply commenting in the test made it fail because it checked
    the values *before* the heal, while intended was to check them
    *after* the heal. This commit fixes that.
    
    Change-Id: I4194ac645b365a1f906a3ac9bcbbdb1f05000e27
    BUG: 1422074
    Signed-off-by: Niklas Hambüchen <mail>
    Reviewed-on: https://review.gluster.org/16789
    Reviewed-by: Ravishankar N <ravishankar>
    Tested-by: Ravishankar N <ravishankar>
    Smoke: Gluster Build System <jenkins.org>
    NetBSD-regression: NetBSD Build System <jenkins.org>
    CentOS-regression: Gluster Build System <jenkins.org>
    Reviewed-by: Niklas Hambüchen

Comment 9 Worker Ant 2017-03-06 16:19:45 UTC
REVIEW: https://review.gluster.org/16667 (posix: use nanosecond accuracy when available) posted (#5) for review on master by Niklas Hambüchen

Comment 10 Worker Ant 2017-03-06 16:24:12 UTC
REVIEW: https://review.gluster.org/16667 (posix: use nanosecond accuracy when available) posted (#6) for review on master by Niklas Hambüchen

Comment 11 Worker Ant 2017-03-07 17:10:06 UTC
COMMIT: https://review.gluster.org/16667 committed in master by Jeff Darcy (jdarcy) 
------
commit ce8d8195dc253a87cceaaeeb1a725090471ae4f8
Author: Niklas Hambüchen <mail>
Date:   Sat Feb 18 00:49:02 2017 +0100

    posix: use nanosecond accuracy when available
    
    Programs that set mtime, such as `rsync -a`, don't work correctly on
    GlusterFS, because it sets the nanoseconds to 000. This creates
    problems for incremental backups, where files get accidentally copied
    again and again.
    
    For example, consider `myfile` on an ext4 system, being copied to a
    GlusterFS volume, with `rsync -a` and then `cp -u` in turn. You'd
    expect that after the first `rsync -a`, `cp -u` agrees that the file
    need not be copied.
    
    BUG: 1422074
    Change-Id: I89c7b6a73e2e06c02851ff76b7e5cdfaa271e985
    Signed-off-by: Niklas Hambüchen <mail>
    Reviewed-on: https://review.gluster.org/16667
    Smoke: Gluster Build System <jenkins.org>
    Reviewed-by: Niels de Vos <ndevos>
    Tested-by: Jeff Darcy <jdarcy>
    NetBSD-regression: NetBSD Build System <jenkins.org>
    Reviewed-by: jiffin tony Thottan <jthottan>
    CentOS-regression: Gluster Build System <jenkins.org>
    Reviewed-by: Jeff Darcy <jdarcy>

Comment 12 Shyamsundar 2017-05-30 18:43:01 UTC
This bug is getting closed because a release has been made available that should address the reported issue. In case the problem is still not fixed with glusterfs-3.11.0, please open a new bug report.

glusterfs-3.11.0 has been announced on the Gluster mailinglists [1], packages for several distributions should become available in the near future. Keep an eye on the Gluster Users mailinglist [2] and the update infrastructure for your distribution.

[1] http://lists.gluster.org/pipermail/announce/2017-May/000073.html
[2] https://www.gluster.org/pipermail/gluster-users/


Note You need to log in before you can comment on or make changes to this bug.