Give up on a stalled 9p request instead of hanging the mount forever - #4
Merged
Merged
Conversation
…d of hanging forever
…s the mount instead of hanging it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
A 9p server that stops answering — a silently dead tunnel, or a server wedged on its backing store —
hangs every process that touches the mount, with no timeout anywhere. The kernel v9fs client waits
forever by design, and the FUSE bridge's session loop is serial, so one unanswered reply wedges the
whole mount and nothing recovers it.
Adds
--stall-timeout(default 30s, 0 disables) to both subcommands:mount9p-fuse: the client's pending map now carries the T-message type and a timestamp. A requestunanswered past the deadline declares the transport dead, which fails all waiters and flips the
existing
transport_gonewatch — so the daemon takes the path it already had for a closedtransport: detach the mount and exit for the supervisor to remount.
mount9p: the byte pumps scan frame headers to track outstanding tags (includingTflushabandoning its
oldtag), and the same deadline exits the daemon, whichMNT_DETACHes so thekernel fails blocked waiters with EIO.
The frame scanner reads only the 9-byte header per frame and skips bodies, so it adds no buffering
to the byte path. It handles arbitrary chunk boundaries; there's a unit test feeding the same stream
at every chunk size from 1 upward, plus one pinning that a short frame doesn't report a stale
oldtagfrom the previous frame.Verified against a real
diodover TCP, mounted viamount9p-fuse, with the serverSIGSTOPpedand a lookup forced to miss the attr/entry cache:
--stall-timeout 30:9p request stalled; declaring the transport dead tag=19 mtype="Twalk" age_secs=33, thendetaching the mount and exiting so it is remounted. The blocked process wasreleased and the daemon exited.
--stall-timeout 0(control): still blocked past 75s.Note a process already blocked in
chdirstays in uninterruptible sleep until the mount actuallygoes away, so the recovery bound is the timeout, not immediate.
cargo testpasses, including the 15 diod integration tests.