Roll back chunks on read errors after chunking (avoid bad refcounts) · borgbackup/borg@396b8cd · GitHub
Skip to content

Commit 396b8cd

Browse files
Roll back chunks on read errors after chunking (avoid bad refcounts)
A BackupOSError raised after a file's chunks were already added and referenced - while re-fstat-ing the file (fstat2) or reading its extended attributes (bsdflags / xattrs / ACLs) - left those chunk references in place. With the per-file retry loop this leaks refcounts on every failed attempt (up to MAX_RETRIES times), which is exactly the flaky-media scenario retries target. Factor the existing decref-and-clear into a rollback_chunks() helper and call it from these two additional abort paths. Decref'ing one reference per id in item.chunks is correct for a cache hit, a freshly chunked file, and (leaving committed part file references intact) a file with part files. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
1 parent 4e13f7f commit 396b8cd

2 files changed

Lines changed: 75 additions & 7 deletions

File tree

‎src/borg/archive.py‎

Lines changed: 27 additions & 6 deletions

‎src/borg/testsuite/archiver.py‎

Lines changed: 48 additions & 1 deletion

0 commit comments

Comments
 (0)