Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix --open-noatime option not working on files #726

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

qrees
Copy link

@qrees qrees commented Jan 27, 2025

Atime of source files could sometimes be overwritten even though --open-noatime option was used.

Simple script to reproduce:

Version tested: 3.4.1

mkdir src
mkdir dst
echo content > src/file
stat src/file
sleep 1
rsync --open-noatime --archive --atimes src/ dst/
stat src/file

Result:

  File: src/file
  Size: 8               Blocks: 8          IO Block: 4096   regular file
Device: 259,7   Inode: 9178482     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/   qrees)   Gid: ( 1000/   qrees)
Access: 2025-01-27 17:04:36.936188754 +0100
Modify: 2025-01-27 17:04:36.936188754 +0100
Change: 2025-01-27 17:04:36.936188754 +0100
 Birth: 2025-01-27 17:04:36.936188754 +0100
sending incremental file list
delta-transmission disabled for local transfer or --whole-file
file
total: matches=0  hash_hits=0  false_alarms=0 data=8

sent 136 bytes  received 105 bytes  482.00 bytes/sec
total size is 8  speedup is 0.03
  File: src/file
  Size: 8               Blocks: 8          IO Block: 4096   regular file
Device: 259,7   Inode: 9178482     Links: 1
Access: (0664/-rw-rw-r--)  Uid: ( 1000/   qrees)   Gid: ( 1000/   qrees)
Access: 2025-01-27 17:04:37.940194021 +0100
Modify: 2025-01-27 17:04:36.936188754 +0100
Change: 2025-01-27 17:04:36.936188754 +0100
 Birth: 2025-01-27 17:04:36.936188754 +0100

Expected source file atime not to change.

It seems like the bug was introduced in 0590b09

@qrees
Copy link
Author

qrees commented Jan 28, 2025

@tridge Can you have a look at this? Or at least approve workflows? Thanks you.

Copy link
Contributor

@carenas carenas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

although the commit message could explain better why the suggested code was added from an apparent copy from do_open() into the new do_open_nofollow()

atime of source files could sometimes be overwritten
even though --open-noatime option was used.

To fix that, optional O_NOATIME flag was added
to do_open_nofollow which is also used to open regular
files since fix:
  "fixed symlink race condition in sender"
Previously optional O_NOATIME flag was only in do_open.
@qrees
Copy link
Author

qrees commented Jan 29, 2025

@carenas I've expanded the commit message

@qrees qrees requested a review from carenas January 29, 2025 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants