From nobody Thu Feb 26 02:58:37 2026 X-Original-To: dev-commits-src-all@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 4fLx433XzRz6T3y9 for ; Thu, 26 Feb 2026 02:58:43 +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 4fLx431cqnz42cc for ; Thu, 26 Feb 2026 02:58:43 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1772074723; 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=E+7SwIzjubc9/mDi17GZBARkTEgede9rIxRZjj26lMIkvUlHoHYI0pugKN2WGz6RjKQ2m7 OVdVrIbRkgoMxkQHfbTothbN5WikOtwRtuNuYpkCIADPkXO9XTSROQ0uaKN+gceJtx6ZRt SeEsgRQv+b/6OUthn7uhAxmctOH5zqW7EnVjhMUFV3Kd41uJncSFr9FxbI0x1l0qz962NJ AcY/xws5v7/CqQWr3P2JKbYyyKXTcdUkXmh66wI0PkwBvaLZ67R8OfuImcIO0VV4sfQ+c9 4UXDM8E570ZBu0w5eJmPmBUTUt/wr4Hw3KxTvmJafY+t4rSpsa0TJZB5NzNBYg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1772074723; a=rsa-sha256; cv=none; b=VY4sl8mLHOu2UtOL4xqz9jw3Q0uOqeNAYd0EUNB12Z7E8phFhS+zBmD5nMkstjBZMJSTVX S49Ux4ORFViI9P4Avvyxx8CaCSD2pas0FOO1ZSfNd0ad6CdGsE1J5QgJFzjIfOVpzR3Lxs jA/uFShvli904TyJBX9SHVXCloGF72w8NONX70+JjG7i0N4gR1Sn8MXm/fAA9RMSNh16GP LwENXUWn1O4u0hJiaaWD0ZaHq0lGPj+EiKuwlGNXq7BsPT5/bhgAXqWIINS9YWVp6tMXOP 9waYw/dgBHulkrIDrS2r9R9Fm7HOa7oWKxZxrPdEPv34a0Lz3CsqfPzt4/C5rA== 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=1772074723; 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=TWgcChoMUzSJttAOWIq9hIZ8ezsbMCp6X1yZlihGrNC0oG1htEKjhgpYlMdtyJ1E33N+rB sZ2LynocZ1RgrMJJttc9xGjY2MebiFu6H8X9/rdpXzxEUhl+cRpLP/x+GT2nerVwYzL6Pa 4S0PYvGSt3Mse2k6jTiLvhqfbEua04t3PbpMHAS/Hutxxw4l/fWKxDxYoVQT3xUp1x4rjL 8FE/FGSxFsY4TxQoZxlDwIFV75yg5sPrzWg+q1oP4l69n1hpuONbNs/5/6g4L8Z9SFvuBd bQ+hcYEBIOUxX00cLmLJafzPdAenURr7r/ySmSWJen6lcga9nGnAGM1owNgYEA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4fLx430HH9z1S1M for ; Thu, 26 Feb 2026 02:58:43 +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: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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);