Skip to content

fix(core): don't abort backup on dataless cloud-only directories#184

Open
hexsprite wants to merge 1 commit into
borgbase:mainfrom
hexsprite:bugfix/dataless-dir-deadlock
Open

fix(core): don't abort backup on dataless cloud-only directories#184
hexsprite wants to merge 1 commit into
borgbase:mainfrom
hexsprite:bugfix/dataless-dir-deadlock

Conversation

@hexsprite

Copy link
Copy Markdown
Contributor

Fixes #183.

Problem

On macOS, std::fs::read_dir on a FileProvider dataless (iCloud cloud-only) directory blocks fileproviderd and returns EDEADLK"Resource deadlock avoided" (os error 11). The walker treated that as fatal, so a single cloud-only directory aborted the entire backup (exit 1, no snapshot). A nightly backup silently stopped producing snapshots for weeks because of this.

stat/lstat on a dataless inode succeeds instantly; only descent (read_dir) deadlocks — so the walker sails through the stat but dies the moment it tries to list the directory.

Fix

  1. Skip descent into dataless directories. New pure helper should_descend_into_dir(actual_is_dir, is_symlink, is_dataless) in walk/mod.rs. The directory inode is still recorded (restore recreates it); its cloud-only children are skipped — mirroring the existing dataless-file skip path. is_dataless was already on MetadataSummary; it just wasn't consulted before descending.
  2. Soft-classify EDEADLK on macOS in is_soft_backup_io_error, covering the race where a directory flips dataless between lstat and read_dir. Scoped #[cfg(target_os = "macos")] so genuine fcntl/flock deadlocks are not masked on other platforms.

Tests

  • should_descend_into_dir — normal dir descends; dataless dir does not; symlink-dir does not; file does not.
  • is_soft_backup_io_error — errno 11 is soft on macOS, not soft on other unix.

make pre-commit clean (fmt + clippy -D warnings + doc-check + tests).

Verified in production

Full vykar backup -R r2 on the affected machine: snapshot created, 923,725 files, 0 deadlocks, 48,090 dataless files soft-skipped and tallied. First successful snapshot in weeks.


Per CONTRIBUTING, this is filed against triaged issue #183 — happy to adjust approach if you'd prefer a different design before merge.

On macOS, calling read_dir on a FileProvider dataless (iCloud cloud-only)
directory blocks fileproviderd trying to materialize the listing and
returns EDEADLK ("Resource deadlock avoided", os error 11). That error
propagated up and aborted the entire backup — no snapshot was written.

Skip descent into stat-detected dataless directories (record the dir
inode for restore, but never read_dir into it), mirroring the existing
dataless-file skip path. Also soft-classify EDEADLK on macOS in
is_soft_backup_io_error to cover the race where a directory flips
dataless between lstat and read_dir. Scoped to macOS so genuine
fcntl/flock deadlocks are not masked elsewhere.

Adds regression tests for the descent decision (should_descend_into_dir)
and the EDEADLK classification, both polarities.
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.

Backup aborts with EDEADLK (os error 11) on macOS dataless cloud-only directories

1 participant