Skip to content

fix(pnfs): re-probe a mount whose data goes through the MDS, and report one that stays there (SFAM-2850) - #931

Merged
noctarius merged 6 commits into
mainfrom
fix/pnfs-probe-on-mds-data
Nov 19, 2026
Merged

noctarius merged 6 commits into
mainfrom
fix/pnfs-probe-on-mds-data

Conversation

@noctarius

@noctarius noctarius commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

The CSI and MDS-agent side of SFAM-2850. The guest kernel side is simplyblock/vela-os#33 (patches 0026 and 0027).

Changes

  • CSI primer (pnfs_prime.go):
    • Re-probes a staging mount when its READ/WRITE count through the MDS grows, at most every 30 s. Before this change the primer probed only on stage, after a failure, or after a reconnect.
    • Tracks runs of failed probes. After 5 minutes it logs an error and records a PNFSDataThroughMDS Warning event on the PVC, or on the PV when there is no PVC (pnfs_report.go).
  • mds-agent (mds_data_watch.go, --mds-data-interval, default 1 min): reads 0027's per-client counters and logs each client that sent at least 1 MiB through the server since its last look. Counts present at the agent's first look are not reported. A kernel without the counters produces no output.
  • CI (csi_build.yaml): a manual run can build the MDS image from another pnfs-os guest (guest_image input), because vela-os branch builds publish only pnfsos-<sha> tags.
  • Test plan: U-129..U-135 and F-21.

No RBAC change: the node role already lists PVs and creates events.

Verification

  • Unit tests were red before each change and green after, with -race. golangci-lint, the house-style gate, codespell, and go mod tidy are clean.
  • Images spdkcsi:fix-pnfs-probe-on-mds-data and spdkcsi:pnfs-mds-fix-pnfs-probe-on-mds-data (guest pnfsos-b6a7871) were built in run 44313979555.
  • F-21 on dev-ocp (CentOS Stream CoreOS 10, kernel 6.12 clients), with fio verify on two workers:
    • Two MDS failovers, one to another node. Both primers took the layout within seconds of the new guest, and both clients stayed direct. No verify errors.
    • The mds-agent named the one client sending unaligned O_DIRECT through the MDS, with matching byte counts, and named no one while all clients were direct.
  • Not verified: the fence-after-prime path. Neither failover caused a client reservation conflict on these 6.12 clients.

F-22 defects, fixed in 39aecbf

F-21 on dev-ocp found that a pod writing unaligned O_DIRECT made every probe look failed. The primer judges a probe by the mount-wide WRITE count, so it got 201 probes in 400 s and a PNFSDataThroughMDS event wrongly saying the probes "cannot take the block layout". Now:

  • The event is driven by what the node sees: the mount's READ/WRITE going through the MDS for 5 minutes, whatever the probes say. It names the possible causes (a client that cannot use the device, or I/O the layout does not serve, such as unaligned direct I/O) and the last probe's outcome, without picking one.
  • A failed probe is retried after 2 s, doubling to 30 s. A reconnect still retries it at once.
  • A probe that has not returned for 5 minutes is reported once as PNFSLayoutProbeHung. Lab cluster 111 had a probe stuck in D state in unlinkat.

The new behavior has not run live yet.

Merge order

Merge vela-os#33 first. The default GUEST_IMAGE (pnfsos) only carries 0027's counters after that merge. Without them the mds-agent watch stays silent.

🤖 Generated with Claude Code

noctarius and others added 3 commits November 18, 2026 13:49
…one that stays there (SFAM-2850)

A fence from the device brings no reconnect. The client marks the device
unusable, and every READ and WRITE of the mount goes through the metadata
server. The node plugin probed a staging mount only when first seen,
after a reconnect, or after a failed probe, so nothing took the layout
again from a namespace that can see the device. In SFAM-2850 the mount
also sent all of its I/O through the MDS for the rest of the run, and
the only trace was a warning per probe in the node plugin's log.

The primer now also probes a primed mount whose READs and WRITEs through
the server grew since the last pass, at most every 30 seconds, since
some I/O, such as unaligned direct I/O, goes through the server by
design. A mount whose probes have failed for 5 minutes is logged as an
error and reported once per run of failures with a PNFSDataThroughMDS
Warning event on the volume's claim, or on its PersistentVolume when it
has no claim. The node plugin's role already allows creating events and
listing PersistentVolumes.

Together with vela-os patch 0026, which holds a client's layouts again
after a fence or a probe through the server, the probe makes the first
device lookup once the device is usable again.

Tests were written first and failed on the unchanged primer: no probe
while data went through the server, no report after 5 minutes, and no
event. Test plan rows U-129 to U-133 and F-21. F-21, a failover on a live
cluster, is not run yet.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…t (SFAM-2850)

