🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

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

#368
From: bugzilla-noreply
Date: Thu, 05 Nov 2026 06:58
75 lines
5761 bytes
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=300130

--- Comment #4 from Nick <e@4779.name> ---
The proposed odsp guard is insufficient: the loop survives via
nfscl_hasexpired().

Evidence (15.1-RELEASE amd64 client, kernel built from release sources with
attachment 276661 applied; Linux nfsd 7.2.9 server, NFSv4.1 hard mount,
nconnect=4, constant torrent-seeding READ load):

1. Bypass path. odsp is only assigned when retokp != NULL
   (nfs_clrpcops.c:1059-1064 in 15.1). nfscl_hasexpired() calls
   nfsrpc_setclient(nmp, clp, 0, NULL, cred, p) (nfs_clstate.c), so odsp
   stays NULL there and the verifier bump fires unconditionally on every
   hasexpired cycle.

2. With the guard applied, the loop re-armed within days and then ran
   continuously for ~40 hours: 720+ "Initiate recovery" prints (typically
   8-12/h under load, peaks 71/h). Server tracepoints during that period
   showed nfsd_clid_confirmed with the same owner hash replacing itself
   (6aebe03c:659355c1 -> c2), with OP_READ status=10025 bursts (15 in a
   3-minute window). Client narration (vfs.nfs.debuglevel=1) showed full
   cycles "exchangeid err=0 / aft exch=0 / aft createsess=0 / aft
   reclaimcomp=0" without the "create session for extant ClientID" line —
   the retokp==NULL path.

3. Verifier semantics. co_verf = (nfs_exchangeboot, nfsc_rev); the boot half
changes on client reboot, so nfsc_rev only distinguishes incarnations within
one client lifetime. A recovery-triggered bump fabricates a reboot the client
never had, and the server destroys a record that was still valid.

Revised fix, tested locally on 15.1: bump only when the clientid has never
been established in this clp's lifetime, plus a bounded escalation.

- gate: if ((clp->nfsc_flags & NFSCLFLAGS_HASCLIENTID) == 0 ||
  clp->nfsc_hasexpcount >= 3) clp->nfsc_rev = rev++;
- nfscl_hasexpired() counts consecutive cycles (writes serialized by
  clp->nfsc_lock) and resets after a quiet period of one lease interval
  (2 * nfsc_renew; nfsc_renew is half the lease)
- the v4.0 SETCLIENTID path is untouched

The escalation threshold covers the legitimate cases first: one hasexpired
cycle is an ordinary lease expiry, two can be a recovery race, three in a
row means a stuck client record that s18.35.4 case 2 keeps returning
confirmed but unusable. After escalation, each further hasexpired cycle
rotates the verifier until a quiet lease interval resets the counter.

HASCLIENTID is set-only in-tree (set on mount success and recovery, cleared
only when the client is freed), so the gate holds across all retokp call
shapes.

Verification with this patch, plus cherry-picked 7a0021a0988f (PR 299221,
extant-ClientID STALE_CLIENTID fallthrough) and 77a7a48a1cb0 (PR 298416,
session-slot leak on write error paths; no recovery interaction): one
bounded recovery at boot, then zero "Initiate recovery" prints over 1.5h
across two reboots under the same seeding load; no compounds with non-zero
status in a 3-minute tracepoint window 40 minutes after boot; client RPC
counters TimedOut=0 across 1.56M requests. 7 amuled SIGABRTs occurred
during the churn period (correlated with stateid-death windows; no cores
captured, so causation unproven) and none after the patch.

Patch attached: nfscl-verifier-v2-upstream.patch (relative to attachment
276661).

-- 
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-9tHp8k9gho@https.bugs.freebsd.org/bugzilla/>
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.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
References: <bug-300130-227@https.bugs.freebsd.org/bugzilla/>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!archive.usenet.blueworldhosting.com!usenet.blueworldhosting.com!diablo1.usenet.blueworldhosting.com!2.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: Thu, 05 Nov 2026 06:58:45 +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-9tHp8k9gho@https.bugs.freebsd.org/bugzilla/>
References: <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="48057"; 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=1793861925;
	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:
	 in-reply-to:in-reply-to:references:references;
	bh=QGEKog8lJ78k0UNdsAgLJ5f7aLnkhaKxonIjuX4cvNc=;
	b=cUDF0pRjOiwfCSat/8gdYSPcQncsXvzl/JjknxyohQ8bAZCGY+NWW/GnlAYgfaPcg/CGlJ
	W5sDcUlE8d3k7fI78WVRqUG1RufUOwFbmoW+wuE2lg5pDcJNNwS6LJJpPJwwooQhWwAw7G
	EFQ/RLhzPU8xfKn4fINgjZ6TnzTDw8vqpMy77Iz/GQhiRWpfKooxVbfoYHjt/AsH9E22Wq
	ldrF4yRNZinq4mlwIJo6C6UWmbzWOCtt9w1++psyIkH9kKmXiI/V1fNy6+KpxOUOPfulyL
	evRwVzxCB6BxwUR87jUvdf3dcM5mJrpelDlRxrF09ZFkGMN4xcLjkvAdn2myaw==
X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f
In-Reply-To: <bug-300130-227@https.bugs.freebsd.org/bugzilla/>
Auto-Submitted: auto-generated
Precedence: list
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes