Skip to content

pnfs-common: re-arm a client's layout hold after a fence, and count its data through the MDS (SFAM-2850) - #33

Merged
noctarius merged 3 commits into
pnfs-minimalfrom
fix/pnfs-hold-rearm-after-fence
Nov 18, 2026
Merged

noctarius merged 3 commits into
pnfs-minimalfrom
fix/pnfs-hold-rearm-after-fence

Conversation

@noctarius

@noctarius noctarius commented Nov 18, 2026 •

Copy link
Copy Markdown
Collaborator

Fixes the server side of SFAM-2850: after an MDS failover, a pNFS client stayed on the metadata server for the rest of the run.

Root cause

Patch 0001 holds a client's layouts until the CSI probe, which runs in the host mount namespace, is granted one. After the grant the client stays primed, and nothing ever unprimes it. In the failing run (pnfs_rwx_rapid_nogap_k8s-20261106-223856, worker-3):

  1. A new MDS instance fenced the old reservation keys (0018/0025). worker-3 hit a Reservation Conflict, and the client marked the device unavailable for 120 s.
  2. The probe was granted after grace and primed the client, but its write went through the MDS because the device was unavailable.
  3. Every later device re-lookup came from an app pod, whose /dev has no disk/by-id, and failed. The probe failed 482 times over 16 minutes.

This is not a reverted behavior. 0001 is unchanged from d64d549 to 8bce4bd, 07a25e6 only made it per-generation, and no other patch touches the hold.

Changes

  • 0026: unprime the client and restart the hold:

    • after a fence (nfsd4_cb_layout_done's fence branch, and the 0019 unreturned-layout fence)
    • when the probe file is written through the server outside grace

    With the hold re-armed, the next LAYOUTGET waits for the probe from the host namespace again.

  • 0027: per-client pnfs mds read bytes / pnfs mds write bytes in /proc/fs/nfsd/clients/*/info, so the server can name a client whose data goes through it. Bytes are not counted for loopback clients, during grace, or while a hold is active.

  • README: the patch count and the two new paragraphs.

Verification

  • The series compiles at W=1 on 6.18.55, both with and without CONFIG_NFSD_PNFS.
  • Guest pnfsos-b6a7871 was built (run 44308992481) and tested on dev-ocp (CentOS Stream CoreOS 10, kernel 6.12 clients):
    • Two MDS failovers, one to another node. Both clients returned to direct I/O within seconds, with no fio verify errors.
    • 0027's counters matched the unaligned-I/O rate one client sent through the MDS.
    • The hold was not re-armed while the probe went direct.
  • Not verified: the fence-after-prime path itself. Neither failover caused a client reservation conflict on these 6.12 clients. The bug was on RHCOS 5.14, so that path still needs the rapid-failover suite on an RHCOS cluster.

Companion operator PR: simplyblock/simplyblock-operator#931

🤖 Generated with Claude Code

noctarius and others added 2 commits November 18, 2026 13:31
…device

0001 primed a client on a filesystem when its probe was granted a
layout, and nothing unprimed it. In SFAM-2850 a metadata server failover
fenced a client's key, the client marked the device unavailable, and its
probe was granted a layout it could not use, which primed it. Two
minutes later an application task made the device lookup, which fails
in a pod's mount namespace, and the mount sent all of its I/O through
the server every two minutes from then on.

Kernel patch 0026 unprimes the client and restarts its hold when it
writes the probe through the server outside grace, and when nfsd fences
it on the filesystem's device. No earlier patch did this: 0001 is
unchanged from d64d549 to 8bce4bd, 07a25e6 only made the hold per
generation, and no other patch on any branch touches it.

The series 0001 to 0026 applies to a clean 6.18.55, and fs/nfsd and
fs/xfs build without warnings at W=1 (arm64), fs/nfsd also with pNFS
disabled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…rver

Kernel patch 0027 has nfsd count, per client, the bytes of the READs and
WRITEs it carries on an export that hands out layouts. Grace, the
client's layout hold, and loopback clients are excluded, because data
through the server is expected there. /proc/fs/nfsd/clients/<id>/info
shows the counts as "pnfs mds read bytes" and "pnfs mds write bytes". In
SFAM-2850 a client sent 6.8 GB through the server in 11 minutes and
nothing said which client. The guest agent (simplyblock-operator,
fix/pnfs-probe-on-mds-data) logs each client whose count grows.

The series 0001 to 0027 applies to a clean 6.18.55, and fs/nfsd and
fs/xfs build without warnings at W=1 (arm64), fs/nfsd also with pNFS
disabled.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🟡 Changes recommended

A critical race allows an in-flight LAYOUTGET to bypass the restarted hold because re-arming leaves the generation unchanged, potentially recreating SFAM-2850.

1 open issue
What changed in this PR

This PR extends the shared pNFS kernel patch series to help clients resume direct device I/O after fencing or failover, addressing SFAM-2850, and adds visibility into traffic handled by the metadata server.

Changes:

  • Re-arm client layout holds after fencing or probe writes through the metadata server outside grace.
  • Add per-client metadata-server read/write byte counters, excluding loopback clients, grace periods, and active holds.
  • Document both patches and update the patch count.
File Description
prototype/​boards/​pnfs-common/​README.md Documents recovery behavior and per-client counters.
prototype/​boards/​pnfs-common/​patches/​linux/​0027-nfsd-count-the-data-each-client-sends-through-a-pNFS-server.patch Adds metadata-server traffic counters to client information.
prototype/​boards/​pnfs-common/​patches/​linux/​0026-nfsd-hold-a-client-s-layouts-again-when-its-probe-misses-the-device.patch Restarts layout holds after fencing or probe fallback.

Review effort: Balanced

LAYOUTGET checked the layout hold a second time, after mapping the
blocks, only when a grow had raised the generation. An unprime from
0026 (a fence, or the probe written through the server) leaves the
generation as it was, so a request that passed the first check while
the client was still primed handed out a layout the restarted hold
should have refused. Check again for every request except the probe.

0027 is regenerated on top; its changes are the same.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@noctarius
noctarius merged commit 2e5b852 into pnfs-minimal Nov 18, 2026
1 check passed
@noctarius
noctarius deleted the fix/pnfs-hold-rearm-after-fence branch November 18, 2026 17:19
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