In SFAM-2850 one client sent 6.8 GB through the metadata server in 11
minutes, for the rest of a run, and nothing on the server said which
client it was. vela-os patch 0027 has the guest's nfsd count, per
client, the bytes of the READs and WRITEs it carries outside the grace
period and the layout hold, in /proc/fs/nfsd/clients/<id>/info.

The guest agent reads those counts every minute (--mds-data-interval,
0 turns it off) and logs a warning naming each client, by its NFS name
and address, that sent 1 MiB or more since the last look. The log
reaches the MDS pod log the way the nfsd watchdog's does. The first look
names nobody, a client first seen later is counted from zero, and a
guest kernel without the counts names nobody.

Tests were written first and failed on a watch that did nothing. Test
plan rows U-134 and U-135.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…est [skip ci]

CI built the MDS image only from the shared pnfsos tag, which only main
and pnfs-minimal move in vela-os. A guest built from any other vela-os
branch publishes only commit-pinned pnfsos-<sha> tags, so testing one
meant a local multi-architecture build. A manual run now takes the guest
image as guest_image, defaulting to pnfsos, so push and release builds
are unchanged.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…d probes, report a hung probe

F-21 on dev-ocp found two defects in the report this branch added. A probe
counts as failed when the mount's WRITE count grows under it, which a
pod's own writes through the metadata server cause too. A pod writing
unaligned O_DIRECT therefore failed every probe: 201 probes in 400
seconds, each with its own LAYOUTGET, and after five minutes a
PNFSDataThroughMDS event said the probes could not take the block layout,
which they had.

- The report is driven by what the node sees: the mount's READs and
  WRITEs going through the server for five minutes, whatever its probes
  say. That covers a fenced client, a kernel that cannot open the device
  (RHEL 9.5 on lab cluster 111), and a pod doing I/O the layout does not
  serve. The event names those causes and the last probe's outcome,
  without picking one.
- A failed probe is retried after 2s, doubling to 30s, instead of on
  every pass. A reconnect still retries it at once.
- A probe that has not returned for five minutes is reported once, as
  PNFSLayoutProbeHung. On cluster 111 a probe sat in D state in unlinkat
  and the mount was never probed again.

Test plan: U-131 rewritten, U-136 to U-139 and F-22 added.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@noctarius
noctarius marked this pull request as ready for review November 18, 2026 18:49
Copilot AI balanced review requested due to automatic review settings November 18, 2026 18:49

Copilot AI 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.

🟡 Changes recommended

An unbounded reporting request can stall layout recovery for every mount on the node, and transient PV-list failures can permanently suppress warning events.

2 open issues
What changed in this PR

Adds recovery and diagnostics for pNFS traffic that goes through the metadata server instead of the block device, covering the CSI node plugin and guest MDS agent.

Changes:

  • Re-probes mounts with metadata-server traffic, backs off failed probes, and reports persistent traffic or hung probes.
  • Adds a configurable MDS-agent watch that logs clients exceeding the traffic threshold.
  • Allows manual builds to select a guest image and expands unit tests and failure-injection scenarios.
File Description
operator/​docs/​tests/​test-plan-pnfs-rwx.md Documents new regression and failure-injection scenarios.
csi-driver/​internal/​mds/​agent/​mds_data_watch.go Watches per-client metadata-server byte counters.
csi-driver/​internal/​mds/​agent/​mds_data_watch_test.go Tests traffic thresholds, initial counts, and missing counters.
csi-driver/​internal/​driver/​driver.go Connects the layout primer to Kubernetes event reporting.
csi-driver/​internal/​csi/​node/​pnfs_report.go Records traffic and hung-probe warnings on PVCs or PVs.
csi-driver/​internal/​csi/​node/​pnfs_report_test.go Tests event targets, reasons, and messages.
csi-driver/​internal/​csi/​node/​pnfs_prime.go Adds traffic-triggered probes, retry backoff, and reporting state.
csi-driver/​internal/​csi/​node/​pnfs_prime_test.go Tests re-probing, backoff, persistent traffic, and hung probes.
csi-driver/​cmd/​mds-agent/​main.go Configures and starts the MDS traffic watch.
.github/​workflows/​csi_build.yaml Adds a guest-image override for manual MDS builds.

Review effort: Balanced

…etry a failed one

Two review findings on #931:

- The report ran in the primer's only loop, on a context with no
  deadline, through a client with no request timeout. An API server that
  accepted the request and never answered stopped probes, data re-probes,
  and alias refreshes for every mount on the node. Each report now runs
  in its own goroutine under a 30s deadline.
- overdue() marked a mount reported before the report was recorded, and a
  failed report was only logged, so a mount that stayed affected never
  got its event. A failed report clears that mark and is sent again after
  a minute.

The reporter returns its error to the primer instead of logging it.
Test plan: U-144 and U-145.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@noctarius
noctarius merged commit 592da9d into main Nov 19, 2026
25 checks passed
@noctarius
noctarius deleted the fix/pnfs-probe-on-mds-data branch November 19, 2026 09:27
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