From nobody Mon Nov 03 05:31:44 2025 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 4d0Kvj0KsSz6GLw2; Mon, 03 Nov 2025 05:31:45 +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" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4d0Kvh6Bchz3S9T; Mon, 03 Nov 2025 05:31:44 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762147904; 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=OKpF0Pt7v4CpbWjdnH2RBDznf3FPswe8HCpgJM2fGxQ=; b=c97GaJNlEETRwYwLb7qZOi5d9cezI2fLqyIpgGQC847oJKnm0qeK/ARvEXTcvyL5W6ThIM v57zzWtA5AK8mA8EKs8UdU8GN1BKDO4c15EXYFPS8fj8DaZkSuiIR2PaoCLRlrrPiw6ee/ oBTDqG7YUMZSPiS5QK8lCNQdksqTEBen0TEVu/cvCMzLknVaKJVj4/OvLv3hv3Oqjqws/Z oHHJ8soK4z9J0Gau0vMjTHVl0c49hS4yoMMSEGWJnbGqenU76mIiHbK/D7hucXRkryhPks K/qpXPcMW8RvS8PRXK1vf9vMnvCYTy3/m86dcCfQWf6jBY/JPa4/fn7ozd2OVQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1762147904; 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=OKpF0Pt7v4CpbWjdnH2RBDznf3FPswe8HCpgJM2fGxQ=; b=eGR5RwnKIWRgokttLZE3T4lUrrlUgIwWFaOv/2NswCk9stIHInigZaSacag7qCkFrq10Lf GcId442ME3m4qxlbW3gN4xysI0r5m/PqdqNhuBAUCj+4k6/8NDYyLwerIUxaaWnPt+O96A nc00OPlC4IcL7GRSIbJo0dw2wbECG/45JA81dyVtJd7OpPvo3D2Vk2hrubxyOz7z4v98vh seYsinoe3OXHPT3VgWJFc2UK2ectfgWLfwsWAXuFu6/3SLe7Ge/v4RwrSiDPM/ECUQTVUL XLfKNhXV7PhvXFOcugw4+OH4gXZCDkKI0BLBLAiHqvzxbHDBgfIf1PYgZZ2Q9A== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1762147904; a=rsa-sha256; cv=none; b=PS9wAJNTAMcESxkCwKjvJ14H/1eN+T1dsVSvne+xiMBOGIMKRcfvcH0e5UbVA5VV8CM6hM vwqfPckhQO2iVuVvWZaUNaOzbeLf5p/2X0SCjXU/rI6MutOaXfTNiViJ+5XIOKDuEUy8cO sKz7POQxC/6FuXxNxpkhLJSLrpCSsikD60pJFMdTPFURpQpgoBaZSvYUCTMiAakD1bLSAU 2F0e57lVrZrGQhv6+8BQ9IoQGId1V8o9mgnn7m3hcy2PYsu9OSXzCrPslbo0ksmgcpeysR 8AwsGJ8lHM7XERz3eOAFnXmPOihpl6/XkJ5P+1A9F7zWlBASIxocEk47zFmlkw== ARC-Authentication-Results: i=1; mx1.freebsd.org; none Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4d0Kvh50w6zyBk; Mon, 03 Nov 2025 05:31:44 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 5A35VibJ071125; Mon, 3 Nov 2025 05:31:44 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 5A35Ving071123; Mon, 3 Nov 2025 05:31:44 GMT (envelope-from git) Date: Mon, 3 Nov 2025 05:31:44 GMT Message-Id: <202511030531.5A35Ving071123@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: "Jason A. Harmening" Subject: git: e0e72e797347 - stable/15 - unionfs: avoid vdrop()ing a locked but doomed vnode 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: jah X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: e0e72e797347f51888645a2e3c2e21c51f5a355c Auto-Submitted: auto-generated The branch stable/15 has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=e0e72e797347f51888645a2e3c2e21c51f5a355c commit e0e72e797347f51888645a2e3c2e21c51f5a355c Author: Jason A. Harmening AuthorDate: 2025-10-14 19:40:39 +0000 Commit: Jason A. Harmening CommitDate: 2025-11-03 04:33:32 +0000 unionfs: avoid vdrop()ing a locked but doomed vnode unionfs_lock() unconditionally calls vdrop() on the target vnode after locking it, but it's possible this vnode may be doomed. In that case, vdrop() may free the vnode, which in certain cases requires taking the vnode lock. Commit a7aac8c20497d added an assert to this effect, which unionfs_lock() now trips over. Fix this by lightly reworking the flow of unionfs_lock() so that the target vnode is vdrop()ed after being unlocked in the case where the unionfs lock operation needs to be restarted (which will happen if the unionfs vnode has been doomed, which is a prerequisite for the target vnode in the underlying filesystem to have been doomed). While here, get rid of a superfluous vhold/vdrop sequence in unionfs_unlock() that was probably inherited from nullfs and whose nullfs equivalent was recently removed. Reviewed by: kib, markj, olce Tested by: pho Differential Revision: https://reviews.freebsd.org/D53107 (cherry picked from commit a498c5e1a111ae8c48b8e7028daff861785c2bf2) --- sys/fs/unionfs/union_vnops.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/sys/fs/unionfs/union_vnops.c b/sys/fs/unionfs/union_vnops.c index 0a91d1d5ed02..410ab413b172 100644 --- a/sys/fs/unionfs/union_vnops.c +++ b/sys/fs/unionfs/union_vnops.c @@ -2208,7 +2208,6 @@ unionfs_lock_restart: vholdnz(tvp); VI_UNLOCK(vp); error = VOP_LOCK(tvp, flags); - vdrop(tvp); if (error == 0 && (lvp_locked || VTOUNIONFS(vp) == NULL)) { /* * After dropping the interlock above, there exists a window @@ -2234,6 +2233,7 @@ unionfs_lock_restart: unp = VTOUNIONFS(vp); if (unp == NULL || unp->un_uppervp != NULLVP) { VOP_UNLOCK(tvp); + vdrop(tvp); /* * If we previously held the lock, the upgrade may * have temporarily dropped the lock, in which case @@ -2249,6 +2249,7 @@ unionfs_lock_restart: goto unionfs_lock_restart; } } + vdrop(tvp); return (error); } @@ -2259,7 +2260,6 @@ unionfs_unlock(struct vop_unlock_args *ap) struct vnode *vp; struct vnode *tvp; struct unionfs_node *unp; - int error; KASSERT_UNIONFS_VNODE(ap->a_vp); @@ -2271,11 +2271,7 @@ unionfs_unlock(struct vop_unlock_args *ap) tvp = (unp->un_uppervp != NULL ? unp->un_uppervp : unp->un_lowervp); - vholdnz(tvp); - error = VOP_UNLOCK(tvp); - vdrop(tvp); - - return (error); + return (VOP_UNLOCK(tvp)); } static int