Skip to content

fix(pnfs): restart the MDS only when nfsd stops completing requests (SFAM-2857) - #927

Merged
boddumanohar merged 2 commits into
mainfrom
fix/pnfs-mds-stuck-under-load
Nov 17, 2026
Merged

boddumanohar merged 2 commits into
mainfrom
fix/pnfs-mds-stuck-under-load

Conversation

@boddumanohar

@boddumanohar boddumanohar commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Fixes SFAM-2857.

Problem

Since #909 a stuck nfsd makes the MDS guest unhealthy, and mds-runner restarts the pod after --unhealthy-deadline (90s). The watchdog marked a thread stuck when it sat on the same wchan for three 15s ticks, without checking whether requests completed in between. Under sustained writes each request blocks in the same place (XFS log, writeback), so a busy nfsd looked stuck. 3m stuck limit + 90s deadline = the 4m30s in the incident log, and the singleton MDS restart put write EIO on all 12 volumes.

Change

  • csi-driver/internal/mds/agent/nfsd_watchdog.go: StuckFor() now reports a stall only while nfsd completes no RPC calls: the existing "not draining" rule, or a thread on one wait with /proc/net/rpc/nfsd calls flat. Same-wchan threads with calls advancing still warn and dump stacks, but no longer affect health. Without RPC statistics the previous rule applies, so fix(pnfs): recover an MDS that loses its storage, and report it on NFSExport #909's recovery case is unchanged.
  • SimplyblockDriver.spec.pnfs.mds.unhealthyDeadline (optional metav1.Duration) is passed to the runner as --unhealthy-deadline. 0s disables the restart. Unset keeps the runner default.
  • Regenerated CRDs, deepcopy, and the chart.

Tests (red first)

  • TestAThreadOnOneWaitWhileRequestsCompleteIsNotStuckForHealth: failed on main with StuckFor = 4m30s while requests keep completing, want 0. Passes now.
  • TestAThreadOnOneWaitWithNoRequestCompletingIsStuckForHealth: a real stall still counts.
  • TestMDSRunnerTakesTheUnhealthyDeadline / ...KeepsItsDefault: failed to build before the field existed.
  • go test ./internal/mds/... (csi-driver) and ./internal/controllers/driver/..., ./api/... (operator) pass, and the quality gate passes.

Live test (cluster 111, 2026-11-17)

Operator and MDS on this branch's CI images; 12 RWX sb66-pnfs volumes, each with a 4-job 1 MiB random-write fio, for about 30 minutes.

  • The watchdog logged about 20 "nfsd looks stuck" episodes, all threads in D in submit_bio_wait, folio_wait_bit_common, or xlog_force_lsn while requests completed: the pattern from the ticket.
  • None made the guest unhealthy: no guest unhealthy: nfsd line, MDS restart count 0.
  • One episode lasted 3m0s (ended 14:56:47 UTC). On main that reaches nfsdStuckLimit and turns the guest unhealthy; here it did not. It ended before the 90s deadline, so main would not have restarted the pod either: this lab does not reach the 4m30s of the ticket.
  • Four fio jobs hit ENOSPC: the test wrote 4 x 8 GiB to 20 GiB volumes. That is the test's sizing, not the change.
  • The runner made 26 control-plane calls in 10 minutes (volumes/<id>/connect, the tracker's 5-minute refresh over 13 exports), not the ~30/s of ticket item 5.

Not covered

  • A rerun of PnfsRwxRapidNoGapK8s on the ticket's cluster with this branch's MDS image, which is where the restart reproduces.
  • The underlying nfsd stall (feat(mds): watch the guest's nfsd and log its state to the console #710). Ticket items 4 (drain instead of kill, belongs with the hot-standby MDS work) and 5 (the Simplyblock client created log flood; no code path found that produces it in steady state, needs the pod's timestamped log) are out of scope.

…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.
@boddumanohar
boddumanohar marked this pull request as ready for review November 17, 2026 14:49
@boddumanohar
boddumanohar merged commit 5b69318 into main Nov 17, 2026
26 checks passed
@boddumanohar
boddumanohar deleted the fix/pnfs-mds-stuck-under-load branch November 17, 2026 15:38
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.

3 participants