Skip to content

fix(agent): run nfsdcld so nfsd skips the NFSv4 grace period - #762

Merged
redwhisk merged 2 commits into
masterfrom
fix/nfs-grace-nfsdcld
Oct 31, 2026
Merged

redwhisk merged 2 commits into
masterfrom
fix/nfs-grace-nfsdcld

Conversation

@AprilNEA

@AprilNEA AprilNEA commented Oct 31, 2026 •

Copy link
Copy Markdown
Member

The guest's NFSv4 grace period ran for the full 10 s on every boot: end_grace_early() got EBUSY because nfsd had no client tracker, and the macOS client retries a refused OPEN every 2 s. The first open under ~/ArcBox after boot waited 6–12 s (e2e nfs_export 8/10/12 s).

  • The agent mounts rpc_pipefs and starts nfsdcld on tmpfs before nfsd threads start, so nfsd logs "no clients to reclaim, skipping NFSv4 grace period". Without /sbin/nfsdcld in the rootfs it warns and keeps the old path.
  • Boot assets bump to 0.8.12, which ships nfsdcld (boot-assets 7eff507).

Measured on HV and VZ against the published 0.8.12: first open returns at once; e2e boot_assets nfs_export 0.0015 s (HV) and 0.0025 s (VZ).


Note

Medium Risk
Changes guest NFS bring-up ordering and boot asset pin; mis-timed nfsdcld readiness could still leave grace stalls, but behavior degrades to the prior path with warnings.

Overview
Fixes 6–12 s stalls on the first NFS open under ~/ArcBox after boot, caused by the full NFSv4 grace period when the kernel refused early v4_end_grace without a client tracker.

The guest agent now mounts rpc_pipefs, starts nfsdcld (tmpfs state) before nfsd threads, and waits until nfsdcld holds an inotify fd so startup ordering does not race with nfsd_mutex. Rootfs without /sbin/nfsdcld still works but logs a warning and keeps the old grace behavior. spawn_supervised factors shared daemon spawning for rpc.mountd and nfsdcld; end_grace_early skips when grace already ended and warns on failure instead of debug-only.

Boot assets pin moves to 0.8.12, which ships nfsdcld. Docs add a log entry with measurements; e2e boot_assets comments reflect nfsdcld vs legacy grace timing.

Reviewed by Cursor Bugbot for commit 0903eb5. Bugbot is set up for automated code reviews on this repo. Configure here.

The kernel refuses /proc/fs/nfsd/v4_end_grace without a client tracker,
so every boot ran the 10 s grace period and the host's first open under
~/ArcBox stalled 6-12 s on NFS4ERR_GRACE retries.

Mount rpc_pipefs and start nfsdcld, with its database on the /var tmpfs,
before nfsd starts. Wait for nfsdcld's pipe watch first: its fresh-database
upgrade reads nfsv4recoverydir, which blocks on the nfsd_mutex the threads
write holds while nfsd waits for the tracker. With the tracker up nfsd
skips grace. A rootfs without nfsdcld keeps the old behavior, and a failed
v4_end_grace write now logs a warning.
Boot assets 0.8.12 ship nfsdcld in the rootfs, so the guest agent's client
tracker starts and nfsd skips the NFSv4 grace period. The kernel is
unchanged from 0.8.11 (v0.0.25).
@greptile-apps

greptile-apps Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] This PR appears safe to merge; no actionable issues were found.

Summary

Starts nfsdcld before nfsd so a fresh guest can skip the NFSv4 grace period.

  • Updated boot assets let NFS opens skip the grace-period wait.

AprilNEA explicitly describes the full grace period on older rootfs images as an intentional fallback.

Diagram

%%{init: {'theme': 'neutral'}}%%
flowchart TD
  A[Ensure NFS export] --> B[Mount rpc_pipefs]
  B --> C[Start nfsdcld]
  C --> D[Wait for inotify descriptor]
  D --> E[Start nfsd threads]
  E --> F[Fresh tracker database lets nfsd skip grace]
  A -->|Tracker unavailable| G[Warn and continue]
  G --> E
Loading

Reviews (1) · Last reviewed commit: "chore(boot): bump boot assets to 0.8.12" · Reviewed by Greptile

@redwhisk
redwhisk merged commit 0903eb5 into master Oct 31, 2026
16 checks passed
@redwhisk
redwhisk deleted the fix/nfs-grace-nfsdcld branch October 31, 2026 09:05
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