Skip to content

locking: fix lock-listing race and with-lock epilog - #10096

Merged
ThomasWaldmann merged 2 commits into
borgbackup:masterfrom
ThomasWaldmann:storelocking-fixes
Aug 14, 2026
Merged

locking: fix lock-listing race and with-lock epilog#10096
ThomasWaldmann merged 2 commits into
borgbackup:masterfrom
ThomasWaldmann:storelocking-fixes

Conversation

@ThomasWaldmann

Copy link
Copy Markdown
Member

Two independent storelocking fixes, split out of #10077 (both found during its review, both pre-existing on master and valid regardless of the clock-skew work):

locking: ignore locks vanishing between listing and loading them_get_locks() guarded store.list() against ObjectNotFound, but not the per-lock store.load(). Two clients racing on stale-lock cleanup could therefore crash with a raw borgstore traceback: one deletes a stale lock while the other is between listing the locks directory and loading that object. Such locks are now skipped — semantically identical to a lock already gone at listing time. With a test simulating the race.

with-lock: fix epilog about leftover lock auto-removal — the help epilog claimed "Borg is cautious and does not automatically remove stale locks made by a different host", which is not true for borg2 storelocking: foreign stale locks are auto-removed after the stale timeout. The epilog now says the leftover lock in a repository copy is removed automatically after a safety period of about half an hour, and that borg break-lock is the way to use the copy right away. Regenerated docs/usage/with-lock.rst.inc and docs/man/borg-with-lock.1 accordingly.

#10077 will be rebased to drop its copies of these two commits once this is merged.

🤖 Generated with Claude Code

ThomasWaldmann and others added 2 commits August 14, 2026 12:23
…p#9870

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Two clients racing on stale-lock cleanup could crash with an uncaught
borgstore ObjectNotFound traceback: one client deletes a stale lock while
the other is between listing the locks directory and loading that lock
object. Skip such locks - semantically they are the same as a lock that
was already gone at listing time.

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
@codecov

codecov Bot commented Aug 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 87.01%. Comparing base (8640a75) to head (e15404a).
⚠️ Report is 3 commits behind head on master.
✅ All tests successful. No failed tests found.

Additional details and impacted files
@@           Coverage Diff           @@
##           master   #10096   +/-   ##
=======================================
  Coverage   87.00%   87.01%           
=======================================
  Files          99       99           
  Lines       17612    17615    +3     
  Branches     2664     2664           
=======================================
+ Hits        15323    15327    +4     
  Misses       1593     1593           
+ Partials      696      695    -1     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

@ThomasWaldmann
ThomasWaldmann merged commit ac1b415 into borgbackup:master Aug 14, 2026
20 checks passed
@ThomasWaldmann
ThomasWaldmann deleted the storelocking-fixes branch August 14, 2026 10:59
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.

1 participant