From nobody Fri Jul 3 00:27:15 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 4grvhh13Dzz6kDp9 for ; Fri, 03 Jul 2026 00:27:16 +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 "YR1" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4grvhg5R8Fz45xg for ; Fri, 03 Jul 2026 00:27:15 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1783038435; 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=oSe4lOqjIha/LKCPvkVT6s9cWsZEHjC8xhhd3KFVeaU=; b=pEOE82SVrxpL30FM6jcdmFoSwUf4DC0fcHGaa/4WigE5981+/VC/9VwbE/5Xm3tkTpoHUk xKBVzA7w7DLElePziouzQairxuUH9xEC9tIcQWjiduOjNa66fF4FsRK3mZ33MN9rn+qjsq 0gU2cCiHgqvJhKK6uPgjrni4U7Xu0dT4FqW87GN8uFb8w/0eEMQkT9Fi6PvZq/A+mUstBy jFEOQK6jTJ5fekPlh6VinbgPBYM5XrJAOKZiRtsnnbVA9XR5xNivI8yeHgUXNdKiZMwVf0 SMRYf2d4kqOOaP2dzk+QVvXaCbG8bPQDsU6rY86QqO9tkfJooKzunElN6Ssdlg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1783038435; a=rsa-sha256; cv=none; b=Lmij2kA7XOnjkbUq4e1J0kgY3WJEu6N+a7zK7y5I81O3G7tm6uXLHzYpDuE+h2LTqgZBrc v9lBSmixTWpkLbeAU9UNhr415UtHmjUiLZVA+Ic34z/ACVj3ukBW6fFQB23SuEevL/1r/T NpntDPf642KfKj2J/owhukGEem/4uyqoQe8Dc0kdPB/7k860HpSyzE0pPWvMdN5P+1PilJ fKFXqSv6ZxcHrrpKIPrnheXDcznXsWjSszPL0Ai028PWQDNsEOcsnw9zakZVh9jaFpETKp BbhNTvjTliLDQq/Tz3nsnriDcDHBj34jCikhul41ym0CREcD/tLpZbNmwWPd8w== 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=1783038435; 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=oSe4lOqjIha/LKCPvkVT6s9cWsZEHjC8xhhd3KFVeaU=; b=Eb101KAKBO1YoH0HT8+h/qe+BCIlMeMWlun9wdU5lDrocXJaknHHox877b87y69IxOFyJf n+IWe1Win+nhqiRtAWntNTnamsh8RMwc5JLi9FrCanS6RNRwDBlJRk5SWG+fEYgqhacWhd AhsYCebQWJTPFyxAKU6aSrrm9hE2pcDbRHhC2ZZ/iWavoxI+pCu8CkwiQQwC91ZIoPLndR vG2ZzjRpqBsO543SunKoauHDmezkqxj+mu56CC11A2UQGdqC3PdUisAia9VMbA8IcFTcJw FyDnBtZto4uW8J7XIt5ETE9+AgKVX2UDQ/LOCOe5RlKRevnAinWdE4BzsrAtsw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4grvhg3xwtz8j7 for ; Fri, 03 Jul 2026 00:27:15 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 26a00 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 03 Jul 2026 00:27:15 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 0cff90f802fd - stable/15 - VOP_VPUT_PAIR(): handle the case when dvp == vp 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/stable/15 X-Git-Reftype: branch X-Git-Commit: 0cff90f802fd96589fc8209b1dc263fc0fa4ed04 Auto-Submitted: auto-generated Date: Fri, 03 Jul 2026 00:27:15 +0000 Message-Id: <6a4701e3.26a00.6564c021@gitrepo.freebsd.org> The branch stable/15 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=0cff90f802fd96589fc8209b1dc263fc0fa4ed04 commit 0cff90f802fd96589fc8209b1dc263fc0fa4ed04 Author: Konstantin Belousov AuthorDate: 2026-06-24 18:21:49 +0000 Commit: Konstantin Belousov CommitDate: 2026-07-03 00:24:33 +0000 VOP_VPUT_PAIR(): handle the case when dvp == vp (cherry picked from commit be9295deedd1e837ee3645583d07e1dffbe1ead0) --- sys/kern/vfs_default.c | 28 +++++++++++++++++++++++----- sys/sys/vnode.h | 1 + sys/ufs/ffs/ffs_vnops.c | 18 +++++++++++------- 3 files changed, 35 insertions(+), 12 deletions(-) diff --git a/sys/kern/vfs_default.c b/sys/kern/vfs_default.c index 76f63b187b65..1a4ce712a4d3 100644 --- a/sys/kern/vfs_default.c +++ b/sys/kern/vfs_default.c @@ -81,7 +81,6 @@ static int vop_stdfdatasync(struct vop_fdatasync_args *ap); static int vop_stdgetpages_async(struct vop_getpages_async_args *ap); static int vop_stdread_pgcache(struct vop_read_pgcache_args *ap); static int vop_stdstat(struct vop_stat_args *ap); -static int vop_stdvput_pair(struct vop_vput_pair_args *ap); static int vop_stdgetlowvnode(struct vop_getlowvnode_args *ap); /* @@ -1623,16 +1622,35 @@ vop_stdread_pgcache(struct vop_read_pgcache_args *ap __unused) return (EJUSTRETURN); } -static int +/* + * vput(dvp). If unlock_vp is true, vput(vp). Both dvp and vp must + * be locked. This is VOP because some filesystems might need to do + * additional actions on dvp when unlocked, and need to be aware of + * any other locked vnodes. Also as the consequence, vp might become + * doomed even if unlock_vp is false. + * + * Special case: dvp == vp. If unlock_vp is true, vunref(vp); + * vput(vp), else vunref(vp). In other words, the VOP assumes that + * there are two references on the vnode on entry, and releases only + * one of them in case of !unlock_vp. + */ +int vop_stdvput_pair(struct vop_vput_pair_args *ap) { struct vnode *dvp, *vp, **vpp; dvp = ap->a_dvp; vpp = ap->a_vpp; - vput(dvp); - if (vpp != NULL && ap->a_unlock_vp && (vp = *vpp) != NULL) - vput(vp); + vp = vpp != NULL ? *vpp : NULL; + if (dvp != vp) { + vput(dvp); + if (vp != NULL && ap->a_unlock_vp) + vput(vp); + } else { + vunref(vp); + if (ap->a_unlock_vp) + vput(vp); + } return (0); } diff --git a/sys/sys/vnode.h b/sys/sys/vnode.h index 0e84127cbc32..4513a7a62140 100644 --- a/sys/sys/vnode.h +++ b/sys/sys/vnode.h @@ -916,6 +916,7 @@ int vop_stdpathconf(struct vop_pathconf_args *); int vop_stdpoll(struct vop_poll_args *); int vop_stdvptocnp(struct vop_vptocnp_args *ap); int vop_stdvptofh(struct vop_vptofh_args *ap); +int vop_stdvput_pair(struct vop_vput_pair_args *ap); int vop_stdunp_bind(struct vop_unp_bind_args *ap); int vop_stdunp_connect(struct vop_unp_connect_args *ap); int vop_stdunp_detach(struct vop_unp_detach_args *ap); diff --git a/sys/ufs/ffs/ffs_vnops.c b/sys/ufs/ffs/ffs_vnops.c index c7e2b3f4b8e6..ee495fe3888c 100644 --- a/sys/ufs/ffs/ffs_vnops.c +++ b/sys/ufs/ffs/ffs_vnops.c @@ -2006,16 +2006,14 @@ ffs_vput_pair(struct vop_vput_pair_args *ap) vpp = ap->a_vpp; vp = vpp != NULL ? *vpp : NULL; - if ((dp->i_flag & (IN_NEEDSYNC | IN_ENDOFF)) == 0) { - vput(dvp); - if (vp != NULL && ap->a_unlock_vp) - vput(vp); - return (0); - } + if ((dp->i_flag & (IN_NEEDSYNC | IN_ENDOFF)) == 0) + return (vop_stdvput_pair(ap)); mp = dvp->v_mount; if (vp != NULL) { - if (ap->a_unlock_vp) { + if (dvp == vp) { + vunref(vp); + } else if (ap->a_unlock_vp) { vput(vp); } else { MPASS(vp->v_type != VNON); @@ -2055,6 +2053,12 @@ ffs_vput_pair(struct vop_vput_pair_args *ap) } while (error == ERELOOKUP); } + if (vp == dvp) { + if (ap->a_unlock_vp) + vput(dvp); + return (0); + } + vput(dvp); if (vp == NULL || ap->a_unlock_vp)