Skip to content

fix(pnfs): make an MDS move clean and short, and hold the MDS in maintenance - #904

Merged
boddumanohar merged 1 commit into
mainfrom
fix/mds-forwarder-outlives-guest
Nov 12, 2026
Merged

boddumanohar merged 1 commit into
mainfrom
fix/mds-forwarder-outlives-guest

Conversation

@boddumanohar

@boddumanohar boddumanohar commented Nov 11, 2026 •

Copy link
Copy Markdown
Member

Problem

Moving the pNFS metadata server (MDS) stalled every pNFS client for far longer than it needed to. RCA pnfs_mds_not_in_eviction_targets_rca_20261111 measured 93 s per move, against the e2e suite's 40 s I/O ceiling, three times in a day. Three defects contribute:

  1. The guest could never power down. The host-path forwarder, which carries the guest's NVMe/TCP connections to the storage nodes, was served under the runner's stop-signal context. SIGTERM closed it at the moment the power button was pressed, the guest hung unmounting the exported XFS (no usable path - requeuing I/O), and the runner logged guest did not power down within 20s, killed QEMU on every move.
  2. A drain evicted the MDS freely. The maintenance window held the SPDK pod, the management API, and FoundationDB, and nothing else, so the MDS was evicted even while the control plane refused or deferred the maintenance.
  3. The 90 s NFSv4 grace period. This is fixed in the guest image by pnfs-common: shorten the metadata server's NFSv4 lease and grace time to 15 s vela-os#32 (lease-time=15, grace-time=15), not here.

Changes

  • Forwarder (csi-driver/internal/mds/runner/supervisor.go, cmd/mds-runner/main.go): the supervisor starts the guest's storage path under a context that outlives the stop signal and ends only once QEMU has exited.
  • Maintenance window (operator/internal/controllers/node/workload.go): evictionTargets is a list of label selectors, and the MDS is selected by the presence of storage.simplyblock.io/cluster-id, which only its pods carry. Its pod template is unchanged, so an upgrade does not move it.

Unit tests

Each regression test failed against the unfixed code and passes after the fix:

  • TestTheGuestKeepsItsStorageUntilItHasPoweredDown (U-116): before, pressing the power button: the guest's storage path is gone, killed QEMU.
  • TestTheWindowHoldsThePNFSMetadataServer (O-52): before, the metadata server on the drained worker is not held by the window's budget.

go test -race ./internal/mds/..., the operator's ./internal/... suite with envtest, golangci-lint, the Linux build and vet of cmd/mds-runner, and the house-style gate all pass. CI on the PR is green.

Cluster tests

Run on a four-node k3s cluster (three storage nodes) with images built from this branch, #906 (activation of a guest that boots as a standby), and the guest of vela-os#32 (pnfsos-95b667b), through the throwaway branch test/mds-forwarder-111. The guest image on pnfs-minimal boots as a standby, so testing this PR with a current guest needs #906. One pNFS RWX volume had one writer pod per node doing 4 KiB fsync'd writes and logging any write over 1 s.

1. The guest boots and serves. With #906, nfsd logged starting 15-second grace period, and the grace ended early once all clients had reclaimed. The export was Ready.

2. Evicting the MDS (the eviction API, as a drain does; restarted on the same node, 4 writers):

Before (main images) After
Old guest killed QEMU after 20 s, hung unmounting the export XFS XFS unmounted, MDS guest shut down after 4 s
New MDS Ready 46 s after the eviction 25 s
Client stall 52.7–57.9 s 25.6–25.7 s

3. Maintenance window and drain (3 writers, the MDS moved to another node):

  • Cordoning the MDS's worker raised HostMaintenance. The window labeled the MDS (storage.simplyblock.io/maintenance-worker) together with the SPDK and FoundationDB pods, under a maxUnavailable: 0 budget.
  • The window shut the storage node down, released the budget, and waited for the host. The MDS stayed on its worker until then.
  • A drain after the release moved the MDS to another node, with a clean guest shutdown and a client stall of 23.0–23.2 s.
  • After the uncordon, the operation reported OperationSucceeded, all storage nodes and the cluster returned to Online, and the export was Ready.

Not verified: that the budget blocks a drain while the window holds. The first drain stopped at the SPDK pod, which has no controller and needs --force, before it tried to evict anything. The label and budget were in place, and the unit test covers the selection.

Remaining cost and scope

A cross-node move now costs about 23 s with 3–4 clients: the drain, a clean shutdown, about 18 s to reschedule and boot, and a short grace. The RCA's run had 36 clients, whose reclaim takes longer, so PnfsRwxRapidNoGapK8s should be rerun at that scale to confirm the 40 s ceiling holds. The reschedule and boot cost is what the warm standby removes, and it comes as a separate PR.

Related: #906 (activate a guest that boots as a standby; pNFS on main needs it independently of this PR) and simplyblock/vela-os#32 (15 s lease and grace).

@boddumanohar boddumanohar changed the title fix(pnfs): keep the MDS guest's storage path until it has powered down fix(pnfs): make an MDS move clean and short, and hold the MDS in maintenance Nov 12, 2026
@boddumanohar
boddumanohar force-pushed the fix/mds-forwarder-outlives-guest branch from ecd2076 to d43b8ac Compare November 12, 2026 07:55
mxsrc
mxsrc previously approved these changes Nov 12, 2026

@mxsrc mxsrc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good :)

The guest could never power down. The host-path forwarder, which carries the
guest's NVMe/TCP connections to the storage nodes through the mds-proxy, was
served under the runner's stop-signal context, so SIGTERM closed it, and every
spliced connection, at the moment the supervisor pressed the power button. The
guest then hung unmounting the exported XFS ("no usable path - requeuing I/O")
and never powered down: on every MDS move the runner logged "guest did not
power down within 20s, killed QEMU", and every pNFS client stalled for those
20 s on top of the restart and grace period. The supervisor now starts the
storage path itself, under a context that outlives the stop signal and ends
only once QEMU has exited.

A drain evicted the MDS freely. The maintenance window's budget held the SPDK
pod, the management API, and FoundationDB, and nothing else, so draining a
worker evicted the MDS at once, even while the control plane refused or
deferred the maintenance the drain was for; the RCA
pnfs_mds_not_in_eviction_targets_rca_20261111 saw this three times in a day.
evictionTargets is now a list of label selectors, and the MDS is selected by
the presence of storage.simplyblock.io/cluster-id, which only its pods carry,
so its pod template is unchanged and an upgrade does not move it.
@boddumanohar
boddumanohar merged commit c70eb7c into main Nov 12, 2026
29 checks passed
@boddumanohar
boddumanohar deleted the fix/mds-forwarder-outlives-guest branch November 12, 2026 12:15
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