From nobody Sun Mar 24 03:04:40 2024 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 4V2LWr5rh5z5DmkX; Sun, 24 Mar 2024 03:04:40 +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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4V2LWr5DQPz4t1R; Sun, 24 Mar 2024 03:04:40 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1711249480; 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=pR6LThwsMzx4Q0Q8u1HR80upGVPMEx5sPD91sqFg2tY=; b=k3BBT7YwKhHxIh17Y+njIqEAx+3KSUmqMUcnBQVpiOXmrzTvwVxkm0M9KAWgAqS/HzYAQy E8bADInSuu05fdLHUBQxHaeLD2QZVYEcxaPXkKy3SQG3LZQNw7s9EuETG45bDEJFTPfdmq vZSnoLQ8VyaBQXEBo1H9O8Vt1EFl1OawH1tyrV6s6PEdTtnc9ojZ302/ViREIAjtD/hvjn gRXRDEThFGjwe9k60uNecbqG8CoHtoDYmqbfTsk0euR16ZvoCRkPUAjiG+nFWOTwo8fBP2 iR9N2BhyndiqQd+XIMnBaYJ9MUqFHexcYimhGB8zcIrLZCj2ha6gOzsCcS4CBA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1711249480; a=rsa-sha256; cv=none; b=GWBDc6o+40xMrm976du1Xa2cB+btDeBX0MU4Fq7tOPlLwtnUWUi7x9FP72+i0DwchX+NSo mqGxCYYdnKMmTRvhZ7jpTgjzkEcd0ZkiQ8MKslSuQ+hf1KO4OLXw0O9oL0oMNTydc5V9uG X+TZOxxtuwribWDM6pw3gHpUbKdciJq4F0U3deQzbhltMndW9lOhHCel3j8/VHddlFYsls qZ9n5pta6yWP0jLQn/0buBOXVw65/4zcG7gpNXsDaiDc4QCbBoKo4yv5W5tlbAhHKfEv2M 9YPyJ8VFWW9xX1O4zQRn+lfDRH4s9PE8g0sjqsPNCfnqeQW4kUgN+HtTlgf7Iw== 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=1711249480; 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=pR6LThwsMzx4Q0Q8u1HR80upGVPMEx5sPD91sqFg2tY=; b=hqE8l/14F0cwMtJ2+5IVrXVNoffeA/Uld5VXB36gswe1gFrVEoZG242iwwtqJNKTUz96qV IoPuswh6xV6riSREu5V+PvicpO9qhA1kfVFp0k6dY/fdWQ0TEE4DMV7mKJOq8/WycZpjNU HWe+YTgjVysHPfCrdJAFSv2oj8J1LuCVx3ppNgSWintVDfYP3X8SnWoEDpD8BYHweH7BVx 1/d90puW82wgta+zaeIk99XNGOZ1XCHJKDoB0pZr8ecuNk48Og+B9iqqfxFVypcxg8rePi v6a2U/9wVaEqK3r0Efy5CVvF+jkMBgvrJ/hBXHRO4bUCt4zEn7zPEHvJXY9Bng== 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 4V2LWr4qTlzFq1; Sun, 24 Mar 2024 03:04:40 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 42O34e45038492; Sun, 24 Mar 2024 03:04:40 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 42O34eAK038489; Sun, 24 Mar 2024 03:04:40 GMT (envelope-from git) Date: Sun, 24 Mar 2024 03:04:40 GMT Message-Id: <202403240304.42O34eAK038489@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: b09b120818a8 - stable/14 - vn_lock_pair(): allow lkflags1/lkflags2 to be 0 if vp1/vp2 is NULL 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: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@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/14 X-Git-Reftype: branch X-Git-Commit: b09b120818a81b83a3e3201b4c301335d0c48fac Auto-Submitted: auto-generated The branch stable/14 has been updated by jah: URL: https://cgit.FreeBSD.org/src/commit/?id=b09b120818a81b83a3e3201b4c301335d0c48fac commit b09b120818a81b83a3e3201b4c301335d0c48fac Author: Jason A. Harmening AuthorDate: 2024-02-23 17:31:08 +0000 Commit: Jason A. Harmening CommitDate: 2024-03-24 02:55:37 +0000 vn_lock_pair(): allow lkflags1/lkflags2 to be 0 if vp1/vp2 is NULL It's a bit strange to require the caller to pass contrived lock flags if the corresponding vnode is NULL, simply to appease the assertion that exactly one of LK_SHARED or LK_EXCLUSIVE must be set. On the other hand, we still want to catch cases in which completely bogus or corrupt flags are passed even if the corresponding vnode is NULL. Therefore, specifically allow empty flags for lkflags1/lkflags2 iff the respective vp1/vp2 param is NULL. Reviewed by: kib, olce Differential Revision: https://reviews.freebsd.org/D44046 (cherry picked from commit fa26f46dc29f5ee1ac8e7b10fc12aa1f93cce702) --- sys/kern/vfs_vnops.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/sys/kern/vfs_vnops.c b/sys/kern/vfs_vnops.c index 62339387d7d0..a16e137755b1 100644 --- a/sys/kern/vfs_vnops.c +++ b/sys/kern/vfs_vnops.c @@ -4103,9 +4103,11 @@ vn_lock_pair(struct vnode *vp1, bool vp1_locked, int lkflags1, { int error, locked1; - MPASS(((lkflags1 & LK_SHARED) != 0) ^ ((lkflags1 & LK_EXCLUSIVE) != 0)); + MPASS((((lkflags1 & LK_SHARED) != 0) ^ ((lkflags1 & LK_EXCLUSIVE) != 0)) || + (vp1 == NULL && lkflags1 == 0)); MPASS((lkflags1 & ~(LK_SHARED | LK_EXCLUSIVE | LK_NODDLKTREAT)) == 0); - MPASS(((lkflags2 & LK_SHARED) != 0) ^ ((lkflags2 & LK_EXCLUSIVE) != 0)); + MPASS((((lkflags2 & LK_SHARED) != 0) ^ ((lkflags2 & LK_EXCLUSIVE) != 0)) || + (vp2 == NULL && lkflags2 == 0)); MPASS((lkflags2 & ~(LK_SHARED | LK_EXCLUSIVE | LK_NODDLKTREAT)) == 0); if (vp1 == NULL && vp2 == NULL)