Skip to content

fix(podman): prevent VirtioFS→NFS data loss and boot-order race#137

Merged
smartwatermelon merged 1 commit into
mainfrom
claude/fix-virtiofs-nfs-data-loss-2d7f3a
May 14, 2026
Merged

fix(podman): prevent VirtioFS→NFS data loss and boot-order race#137
smartwatermelon merged 1 commit into
mainfrom
claude/fix-virtiofs-nfs-data-loss-2d7f3a

Conversation

@smartwatermelon
Copy link
Copy Markdown
Owner

Summary

  • Disable Transmission's incomplete-dir to eliminate cross-directory renames over VirtioFS→NFS (soft mount), which silently lost data for 3 torrents on 2026-05-08/10
  • Add wait_for_nfs() guard before starting the Podman VM, closing a boot-order race where the VM could start before the NFS mount was ready (observed 7s gap on 2026-05-14 reboot)

Root cause

With incomplete-dir-enabled: true, Transmission renames completed files from incomplete/pending-move/ (cross-directory). This rename traverses Container → VirtioFS → Host NFS (soft, timeo=10) → NAS. When the soft mount returns EIO, VirtioFS may already have unlinked the source entry from its cache, leaving files in neither directory — data lost.

Changes

  • podman-transmission-setup.sh: replaced TRANSMISSION_INCOMPLETE_DIR=… with TRANSMISSION_INCOMPLETE_DIR_ENABLED=false in both the heredoc wrapper template and the Section 11 setup-time podman run
  • Added wait_for_nfs() function (120s timeout, 5s poll) called with || exit 1 before ensure_machine()

Test plan

  • Deployed to TILSIT live — container running with incomplete-dir-enabled: False confirmed via Transmission settings.json
  • NFS wait function tested on reboot — logged "NFS mount ready" before VM start
  • Torrents downloading successfully to pending-move/ directly
  • shellcheck -S info passes clean
  • Both code-reviewer and adversarial-reviewer pass

🤖 Generated with Claude Code

Cross-directory renames (incomplete/ → pending-move/) through VirtioFS
over a soft NFS mount can silently lose data: the source is unlinked
from the VirtioFS cache while the NFS rename fails, leaving files in
neither directory. Disable Transmission's incomplete-dir so downloads
go directly to pending-move/ (same-directory .part rename only).

Also add wait_for_nfs() before starting the Podman VM, closing a
boot-order race where the VM could start before the NFS mount was ready
(observed 7-second gap on 2026-05-14 reboot).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@claude
Copy link
Copy Markdown

claude Bot commented May 14, 2026

Two changes: wait_for_nfs() startup guard and disabling the incomplete download directory.

Both changes are consistent between the heredoc path (line 595) and the direct-invocation path (line 807). The wait_for_nfs logic is correct — the grep pattern matches macOS mount output, the elapsed counter terminates at max_wait, and exit 1 prevents ensure_machine/ensure_container from running on a missing NFS mount. NFS_MOUNT_POINT is intentionally unescaped (baked in at generation time), matching the pattern of PGID, TZ_VALUE, etc. elsewhere in the file.

No blocking issues found.

VERDICT: PASS

@smartwatermelon smartwatermelon merged commit c2d1825 into main May 14, 2026
5 checks passed
@smartwatermelon smartwatermelon deleted the claude/fix-virtiofs-nfs-data-loss-2d7f3a branch May 14, 2026 21:00
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