Repository navigation
fix(pnfs): recover an MDS that loses its storage, and report it on NFSExport - #909
Merged
Merged
Conversation
A replacement MDS lost its storage paths and its state disk 2 h 46 m after boot and then sat unready, with no restart, for 19 h 39 m: the supervisor only cleared readiness once the guest had booted, /healthz is a constant 200, and readiness never restarts a pod. - The runner kills QEMU and exits when a booted guest has been unhealthy for longer than --unhealthy-deadline (90 s), so kubelet restarts the pod. - The agent's health also fails when the state disk takes no write, when an export's filesystem fails getattr (an XFS shut down on an I/O error), and when the nfsd watchdog has been in a stuck episode for 3 minutes. - A health check that blocks reports NOT_SERVING after 5 s instead of keeping its last answer. Regression: 2026-11-12-pnfs-mds-stays-dead-after-state-disk-journal-abort
boddumanohar
force-pushed
the
fix/mds-restart-unhealthy-guest
branch
from
November 12, 2026 12:55
82d5be8 to
e128c7a
Compare
An MDS that lost its storage paths stayed unready for 19 h 39 m. The runner now restarts its container (#909), but on cluster 111 the restarted container crash-looped on a missing /dev/mds-state: the host had removed the state volume's device, and only a new pod stages the volume again. Deleting the pod by hand recovered the MDS in 22 s. MDSReadinessWatchdog marks an MDS pod once it has been ready, and deletes a marked pod that has been unready for 3 minutes, preconditioned on its UID, with an MDSPodStuck event. The StatefulSet creates the replacement. A pod that never turned ready is left to the runner's boot deadline. Regression: 2026-11-12-pnfs-mds-stays-dead-after-state-disk-journal-abort
61 NFSExports reported Ready for 19 h 39 m while their metadata server served nothing: a failed health check was only an event, and a missing session requeued without a word. NFSExport status gains conditions. A Ready export's MDSReady is False with reason MDSUnreachable while the operator has no session with the metadata server, False with HealthCheckFailed while the export fails its check, and True with Serving otherwise. It is written only when it changes, with an event on every change of its status, and shown in an MDSReady printcolumn. The phase does not move on it. Regression: 2026-11-12-pnfs-mds-stays-dead-after-state-disk-journal-abort
boddumanohar
marked this pull request as ready for review
November 12, 2026 16:44
mxsrc
approved these changes
Nov 12, 2026
boddumanohar
added a commit
that referenced
this pull request
Nov 17, 2026
…SFAM-2857) (#927) * fix(pnfs): restart the MDS only when nfsd stops completing requests (SFAM-2857) Since #909 a stuck nfsd makes the metadata server guest unhealthy, and the runner restarts the pod 90s later. The watchdog counted a thread as stuck when it sat on the same wchan for three ticks, without asking whether requests completed meanwhile. Under heavy writes every request a thread serves blocks in the same place, so a busy nfsd looked stuck, and restarting the singleton MDS put write EIO on every pNFS volume in the cluster. StuckFor now reports a stall only while nfsd completes no RPC calls: work arriving with none processed, or a thread on one wait with the call counter flat. A thread on one wait while calls advance still logs and dumps stacks, but no longer counts toward health. Without RPC statistics the old rule applies. SimplyblockDriver.spec.pnfs.mds.unhealthyDeadline passes --unhealthy-deadline to the runner, so the restart can be delayed or turned off (0s) without pinning an older image. * chore(operator): regenerate the installer for spec.pnfs.mds.unhealthyDeadline
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.
Problem
RCA
pnfs_mds_stays_dead_after_state_disk_journal_abort_rca_20261112: a replacement MDS lost its storage paths and its state disk 2 h 46 m after boot, and stayed0/1withrestarts=0for 19 h 39 m. All 61 NFSExports still reportedReady, and the StorageCluster stayedOnline. Every pNFS client had no data path, and nothing restarted the MDS or reported the outage.What failed, as reproduced on cluster 111:
/healthzis a constant 200, and the supervisor only cleared readiness once the guest had booted. Readiness never restarts a pod.Ready.The RCA's "no reconnect after 30/30" comes from the agent hanging on the dead state disk. With the agent alive, the path keeper reconnects within 10 s.
Changes
MDS runner and guest agent (
csi-driver/)internal/mds/runner/supervisor.go: once the guest has booted, if it stays unhealthy longer than--unhealthy-deadline(90 s), the runner kills QEMU and exits, and kubelet restarts the container.internal/mds/agent/health.go: the health check also fails when:stat;Each check is bounded by 5 s and reports
NOT_SERVINGif it doesn't answer in time.nfsd_watchdog.go:StuckFor()reports how long the current stuck episode has lasted.paths.go:CheckFilesystems()checks every export the path keeper holds.Operator watchdog (
operator/internal/controllers/driver/mds_watchdog.go)MDSReadinessWatchdog, a leader-elected Runnable modeled on the web API watchdog. It marks an MDS pod once the pod has been ready.MDSPodStuckevent. The StatefulSet then creates a new pod, which stages the state volume again.NFSExport status (
api/v1alpha2/nfsexport_types.go,internal/controller/nfsexport_controller.go)status.conditions, a list map keyed bytype.MDSReadycondition is:MDSUnreachablewhile there is no session with the MDS;HealthCheckFailedwhile the export fails its check;Servingotherwise.MDSReadyprintcolumn. The phase does not change.dist/install.yaml, the upgrade manifests, and the chart are regenerated. The design doc (§17 Logs and status) is updated.Tests
Each regression test failed against the unfixed code and passes now:
TestAGuestThatStaysUnhealthyAfterBootIsKilled. U-124 checks that a brief unhealthy spell doesn't restart anything.MDSReadygoes False on a failed check and on a missing session, is True when healthy, and recovers.These pass:
go test -race ./internal/mds/...make -C csi-driver unit-test./internal/...with envtestcheck-crds.pyCluster tests (cluster 111, k3s, 3 storage nodes)
The fault: on the MDS's worker, reject outbound TCP to the lvol port 4426 for about 2.5 minutes. Both the host's state-disk paths and the guest's export paths go through that port. A writer pod on another node writes once a second.
main)/dev/mds-stateA final run with all three parts (operator
d8303b663, CRD applied):MDSReadyThe events
MDSUnhealthy,MDSReadyFalse, andMDSReadyTruewere all emitted. In total the data path was down for about 4 minutes, with no human action.Follow-ups
ctrl_loss_tmo=-1for the MDS state volume, so a container restart alone recovers.Supersedes #910.