From 988d92534c94f4f3a1234e37adb0a9933bfab4df Mon Sep 17 00:00:00 2001 From: Kevin Veen-Birkenbach Date: Sun, 2 Aug 2026 12:06:42 +0200 Subject: [PATCH] fix(backup): keep kernel objects out of a generation -a implies -D, so a generation was written with --devices --specials and rsync recreated every unix socket and fifo it found in a volume. On the swarm manager that generation lives on an nfs-ganesha export, and ganesha accepts the socket on write but cannot serve it back: the remote pull's sender then fails with readdir/readlink_stat 'Invalid argument (22)' and exits 23, deterministically, for all twelve retries - 58 minutes per run. Postfix's queue directory is the case that surfaced it, where public/ and private/ hold roughly fifty AF_UNIX sockets and nothing else. The class is wider: a discourse /shared with its in-container postgres socket, a checkmk OMD site with tmp/run/nagios.cmd, a container whose /tmp is a persisted volume. --no-D is type-based and closes all of them without anyone having to know which image binds a socket where. Nothing restorable is lost. A socket inode is meaningless after a restore; postfix's master, checkmk's omd start and discourse's supervisor recreate theirs. The whole postfix queue survives - incoming, active, deferred, hold, maildrop - so accepted-but-undelivered mail stays in the backup, which excluding the volume outright would have dropped. Device nodes go too, and the only volume that could hold them is a nested docker data root, already carrying backup: false. This is the writer side, whose source is a local docker volume. On the reader the same flag provably does nothing: rsync still stats the entry before -D decides, and getdents64 on the containing directory is outside its reach entirely. Co-Authored-By: Claude Opus 5 (1M context) --- src/baudolo/backup/volume.py | 5 ++++- tests/unit/backup/test_volume.py | 3 +++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/baudolo/backup/volume.py b/src/baudolo/backup/volume.py index a082f58..1d4fddd 100644 --- a/src/baudolo/backup/volume.py +++ b/src/baudolo/backup/volume.py @@ -49,7 +49,10 @@ def backup_volume( link_dest = f"--link-dest='{last}'" if last else "" verify = "--checksum " if authoritative else "" - cmd = f"rsync -abP --delete --delete-excluded {verify}{link_dest} {source} {dest}" + cmd = ( + f"rsync -abP --no-D --delete --delete-excluded " + f"{verify}{link_dest} {source} {dest}" + ) try: execute_shell_command(cmd) diff --git a/tests/unit/backup/test_volume.py b/tests/unit/backup/test_volume.py index 3a73312..88c1022 100644 --- a/tests/unit/backup/test_volume.py +++ b/tests/unit/backup/test_volume.py @@ -43,6 +43,9 @@ class TestBackupVolume(unittest.TestCase): def test_it_always_deletes_what_the_source_no_longer_has(self) -> None: self.assertIn("--delete", self.copy()) + def test_it_carries_no_kernel_objects_into_a_generation(self) -> None: + self.assertIn("--no-D", self.copy()) + def test_it_creates_the_destination(self) -> None: with tempfile.TemporaryDirectory() as tmp: dest = Path(tmp) / "gen" / "demo"