🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: vnode locks vs write backs in the NFS client

#253
From: Rick Macklem
Date: Sun, 29 Nov 2026 20:45
62 lines
8269 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().
>
Another possibility is to re-write ncl_flush() so that it doesn't do bwrite()
and just calls the NFS code to do the write. My hesitation about doing
this would be a need to track any changes (b_flags, etc.) that bwrite()
handles in the NFS code.

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: <CAM5tNy4OTzgKxn13ZuYrr2PWRvSRvLvwgW4+gOsG=VhWxX1_rg@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 13:45:15 -0700
Organization: Newsgate at muc.de e.V.
Approved: news-admin@muc.de
Distribution: world
Message-ID: <CAM5tNy4OTzgKxn13ZuYrr2PWRvSRvLvwgW4+gOsG=VhWxX1_rg@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="99224"; mail-complaints-to="news-admin@muc.de"
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim;
	t=1795985154;
	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=5CnYPZgVLVBb7ONZASdP2NZaSB1UNX4nBTA8aejbF48=;
	b=cOSOlAZZ0SIydO6mVL04B+YHUwEYxEp+Qhhvy/7roqWv4IcttibDzepC8Pt0afUJlhJjWN
	tRGiMfDH16U6oSb/tdOYqJFwGOTfHseHhrLCsMbXC2ZkwNLTrFLryW689TNRZaLTkS5/JN
	l8+lr1sut3Yq8mcneCpT0msSWwEHU4KGqRLoLx6lVq11TEjUzZpRrGHquGzBt1HN9sHYx8
	pfxxa/5eQIQX1rQhwx3euvQ6vtcymDn/RJ+tjmGjSbVHijQWzSquwoNVk8fZqbuKvA02O5
	/ysHjle7kluF9WdeAMwkIAVpxRbY1cBxDOkm+AZw9oxP+d1KNt49a5/TIPDjRw==
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="G/uMA3ZY";
	spf=pass (mx1.freebsd.org: domain of rick.macklem@gmail.com designates 2a00:1450:4864:20::536 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=1795985127; x=1796589927; 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=5CnYPZgVLVBb7ONZASdP2NZaSB1UNX4nBTA8aejbF48=;
        b=G/uMA3ZYoYoNvtGmznZSAQ2f0xw+tRUoCkSHMOUh7lpSSEyxRhBfU1GkDncrfnTqyr
         +cSLj/imfp4YK6UKrMPGXFXhoYUPyshjoA8vHF3M68KZ+icRzwzsnf8bxhw8bINqFgy8
         BpzmoBqBppfT4xSn27TrGZzrw7cKdS05b3oLHVGsYv3jsZ7l+gueyDQTVgmzo/RomGYh
         Ndn16VYF5I6HcJjjps5SdlCNoPVVLTED3Pm0/0m0lLg1hXgqVxrwVAmIHPEDGim6qMeG
         Rr5Ylg+mDzPufCExVSwaCtGOTgdFiN8nHX2vzps1WzAPzTO304TGoXKI3y7ghcSmCp6y
         0i8w==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed;
        d=1e100.net; s=20260707; t=1795985127; x=1796589927;
        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=5CnYPZgVLVBb7ONZASdP2NZaSB1UNX4nBTA8aejbF48=;
        b=lc8VeMhDbfxlfnoJ8HjX9bXNuP0LlZYSOB8HDtCRyB1vx66xcAD6pFFQlDPY2bdU8l
         vO1xa4lv0TFXsCSsrJtMYmQM8Ic6CQQdd5xRGHV8igC2YriwnPF0fHwu/Fkbjg5YaiIp
         SLk7RqnUyXmXvjgqFS6aiUeYlATjizfG0QzsX5UPM5VE4K0I+xra5NzS/rQPj0QFXYUJ
         7AhoRAmb1RiI3Xn6z3b2f3C7M48b6J0qEccWucFd7ZK9kGBwd8egdqKdNx38jRhIRE1y
         5kk/IUjg2CQQ3LHsuh/Ocq30Dz+d9ejhKvfreONEVrYa9cm8BbfxjRiVXNbnU/GEzX8D
         H9/A==
X-Forwarded-Encrypted: i=1; AL+hErG3QzAwTvXkpiAMP1xQFcjQ8rz6yZSvBoiElB9y2mgw0IXYpQdo4Te21opX7Er5T1mvlk6yjvcDrtORicWXA48=@freebsd.org
X-Gm-Message-State: APuU4Z8z4Oxjm+N2NjtFFN9ULG2sOWS86D5h60g3446xIdyHDdzBrykC
	Sr4jb0f6EycVUwoty9SmbEfr2tGhpZ3YgD+AffILJ4TsA9UpzOUxi/ZmthALpf/O6Jr4OOVy1W/
	N7wuLcTnAE5PPeucxibJy9Wsvz6MxZQ==
X-Gm-Gg: AZFdTZctEHlgHhoCnV3UjpiZDd4djLCh/ovF6SwZgCMm1wzrRJyxtUfp1Lj4AtnkzoZ
	umjbZf7xpdF/EG+XkjllaBsyrGIbRe3PpNkwdN4SjYvEgDWfEV2oXFp2Z0Qx2TIGxPteXetqwLQ
	KpR7En5kRxcTvgVZr4PPaIaNlqzRdSSB08+XXOKRo9CWojrTpKRng0uITkpatHF48I9xDZfrn4B
	gXVKDna+i588oBrX5rAUukzpbzVhAlq3tagerNvYrMiSbeTLkKo8gwbn4clPd2eISWk6LvwhIQ6
	Es2ux3Xrt0FyO8bTymmTR/C151ClKmH+dukMc1jpRPxHq/JZoxvcNRJvuFnBLLbjhZCL3xm8lxb
	Y9q0G9hpTCPz6Qh6X2U02orVWZdDe//lnNFUDqjbhLRPw9rVShTaeoIrmL6d9ZA17VdPQ
Precedence: list
In-Reply-To: <awxgnk2qkUeej3aI@kib.kiev.ua>
X-Gm-Features: Aa3M54plwOo4U9zJn-uha9mwrKZk_ZhN447RHzA57MjgemjRY8VAjhWHXhmP7Xo
X-Rspamd-Queue-Id: 4jczgZ4slxz4nl1
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_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4864::/56:c];
	R_DKIM_ALLOW(-0.20)[gmail.com:s=20260707];
	MIME_GOOD(-0.10)[text/plain];
	ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US];
	RCVD_COUNT_ONE(0.00)[1];
	MIME_TRACE(0.00)[0:+];
	FREEMAIL_FROM(0.00)[gmail.com];
	MISSING_XM_UA(0.00)[];
	DWL_DNSWL_NONE(0.00)[gmail.com:dkim];
	FREEMAIL_ENVFROM(0.00)[gmail.com];
	RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::536:from];
	RCVD_TLS_LAST(0.00)[];
	RCPT_COUNT_THREE(0.00)[4];
	TO_MATCH_ENVRCPT_SOME(0.00)[];
	FROM_EQ_ENVFROM(0.00)[];
	FROM_HAS_DN(0.00)[];
	MID_RHS_MATCH_FROMTLD(0.00)[];
	PREVIOUSLY_DELIVERED(0.00)[freebsd-current@freebsd.org];
	ALIAS_RESOLVED(0.00)[];
	TO_DN_ALL(0.00)[];
	MLMMJ_DEST(0.00)[freebsd-current@freebsd.org];
	DKIM_TRACE(0.00)[gmail.com:+]
X-Newsgate-Id: f02c70b8849f+
X-No-Archive: Yes