From nobody Thu Feb 26 02:58:37 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 4fLx3y1WXxz6T3sN for ; Thu, 26 Feb 2026 02:58:38 +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 4fLx3y0RzNz42nS for ; Thu, 26 Feb 2026 02:58:38 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772074718; 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=4g09Ucc5d+vxt2QZU0ug7FdCQogMLVUf0o8k5i/hx7I=; b=SH3ZMkOEBUdjVPL2Tn1jbe0Pxpw/2HOsVN+dOeIw1GRrGq2YHYveGgUVQdv0qofdEAVTtu qqRDz2wKcS5PwhHJlTx3qS7E+OYFDQZXS0sS4shUkMezeSFXIymIpnDtwc8UtXu5K3hD7A kTjXd1G/bq+2fQh//eMJEUntF1670dZbs9aD5nXaR6WLWdIi0vvhaQHIhlK2zEmQ3dCcIW KJkFjJfBuAFIg46sddkwMLJqPEkQwUz/2brEbyKMETtmAGWXl37i1Klz8iLqNyfX7GFd21 7ar90TJdOdeDHgdtRdlOc9ZQiQ9pvu6pVlO3pG45Te2YgKWUNZFhdc2hbD0z6w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1772074718; a=rsa-sha256; cv=none; b=tHF0umibQMgEq6pwAcMD0BOLcg/XbeqlNHYLQorNHrg3YHvfEdHcyLqRq447M1MJ6IVvmG JttcY7hC/BtC185niTUujXnfVt83iH2XQ6GRxSUHLGKIrk6J4qN0nw/l18DUHq3K2r6Xx7 w+HjNPJes+Fe+VB6ZlXhHw81I4NFy22+rd3QX4O4Di6ZG0LUagDrmXnEff9a5u6mqen+rS b3rYcYyap7ng8zBfrOr/i9PnOSq970e2kff3dg8vHYGfzx8wABa6SSpaCpE4oe/Z5uTv8h KYs8fiAt0BJ4nTuy7vUJh7LuIQ7TNlSKsBCBzBPQ0OE7LJbDmxWv2/gulEIFHw== 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=1772074718; 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=4g09Ucc5d+vxt2QZU0ug7FdCQogMLVUf0o8k5i/hx7I=; b=TscEm42LMrkvNKNlmh5jO3+aFR9RaimJ9/J0MdKCZCT6fgeWfMASEOHa4D7RRELn7wJDHt SYJkOM0tlNvRlR0QQl3/gdpvRLGVv/fOHNSYFapF2N1CMAH0tw1yxDENG6d+XaFCcDyr7Y ziwSgxLG85TwePIhOLSGeH4ZjDhU3Pk/NebiZyDyS9loDsd2ClAbtA3UB+2nVgNfQRqu/z 4HbEkngoXuVKp/O+hMJLsjOK3N8KAfPmBdPQt9JoqlGA1nJqh2IIo3FMDf779KxrPPQii6 Gto45IseaSADgJJdidhecLAkGHjyjP4Kz1JLAuul7SDNldDbiJnvJw5/Rs74SQ== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fLx3x6gcxz1S1L for ; Thu, 26 Feb 2026 02:58:37 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 2501c by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Thu, 26 Feb 2026 02:58:37 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Mark Johnston Subject: git: 6ed373227680 - stable/14 - 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/14 X-Git-Reftype: branch X-Git-Commit: 6ed373227680b016b4cfa5af1b802ef23a121513 Auto-Submitted: auto-generated Date: Thu, 26 Feb 2026 02:58:37 +0000 Message-Id: <699fb6dd.2501c.3702e591@gitrepo.freebsd.org> The branch stable/14 has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=6ed373227680b016b4cfa5af1b802ef23a121513 commit 6ed373227680b016b4cfa5af1b802ef23a121513 Author: Mark Johnston AuthorDate: 2026-02-25 15:31:30 +0000 Commit: Mark Johnston CommitDate: 2026-02-26 02:54:34 +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 8b9e04775449..cb637c98673e 100644 --- a/sys/fs/nullfs/null_vfsops.c +++ b/sys/fs/nullfs/null_vfsops.c @@ -465,16 +465,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 { /* @@ -484,8 +480,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);