Skip to content

pnfs-common: let a metadata server instance register under a key of its own - #30

Merged
boddumanohar merged 1 commit into
pnfs-minimalfrom
feat/pnfs-mds-pr-key
Nov 11, 2026
Merged

boddumanohar merged 1 commit into
pnfs-minimalfrom
feat/pnfs-mds-pr-key

Conversation

@boddumanohar

@boddumanohar boddumanohar commented Oct 21, 2026 •

Copy link
Copy Markdown
Member

Guest image changes for the hot-standby pNFS metadata server in simplyblock/simplyblock-operator#767. With this image a guest boots as a standby: no state disk, and no nfsd until the operator promotes it. On promotion, mds-agent fences the devices, mounts the state volume, and starts nfsd. Each guest can register its own NVMe reservation key, so a promoted guest can preempt the old active.

Changes

  • Kernel patch 0025, nfsd.pnfs_mds_pr_key: a u64 module parameter that the agent writes before nfsd starts. While it is 0, behavior does not change (one constant key). When it is set, nfsd does not register or reserve anything itself. It serves a device only while that key holds the device's reservation, so a device it does not hold is not exported and GETDEVICEINFO for it fails. The stale-key fence skips keys whose top byte is 0x01, so a fenced instance never preempts a newer one. Writing the parameter while nfsd threads are running returns EBUSY.
  • Kernel patch 0024, xfs.pnfs_discarded_free_space: off by default. When it is set, and the filesystem is mounted with -o discard on a device whose discarded blocks read as zeros, XFS discards every extent it frees. After a full FITRIM, a zeroed write layout over a hole is allocated written, with no WRITE ZEROES. Motivation: one LAYOUTGET spent 15 s in blkdev_issue_zeroout.
  • No state disk: post-build.sh no longer adds the virtio-pnfs-state fstab entry, and it removes any old one, so a guest without the disk still reaches local-fs.target. On promotion, mds-agent mounts the state volume (the nfsdcld client-recovery DB) at /var/lib/nfs. The RequiresMountsFor=/var/lib/nfs drop-ins for nfs-server and nfsdcld are deleted.
  • nfsd gated on promotion: nfs-server.service is no longer enabled at boot. nfs-server, nfs-mountd, and nfsdcld each get a standby.conf drop-in with ConditionPathExists=/run/mds/active. mds-agent creates that file once it has fenced every device, mounted the state volume, and set the reservation key.
  • mds-agent.service: drops RequiresMountsFor=/var/lib/nfs and After=nfs-server.service, so it starts at boot on a standby and answers the runner's health and Describe/Promote calls.
  • tmpfiles: the state volume is mounted over /var/lib/nfs after tmpfiles has run, so mds-agent reruns systemd-tmpfiles --create for the export-root entries after the mount. The change here is a comment that documents this.
  • README: documents the standby boot and patches 0024 and 0025. The hostname must now be the same on every guest of a storage cluster (the StatefulSet name), so clients reclaim state on the new active.
  • CI (pnfs-os.yml): only main and pnfs-minimal move the shared pnfsos/pnfsos-<arch> tags. Other branches push only the commit-pinned pnfsos-<sha> tags.

Testing

  • Rebased onto pnfs-minimal (6bc04ec). The full patch series 0001-0025 applies cleanly, in order, to linux-6.18.55 (tarball sha256 matches linux.hash).
  • bash -n passes on post-build.sh.
  • The image was not rebuilt after the rebase; CI's pnfs-os workflow builds it.

Notes

@boddumanohar
boddumanohar changed the base branch from main to pnfs-minimal October 21, 2026 13:04
Guest image side of the warm-standby metadata server
(simplyblock/simplyblock-operator#767). A guest boots with no state disk and
no nfsd; mds-agent fences the devices, mounts the state volume, sets the
reservation key, and only then lets nfsd start.

- Kernel patch 0025: nfsd.pnfs_mds_pr_key lets a metadata server instance
  register under a reservation key of its own and serve only the devices it
  holds.
- Kernel patch 0024: xfs.pnfs_discarded_free_space skips zeroing free space
  for write layouts once discarded blocks read as zeros.
- No state disk fstab entry; nfs-server, nfs-mountd, and nfsdcld wait for
  /run/mds/active, which mds-agent creates on promotion.
- CI: only main and pnfs-minimal move the shared pnfsos tags; other branches
  push commit-pinned tags.

Co-authored-by: Christoph Engelbert (noctarius) <me@noctarius.com>
@boddumanohar
boddumanohar marked this pull request as ready for review November 11, 2026 12:10
@boddumanohar
boddumanohar merged commit 5040d7d into pnfs-minimal Nov 11, 2026
1 check passed
@boddumanohar
boddumanohar deleted the feat/pnfs-mds-pr-key branch November 11, 2026 12:33
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