Bug 1672779

Summary: Rsync bug resets modification time of every destination file that has not changed
Product: Red Hat Enterprise Linux 7 Reporter: Dave Dykstra <dwd>
Component: rsyncAssignee: Michal Ruprich <mruprich>
Status: CLOSED ERRATA QA Contact: qe-baseos-daemons
Severity: medium Docs Contact:
Priority: unspecified    
Version: 7.6CC: omejzlik, thozza, wienemann
Target Milestone: rcKeywords: Patch, Regression, Reproducer
Target Release: ---   
Hardware: x86_64   
OS: Linux   
Whiteboard:
Fixed In Version: rsync-3.1.2-10.el7 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-03-31 19:43:27 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On:    
Bug Blocks: 1709724    
Attachments:
Description Flags
Patch none

Description Dave Dykstra 2019-02-05 21:50:57 UTC
Description of problem:
The current rsync version in RHEL 7.6 has a bug that is significantly hurting our performance.  It sets the modification time with utimensat() on every destination file, even when they haven't changed, when the source filesystem has nanosecond granularity and the destination filesystem has second granularity.

Version-Release number of selected component (if applicable):
3.1.2-4.el7

How reproducible:
Very

Steps to Reproduce:
Assuming /tmp is a filesystem like ext4 with nanosecond granularity
1. cd /tmp
2. mkdir in out
3. dd if=/dev/zero of=out.ext3 bs=1M count=10
4. mkfs -t ext3 out.ext3
answer y
5. sudo mount -o loop out.ext3 /tmp/out
6. sudo chown $LOGNAME out
7. echo hello >in/file
9. rsync -a in/ out/
10. strace -f rsync -a in/ out/ 2>&1 | grep utimensat

Actual results:
Prints two calls to utimensat every time command 10 is run.

Expected results:
No calls to utimensat.

Additional info:

This bug was introduced in bug #1393543 which upgraded to rsync-3.1.2-4 and introduced support for nanosecond timestamps.  This is a known bug upstream that was fixed in rsync-3.1.3, released January 2018.  Here is the patch:

https://git.samba.org/?p=rsync.git;a=patch;h=0f8e9e2d8638e47d646a6baba694b303ac84e695;hp=c4a3f55be35726d0a033996dc37b0fb248b45cb5

I added the patch to a private build of the rsync-3.1.2-4.el7.src.rpm and it solved the problem.  

Besides the extra overhead of unnecessarily setting the timestamp, this hurts our performance worse because we are writing into a filesystem based on overlayfs and it is causing every file to be copied into the upper layer.  Those files are then processed further by our application (cvmfs) which has even more overhead.

There were also two security fixes in rsync-3.1.3 that do not appear to be in the RHEL 7.6 distribution.  See these descriptions:

https://rsync.samba.org/security.html#s3_1_3
https://download.samba.org/pub/rsync/src/rsync-3.1.3-NEWS

Comment 2 Michal Ruprich 2019-02-26 09:38:32 UTC
Created attachment 1538721 [details]
Patch

Just adding the patch as an attachment for completion.

Comment 3 Dave Dykstra 2019-08-12 22:12:15 UTC
Please don't forget about this, it's still a problem.

Comment 10 errata-xmlrpc 2020-03-31 19:43:27 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2020:1046