Repository navigation
create: back up automounted directories, fixes #6652 (1.4-maint) - #10575
Open
ThomasWaldmann wants to merge 1 commit into
Open
ThomasWaldmann wants to merge 1 commit into
ThomasWaldmann wants to merge 1 commit into
Conversation
stat() does not trigger an automount (autofs, systemd automount units, ZFS .zfs/snapshot/*), but opening the directory does. borg create then saw a different inode for fstat() than for stat(), considered that a race condition and skipped the whole tree. When the directory is a directory before and after and the opened directory is on a different mount than its parent, accept it, use the fstat() result and redo the skip_inodes and --one-file-system decisions. platform.on_different_mounts() compares the mount ids on Linux (st_dev is not good enough there, e.g. for btrfs subvolumes) and st_dev elsewhere. Recursion roots are opened before taking their stat, so --one-file-system uses the device number of the mounted filesystem (this also fixes incomplete -x backups of a ZFS snapshot directory given as a recursion root). Backport of borgbackup#10509. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## 1.4-maint #10575 +/- ##
=============================================
+ Coverage 82.11% 82.14% +0.02%
=============================================
Files 38 38
Lines 11485 11514 +29
Branches 1810 1816 +6
=============================================
+ Hits 9431 9458 +27
- Misses 1468 1469 +1
- Partials 586 587 +1 ☔ View full report in Codecov by Harness. |
This branch has not been deployed
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.
Backport of #10509 to 1.4-maint, fixes #6652.
stat()/lstat()do not trigger an automount (on Linux, they act as ifAT_NO_AUTOMOUNTwas given), but opening the directory does.borg createstats a directory, then opens it and compares withfstat(): for an automount point that is not mounted yet, these differ, so borg considered it a race condition ("file type or inode changed") and skipped the whole tree. This affects autofs (indirect and direct maps), systemd.automountunits and ZFS.zfs/snapshot/*on Linux.Fix (same as on master)
platform.on_different_mounts(fd1, fd2): Linux compares the mount ids (from/proc/self/fdinfo/<fd>), other platforms comparest_dev;Noneif undeterminable (handled like "no").archive.is_automount(): accepts the change only if it is a directory before and after and the opened directory is on a different mount than its parent directory. Everything else still raisesBackupRaceConditionError._rec_walk, we then use thefstat()result and redo theskip_inodesand--one-file-systemdecisions.stat_dir_mounted), so the mount happens early and--one-file-systemuses the device number of the mounted filesystem.Differences to the master PR
archiver.py(nostat_root()on 1.4, sostat_dir_mounted()is called directly for the recursion roots; symlinked recursion roots are not followed on 1.4, so nofollow_symlinksvariant).on_different_mountsis imported once from.baseinplatform/__init__.pyand overridden for Linux, matching how 1.4 structures that module.borg createtest is anArchiverTestCasemethod (skipped for the binary, as it patches objects).Testing
Full test suite on macOS (Python 3.14): 1471 passed, 382 skipped. The Linux mount-id code path is identical to master, where it was tested manually on Debian 13 with autofs, systemd automount and ZFS snapshots.
🤖 Generated with Claude Code