🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.freebsd.bugs
Article #270

[Bug 300130] nfscl: EXCHANGE_ID verifier bump on every recovery causes client-replacement churn against Linux nfsd

#270
From: bugzilla-noreply
Date: Tue, 27 Oct 2026 07:07
94 lines
5794 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300130

            Bug ID: 300130
           Summary: nfscl: EXCHANGE_ID verifier bump on every recovery
                    causes client-replacement churn against Linux nfsd
           Product: Base System
           Version: 15.1-RELEASE
          Hardware: amd64
                OS: Any
            Status: New
          Severity: Affects Only Me
          Priority: ---
         Component: kern
          Assignee: bugs@FreeBSD.org
          Reporter: e@4779.name

## Summary

nfsrpc_setclient() bumps clp->nfsc_rev and sends co_verf = (nfs_exchangeboot,
nfsc_rev) on EVERY setclient (sys/fs/nfsclient/nfs_clrpcops.c:1113 for v4.1,
:1185 for v4.0; verifier built at :5541-5542). Per RFC 5661 s18.35.4 a changed
verifier with the same owner means 'client rebooted': the server discards ALL
prior state (sessions, stateids). When recovery is initiated not by a real
reboot but by a racing operation failing NFSERR_BADSESSION/STALE_STATEID
(nfscl_initiate_recovery -> nfscl_recover -> setclient), the client destroys
its own valid server-side state. Every in-flight op then fails
(BADSESSION on old session slots, BADSTATEID for old open stateids), each
failure initiates recovery again, and the loop self-sustains for as long as
streaming traffic races the replacement.

## Observed on 15.1-RELEASE-p5 (amd64), NFSv4.2 mount, Linux nfsd 7.2.9 server

mount options: nfsv4,minorversion=2,tcp,resvport,nconnect=4,hard,cto

- Server tracepoints (nfsd_clid_confirmed / nfsd_cb_shutdown): full
  EXCHANGE_ID+CREATE_SESSION cycle every ~1-20 s around the clock under load;
  clientid cl_id counter +22 per 30 s; each predecessor session immediately
  nfsd_cb_shutdown state=DOWN.
- nfsd_compound_status(status!=0): OP_SEQUENCE status=10052 (BADSESSION)
  ~1/4 s and OP_READ status=10025 (BADSTATEID) ~2/s during bursts.
- Client narration (vfs.nfs.debuglevel=1): endless 'aft exch=0 / aft
  createsess=0 / aft reclaimcomp=0' full-recovery cycles; intermittent
  'Got badsession' / 'Marked defunct' / 'Badsession looping'.
- Collateral: close(2)-triggered COMMIT that lands inside a replacement window
  blocks forever (hard mount, rc_timeout=-1) — observed as userspace threads
  stuck in nfsrpc_commit -> clnt_reconnect_call for tens of minutes while the
  TCP connection stays ESTABLISHED and no retransmit SYN is ever sent.
- Verified identical code in main and stable/15 (2026-10-26).

## Related

- PR 299221 — recovery storm after BADSESSION (CREATE_SESSION retry vs
  EXCHANGE_ID fallback); fixed by patch, but the fallback path still bumps the
  verifier, so the loop below survives that fix.
- PR 299225 — struct nfsclds leak per recovery (same recovery machinery).
- Commit 5ab48fb9f7ac re-arms recovery on every BADSESSION (cited in 299221).

## Suggested direction

Do not change the verifier for recovery initiated from
nfscl_initiate_recovery()/nfscl_recover() when the clientid is still valid
server-side: keeping co_verf stable lets CREATE_SESSION on the extant clientid
succeed (the code already tries that first), so no state is destroyed and
racing ops simply retry on the new session. Bump nfsc_rev only when the client
truly lost its lease (nfscl_hasexpired path) or at first setclient.

## Repro

FreeBSD 15.1 client, Linux nfsd server, NFSv4.1+ hard mount with active
streaming reads (seeding) plus writes; induce any recovery (e.g. server-side
lease expiry) and observe the churn via server nfsd tracepoints.

-- 
You are receiving this mail because:
You are the assignee for the bug.

--
Posted automagically by a mail2news gateway at muc.de e.V.
Please direct questions, flames, donations, etc. to news-admin@muc.de
Technical Details
Message-ID: <bug-300130-227@https.bugs.freebsd.org/bugzilla/>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.space.net!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: bugzilla-noreply@freebsd.org
Newsgroups: muc.lists.freebsd.bugs
Subject: [Bug 300130] nfscl: EXCHANGE_ID verifier bump on every recovery
 causes client-replacement churn against Linux nfsd
Date: Tue, 27 Oct 2026 07:07:46 +0000
Organization: Newsgate at muc.de e.V.
Sender: owner-freebsd-bugs@FreeBSD.org
Approved: news-admin@muc.de
Distribution: world
Message-ID: <bug-300130-227@https.bugs.freebsd.org/bugzilla/>
MIME-Version: 1.0
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Injection-Info: news.muc.de; posting-host="news.muc.de:193.149.48.2";
	logging-data="759"; mail-complaints-to="news-admin@muc.de"
X-Original-To: bugs@mlmmj.nyi.freebsd.org
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1793084866;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding;
	bh=DJAOoyJzG9+sE+ihJOVuHkhiARBaX+VqkxRN3AaVb1A=;
	b=JhCbFKTBQ9bFkQkdH/DbfgM82L6MElkK19LICrZNEwtflfMEtkQTGVyKD05uiNok6TxUV4
	7OZvt8qx0zdlgv0PMHDWVcS9pvYoWwJZikdju1Vm5aEcoLbRDKFfelDM+FrOC3bP9994nA
	i8mjbF6klMTuafiEu2dPLEp1faV8OOHmQDLewwAQUv5cxJbAV4YSddu0aBjUPoR2NMpMTQ
	nnl+PPPi4DknzP/ijv1UANCLjA9SNHtRMm+yCKo3mj4S9dgFLA3Nw/VNg48gO7/8ORg3Mo
	c5RI9GAyQkGThOz7uXBN0hd5UhWlclZy6ebB+ErOaX4wtQpQMAMD7kfMpm2CbQ==
X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f
Auto-Submitted: auto-generated
Precedence: list
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes