🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: muc.lists.freebsd.current
Article #254

Re: vnode locks vs write backs in the NFS client

#254
From: Rick Macklem
Date: Sun, 29 Nov 2026 22:20
66 lines
8405 bytes
On Sun, Nov 29, 2026 at 10:28 AM Konstantin Belousov <kib@freebsd.org> wrote:
>
> On Sun, Nov 29, 2026 at 09:57:57AM -0700, Rick Macklem wrote:
> > Hi,
> >
> > During testing of the RDMA code being done by the NVidia folk,
> > they got a panic caused by VOP_STRATEGY() being called with
> > an unlocked vnode.
> >
> > They had delegations enabled (and were accessing the same
> > file from multiple mounts) along with WITNESS and INVARIANTS.
> >
> > The panic is not surprising, since the nfscl thread tries to do
> > write backs without the vnode lock. This is not so much a bug
> > as a faeture, since the NFS client has done write backs with
> > the buffer lock held, but no vnode lock, since the code was
> > written decades ago. (Note that LK_EXCLOTHER is a NFS
> > related "hack", but vop_asser_locked() does not consider
> > that case as locked.)
> >
> > I'm guessing people haven't been reporting this for..
> > - Running production kernels without DEBUG_VFS_LOCKS,
> >   INVARIANTS, WITNESS.
> > - Not enabling delegations (for this case).
> >
> > I do believe that the current code is safe, in the sense that
> > the buffer lock is sufficient to maintain consistency during
> > write backs to the NFS server. (A "umount -N" handles this
> > stuff ok. Not sure about "umount -f", but "umount -f' is mostly
> > useless for the NFS client, anyhow.)
> >
> > So, what can we do??
> >
> > I think the best approach might be to convert the NFS client to
> > using shared vnode locks for writing (like ZFS currently
> > does).  That way, the NFS client can acquire the shared
> > vnode lock for write-backs when other threads have the
> > vnode shared locked for writing.
> > --> However, this could take a while to implement.
> >
> > In the meantime, I think we just accept that debug kernels
> > won't work correctly, at least when delegations are enabled.
> >
> > Other ideas?
>
> Or add VOP_STRATEGY_UNLOCKED(), changing all implementations in fses to
> provide VOP_STRATEGY_UNLOCKED().  VOP_STRATEGY() would simply redirect
> to VOP_STRATEGY_UNLOCKED().
>
This seems simple enough, but maybe a bit of an overkill to have both
VOP_STRATEGY()
and VOP_STRATEGY_UNLOCKED().

You guys probably won't like this hokey variant, but what about just dropping
the requirement for a locked vnode from VOP_STRATEGY() and then
adding an ASSERT_VOP_LOCKED() to the vop_strategy() for file systems
that need to have it locked.

rick


--
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: <CAM5tNy5y-q3m4AuF53MZ1Ytz1kvy5Wc4fMJ_6zeNw1mDJmu68g@mail.gmail.com>
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail
References: <awxgnk2qkUeej3aI@kib.kiev.ua> <>

Show Full Headers
Complete Article Headers
Path: mbox-mo1.pugleaf.net!srv.newsdeef.eu!newsfeed.bofh.team!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!news2.arglkargh.de!news.karotte.org!news.muc.de!.POSTED.news.muc.de!not-for-mail
From: Rick Macklem <rick.macklem@gmail.com>
Newsgroups: muc.lists.freebsd.current
Subject: Re: vnode locks vs write backs in the NFS client
Date: Sun, 29 Nov 2026 15:20:35 -0700
Organization: Newsgate at muc.de e.V.
Approved: news-admin@muc.de
Distribution: world
Message-ID: <CAM5tNy5y-q3m4AuF53MZ1Ytz1kvy5Wc4fMJ_6zeNw1mDJmu68g@mail.gmail.com>
References: <awxgnk2qkUeej3aI@kib.kiev.ua> <>
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="66046"; mail-complaints-to="news-admin@muc.de"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1795990879;
	h=from:from:reply-to:subject:subject:date:date:message-id:message-id:
	 to:to:cc:cc:mime-version:mime-version:content-type:content-type:
	 content-transfer-encoding:content-transfer-encoding:
	 in-reply-to:in-reply-to:references:references:list-id:list-help:
	 list-owner:list-unsubscribe:list-subscribe:list-post;
	bh=hD/i2UZ1zBdnH7/6EqaGX+RS6+t4CXR/G4rrp+JltEU=;
	b=MP+AohJWR0N9stKzUGL2QeHf/Ay4ne/qLnKNAYrx0kJZR7sZxsIIu+3RWdA+oqzPCIhNa6
	srGP+uq986yMASStQE1sgd72H8YLpAbFC/yh0dnZheZatGvhJb3DNnCFOMbXuuYzTX0SZ4
	ks6nyClrauzn/XhacLFPCX0QQYj+RXwwWf2vc5zNJ069vE89zVecxaKoiM4pMsvK7AjywJ
	01hx32f8wFZ4mL0OIZABEq5QeV9x1nUA+m3V6DVueUOZrEL3XOTDRxXdn40jwtVBFKsYye
	smNVDL3sEOgMDWOt/oR9GbmqX9df54WH0uHO/DBW4tszINC+gksmIxiL+60WKg==
X-Original-To: freebsd-current@mlmmj.nyi.freebsd.org
Authentication-Results: mx1.freebsd.org;
	dkim=pass header.d=gmail.com header.s=20260707 header.b=xD1zDqOL;
	spf=pass (mx1.freebsd.org: domain of rick.macklem@gmail.com designates 2a00:1450:4864:20::532 as permitted sender) smtp.mailfrom=rick.macklem@gmail.com;
	dmarc=pass (policy=none) header.from=gmail.com;
	arc=pass ("google.com:s=arc-20260327:i=1")
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=gmail.com; s=20260707; t=1795990849; x=1796595649; darn=freebsd.org;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:from:to:cc:subject
         :date:message-id:reply-to:content-type;
        bh=hD/i2UZ1zBdnH7/6EqaGX+RS6+t4CXR/G4rrp+JltEU=;
        b=xD1zDqOL0Vzi59tMN+7sslx5U/EGx57/jlrgmUTYFulQYN+7kidUmm6W/0sZfhEwQu
         Ybr64UrnIzgZ3jL3yfQKN4i85hHotM0c2GZXfrBmbEFGodv6wY09XynZd7+YEO3/RxBt
         /lVNHQea/yeJsZdNWcSuMF3ULdG5sMGXdPcZtd9IMSdLnlRrAKwmpCAMdRdOL/KPxPIH
         vsOX41W4pk/WEzehefoGhq0nqdA5oBwZWw3Rna9nmBPFVizaSP7l2PHvPcSb7hipCPiu
         ll1OyrSpWRYJt849Yp2+P60pSnV1rQWqRdtRb4IIaxioO1pf6Zi/yXvPRRv3B1k/N064
         i54Q==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795990849; x=1796595649;
        h=content-transfer-encoding:content-type:cc:to:subject:message-id
         :date:from:in-reply-to:references:mime-version:x-gm-gg
         :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to
         :content-type;
        bh=hD/i2UZ1zBdnH7/6EqaGX+RS6+t4CXR/G4rrp+JltEU=;
        b=ztblgolmoA6laDvhhif+kj2X7p4APpkjyrhi3J+VlhaE0FRMMho0xku3tIhK3ebSVj
         8qsE5I9FSOPiiI6ArAsJgfozmwTqjmNDT0ETRzjYewfo50dad62IukhVhlZWY3x1d+sB
         akQ9hCx6c5azBX5IwvR6BqwZll8F/cy6/21QUuIjSZ+t+cXzloymnCCOB6DYZ8R8Ip6+
         EW4wg82ch/DLXUJ4RUy5RP/+U76+qKFMo9P04rIFEtTuNUYqccuR+UFvLOPLYItBi4Bo
         Js6xVNdblRjwW5b9+f1SJkwI0hhxPJ0nIBNLWQmaWjDF3ckbLp3EH1x0xHfDlcPgqIxI
         LB7Q==
X-Forwarded-Encrypted: i=1; AL+hErFjHHTbhklqRjaDt9MP8qkKcTTaeO3pBFhOgc7vIkvDWxCSw+iFRXY0sO6VkznfkMpQKAelJ97ITBN3edcaSI4=@freebsd.org
X-Gm-Message-State: APuU4Z/T0I5UKdCLMxDYu9uAv8X3qCClRfuY8WsUmyL+y3IAKgUiVeh7
	abABW3XThJ6Dw32jqPoPm+CaO/Vvu67iGAo5IaMtBZ+yVK0hcdNBNtDJcWTrtzghQ1E9MaciNmT
	Uv4FTsB8eXynHho3DLcpGa5ybdECz6g==
X-Gm-Gg: AZFdTZfSBQVtade1AdQeYNrGHgTfaVNSSnPcJ054q2qkcqixMviTizm1jXPgozttiqA
	GLK1nhorgBaObqNox9gi/YRJ/ScQ6jij1ZNwEqjUKUTAN8KCoSLdtHWk6yumpTsHf2N02vtFy91
	VxmIYiaGUzNztbHVq0dkjT1NYkQHiNQwntgP6ocEOvczH+09BQ0eef0iCl5J47RPRMy3nhkm3yQ
	O6/kCYO8n8BmKkErhv4xoKeIIkHtcknxywYLp+lzLM4HIr/k5erLkTGFywES6u0N0iaA3D1RAp/
	iZCOcUchB6fICyeESuXUUKL5WghSgk48HV16lxTn8VJ8182LqEenKtGK6K3FnQtJ/Jc9mc/JOau
	pUHtUtH0HEIHCfEXsi/RHTS7x94oYUfg53ZP6Tstsk6U6DsPQ6mNA4y45OtYX4Zv2PT3dznHPnp
	TVOSHznfxggzoWXcE=
Precedence: list
In-Reply-To: <awxgnk2qkUeej3aI@kib.kiev.ua>
X-Gm-Features: Aa3M54pXTkazj_9_3tf3c8eEzyoeITPz0FOOcGd9l0e99IFwM4CgnDdXyqUpqng
X-Rspamd-Queue-Id: 4jd1nc09DRz3LyJ
X-Spamd-Bar: --
X-Spamd-Result: default: False [-2.00 / 15.00];
	ARC_ALLOW(-1.00)[google.com:s=arc-20260327:i=1];
	DMARC_POLICY_ALLOW(-0.50)[gmail.com,none];
	R_DKIM_ALLOW(-0.20)[gmail.com:s=20260707];
	R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4864::/56];
	MIME_GOOD(-0.10)[text/plain];
	ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US];
	RCVD_COUNT_ONE(0.00)[1];
	MISSING_XM_UA(0.00)[];
	DWL_DNSWL_NONE(0.00)[gmail.com:dkim];
	MIME_TRACE(0.00)[0:+];
	FREEMAIL_ENVFROM(0.00)[gmail.com];
	FREEMAIL_FROM(0.00)[gmail.com];
	MID_RHS_MATCH_FROMTLD(0.00)[];
	RCVD_TLS_LAST(0.00)[];
	MLMMJ_DEST(0.00)[freebsd-current@freebsd.org];
	RCPT_COUNT_THREE(0.00)[4];
	FROM_EQ_ENVFROM(0.00)[];
	FROM_HAS_DN(0.00)[];
	RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::532:from];
	TO_MATCH_ENVRCPT_SOME(0.00)[];
	TO_DN_ALL(0.00)[];
	PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org];
	ALIAS_RESOLVED(0.00)[];
	DKIM_TRACE(0.00)[gmail.com:+]
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes