From nobody Tue Mar 31 15:58:59 2026 X-Original-To: dev-commits-src-branches@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4flXqB6ZPvz6WFFv for ; Tue, 31 Mar 2026 15:59:02 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R12" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4flXq74YBZz3h1Y for ; Tue, 31 Mar 2026 15:58:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1774972739; 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=d6z/K7dXL0RW1nYxahS4ukWt37hWn9w1ekzs7QHl2rc=; b=MqHw8nJE1CHGMYeM46aJVm37fRKuxlRLyG3K1MnF4J4UVDDqbXEcboObVIl8htxUUs1PjH p4yIGvsGEi2b3V0GuyVwczgmqoI0ltOkCocmoXAvxqblLwSYU1bLnH2Trw8sGR0Hq7ejxH tNIs8E6qIe/ppGssnX6x96+U0BokWbzDM1F0zyopY0sIWGUeYO1CYee5PFtMcIwmywv4rp RcFEZF2wr6d1FJEcvpO7FYwYmCsYh+gaiDABfcTJC0NrhVjyojksBz1TE4MZisrJ6s89ZP 81np5vL5T2iF51uuM8PN3P/KmMBm+EApH4ecYB4zWK62TCcqf9MfAUhZFGkdAA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1774972739; a=rsa-sha256; cv=none; b=wcOpWElwlmcARaA+TxNOkVBb8ekUXkpAKeTXGeX8k5ueJQfVUnSc8ZObKGxHHUVzQsTb4z esJE11fEBi9PBfsUuFcngz8ezcXIoLg4z0S4oogzChDa54sSinhDBET0P/eULvUkdSGTLa t2A0YtR/y4X5ze2VxQDl6JlosbQohnM2ranqjyfSLHKM9fz7LPne8qs4F86Cs538EkYK1n PqdXPW9Avq6OJTvtH1+zs6mOutKnkQt/Il0tzkbgadUlU9tdwX0fjqudUp2543IAtTRdeN VhNsr60goAbdTkfsQi+IKADv1uh6hF1TT84ZpWH7EqqKAx/JLtCCnpo2qIVHng== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1774972739; 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=d6z/K7dXL0RW1nYxahS4ukWt37hWn9w1ekzs7QHl2rc=; b=sY6l0m2K+G7cUxOSpYcmJeuGVRJzriTvpiir/05rcKq3X8QDJW/rI/KJJMSqbiwvp6YjcQ Wmh1ejzcnFQQW3CZ9uigeORPHWokFPN/7LL6y14javyH33gQIoWm0Q6oGOD9RV+OkSzd18 3uDS0e0on2XHCFw2kvCyWHawT80nVuXZzYRRJjarC+th2ldGKhfRSBHYbVa8210CEtK5fB z+nSFzL8jAiWYvmXvrbuxy488LhhI+qfgqkWf+6hzhEV7oBnNB02JqNco1iPzb8cmB018p kMOddu5hyLmlsp03lyA3YprMNyHkhagjrUygJf0y0dgHgNpCJepthGyLR4CgVg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4flXq703cszc3h for ; Tue, 31 Mar 2026 15:58:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 3a0c1 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Tue, 31 Mar 2026 15:58:59 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: d86a85e9b5ec - stable/15 - nullfs: Fix handling of doomed vnodes in nullfs_unlink_lowervp() List-Id: Commits to the stable branches of the FreeBSD src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-branches List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-branches@freebsd.org Sender: owner-dev-commits-src-branches@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: markj X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: d86a85e9b5ecc59754616edcd915e7d9eae9bab1 Auto-Submitted: auto-generated Date: Tue, 31 Mar 2026 15:58:59 +0000 Message-Id: <69cbef43.3a0c1.41d1bf93@gitrepo.freebsd.org> The branch stable/15 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=d86a85e9b5ecc59754616edcd915e7d9eae9bab1 commit d86a85e9b5ecc59754616edcd915e7d9eae9bab1 Author: Mark Johnston AuthorDate: 2026-02-25 15:31:30 +0000 Commit: Mark Johnston CommitDate: 2026-03-31 15:57:29 +0000 nullfs: Fix handling of doomed vnodes in nullfs_unlink_lowervp() nullfs_unlink_lowervp() is called with the lower vnode locked, so the nullfs vnode is locked too. The following can occur: 1. the vunref() call decrements the usecount 2->1, 2. a different thread calls vrele() on the vnode, decrements the usecount 0->1, then blocks on the vnode lock, 3. the first thread tests vp->v_usecount == 0 and observes that it is true, 4. the first thread incorrectly unlocks the lower vnode. Fix this by testing VN_IS_DOOMED directly. Since nullfs_unlink_lowervp() holds the vnode lock, the value of the VIRF_DOOMED flag is stable. Thanks to leres@ for patiently helping to track this down. PR: 288345 MFC after: 1 week Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D55446 (cherry picked from commit 8b64d46fab87af3ae062901312187f3a04ad2d67) --- sys/fs/nullfs/null_vfsops.c | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/sys/fs/nullfs/null_vfsops.c b/sys/fs/nullfs/null_vfsops.c index 170a3dd51cd8..c3eec727aeea 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -461,16 +461,12 @@ nullfs_unlink_lowervp(struct mount *mp, struct vnode *lowervp) vhold(vp); vunref(vp); - if (vp->v_usecount == 0) { + if (VN_IS_DOOMED(vp)) { /* - * If vunref() dropped the last use reference on the - * nullfs vnode, it must be reclaimed, and its lock - * was split from the lower vnode lock. Need to do - * extra unlock before allowing the final vdrop() to - * free the vnode. + * If the vnode is doomed, its lock was split from the lower + * vnode lock. Therefore we need to do an extra unlock before + * allowing the final vdrop() to free the vnode. */ - KASSERT(VN_IS_DOOMED(vp), - ("not reclaimed nullfs vnode %p", vp)); VOP_UNLOCK(vp); } else { /* @@ -480,8 +476,6 @@ nullfs_unlink_lowervp(struct mount *mp, struct vnode *lowervp) * relevant for future reclamations. */ ASSERT_VOP_ELOCKED(vp, "unlink_lowervp"); - KASSERT(!VN_IS_DOOMED(vp), - ("reclaimed nullfs vnode %p", vp)); xp->null_flags &= ~NULLV_NOUNLOCK; } vdrop(vp);