create: do not archive an atime we caused ourselves, fixes #6194 - #10111
Open
ThomasWaldmann wants to merge 1 commit into
Open
create: do not archive an atime we caused ourselves, fixes #6194#10111ThomasWaldmann wants to merge 1 commit into
ThomasWaldmann wants to merge 1 commit into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #10111 +/- ##
==========================================
+ Coverage 87.03% 87.07% +0.04%
==========================================
Files 101 101
Lines 17730 17740 +10
Branches 2678 2679 +1
==========================================
+ Hits 15431 15447 +16
+ Misses 1598 1595 -3
+ Partials 701 698 -3 ☔ View full report in Codecov by Harness. |
ThomasWaldmann
force-pushed
the
atime-6194
branch
from
August 14, 2026 19:59
6a03872 to
7e62246
Compare
…#6194 borg has to open() a fs item before it can fstat() it. On platforms without O_NOATIME support (or when we are not allowed to use it), that open() may already have updated the atime - and then we would archive that atime instead of the one the item had before borg touched it. stat_update_check() now returns a stat result look-alike that has the atime from the stat we did before opening the item, if the atime changed between the two stat calls. If it did not change (e.g. O_NOATIME worked), the fd-based stat result is returned as before.
ThomasWaldmann
force-pushed
the
atime-6194
branch
from
August 14, 2026 20:35
7e62246 to
9c3a5ef
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
borg has to
open()a fs item before it canfstat()it. On platforms withoutO_NOATIMEsupport (or when we are not allowed to use it), that
open()may already have updated theatime - and then we archive an atime that we caused ourselves, instead of the one the item
had before borg touched it.
stat_update_check()now returns aos.stat_resultlook-alike (StatOrigAtime) that haseverything from the fd-based stat, but the atime from the stat we did before opening the
item - as suggested in the issue. This is only done if the atime actually changed between
the two stat calls, so when
O_NOATIMEworked, the plain stat result is returned as before(no proxy object, no overhead).
Doing this in
stat_update_check()covers all its call sites at once: regular files, fifos,devices and both directory opens.
Note: this only changes what we archive - without
O_NOATIMEwe still can not avoidupdating the atime in the source filesystem.
Tests:
test_atime_open_updates_atimesimulates a platform where theopen()already updates theatime (by reading a byte in a monkeypatched
os_open) and checks that the archived atime isstill the one from before. It fails without the fix.
stat_update_check(): atime fixup, unchanged atime (returns the stat resultas is) and the two race condition checks, which had no test coverage.