Skip to content

Bounded umount retry for eject/format - #182

Merged
bbangert merged 1 commit into
mainfrom
fix/eject-umount-retry
Aug 21, 2026
Merged

Bounded umount retry for eject/format#182
bbangert merged 1 commit into
mainfrom
fix/eject-umount-retry

Conversation

@bbangert

Copy link
Copy Markdown
Owner

Summary

  • Eject unmounted 9ms after the parent smbd died, but its per-connection child (whose cwd pins the share) hadn't exited yet, so the strict umount hit EBUSY and the eject was refused.
  • eject/2 and format/3 now retry the plain (non-lazy) umount up to :umount_retries times, :umount_retry_ms apart (defaults 6 / 500ms, ~3s), absorbing that teardown window while a persistent holder still surfaces {:error, :busy}; reconcile_removal/1's lazy-fallback path is untouched.

Test plan

  • mise run test -- test/universal_proxy/storage/ (258 passed)
  • mix compile --warnings-as-errors
  • mise exec -- sh -c 'MIX_TARGET=host MIX_ENV=dev mix dialyzer'
  • New/updated tests: busy-twice-then-free retries to success (3 recorded plain umounts) for both eject and format; always-busy exhausts exactly N+1 attempts and still refuses (never lazily) for both eject and format; drive-removal (force_unmount/1) tests unchanged, confirming single-plain-then-lazy semantics remain untouched

🤖 Generated with Claude Code

Eject unmounted 9ms after the parent smbd died; the per-connection
child still pinned the share and the strict umount hit EBUSY. A
bounded non-lazy retry (~3s) absorbs the teardown window; persistent
holders still surface busy.

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds bounded plain-unmount retries to absorb transient Samba teardown races without allowing lazy detachment.

Changes:

  • Retries busy unmounts for eject and format with configurable limits.
  • Preserves immediate lazy fallback for physical removal.
  • Tests transient success and retry exhaustion.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated no comments.

File Description
lib/universal_proxy/storage/server.ex Implements and documents bounded busy-unmount retries.
test/universal_proxy/storage/server_test.exs Verifies retry success, exhaustion, and no lazy fallback.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@bbangert
bbangert merged commit ce57b58 into main Aug 21, 2026
7 checks passed
@bbangert
bbangert deleted the fix/eject-umount-retry branch August 21, 2026 16:48
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.

2 participants