From nobody Wed Feb 15 00:57:59 2023 X-Original-To: dev-commits-src-main@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 4PGfng6NFXz3qVXP; Wed, 15 Feb 2023 00:57:59 +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 4PGfng5nxhz4WyY; Wed, 15 Feb 2023 00:57:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676422679; 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=5pxo9aEHMJqLGR7LSADAty45A8abkt+6hRqYBQdbuM0=; b=Rq8TXA5pcvmqSzKPaTrJhmm9kzBHHKNK2MsQyiv8DlbRAmoIn5AlmqIIBc7yvlIksx7l76 9O7XCUsG+osqGwhTtX+iSdwEpwqiKoxWIaXNQ7XpA576HMyZSoqrF/o5b9SbFbXaY5zb3t KVh3JonCTW77jvBARDW3OrfaP+zqH40SaLpJKfIrBJDF+NOjMtDLAjzQ4AC6Fy3Nggr51g 1NrkcsBjqgzTp0mZZqs6beOamyn7n3+5ew9MkeZV9QWjX+HnkTGIEdNBvFzPAf7RGuQj7T 3BVazogp9Ud7qCIuJwqWfQRMpLex+C8Tw4bNjBPX2Ayh5hlI11ppTY0XQL4B9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1676422679; 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=5pxo9aEHMJqLGR7LSADAty45A8abkt+6hRqYBQdbuM0=; b=LvszN7eEmFte9FNs2hPfXL6NBZceVgUg6a7mhcYloFWsnz5nBplrQZRrg/8059mG23I9Hm FSkbSxlCtraKk46zd3ifPD2N16rd+BtsXWXxn6/7ro3k8kvD81UPXGLXLtyz10yvndq9Gi I8w4ddgZ7BXoQodwaIR7Jcd6igjauloYKUPgxGLRVcAiOGbod7FlStsLm0rlAzp8lZ1wTB KYXUe2BekTSZZ2S47NiLBaYaRkZzPtgqPVwkTU9LutJvEHHKwG30ToRWd/hSjMLCktYCQA dvfASv7Ho7tvoM8399wqbmHx/mOMoDKdU9hwAOPjn3uJJZd9VtzfToKm1uO5rg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1676422679; a=rsa-sha256; cv=none; b=u2E+LK+OuBgLfZUN1U1AlniaF/de0+nCgy3s5+6oUoGyvwHhWp21POBwkNo/FTM1oc6M89 y1QaSEWTszsoE/fMR+N/QJnnXhMfsVd7HMRsUVLGPx5W35UGuuTtnvP+53EeNwji5SIX4v tgJMJ39EgE+FCbCrqtwk30SOce149zfbiPF+OTeR1GDUyxDBh3TMEV4cD9BNi/xYVYyVe4 wsP/LiHjpaprLlWhwQcAcE8s2Q45CxBofLMXfaHQlcy6qa/eSyGcUlhtFyW3nWiLbuFzu3 h4RJo2OkMlRa8Ra5sg0rvxlG81/U2N/wYTZIMxB9zB/wFBSvyLuHY9+zVCUGkQ== 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 4PGfng4rNzz1K6Y; Wed, 15 Feb 2023 00:57:59 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 31F0vxn3047920; Wed, 15 Feb 2023 00:57:59 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 31F0vxJw047919; Wed, 15 Feb 2023 00:57:59 GMT (envelope-from git) Date: Wed, 15 Feb 2023 00:57:59 GMT Message-Id: <202302150057.31F0vxJw047919@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: 9ff2fbdf2ded - main - tmpfs: remove bogus MPASS(VOP_ISLOCKED(vp)) asserts List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org 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/main X-Git-Reftype: branch X-Git-Commit: 9ff2fbdf2ded59e276fdbf7ef7d18c726386b6fb Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=9ff2fbdf2ded59e276fdbf7ef7d18c726386b6fb commit 9ff2fbdf2ded59e276fdbf7ef7d18c726386b6fb Author: Konstantin Belousov AuthorDate: 2023-02-13 23:23:24 +0000 Commit: Konstantin Belousov CommitDate: 2023-02-15 00:57:40 +0000 tmpfs: remove bogus MPASS(VOP_ISLOCKED(vp)) asserts VOP_ISLOCKED() does not return bool, its only reliable use it to check that the vnode is exclusively locked by the calling thread. Almost all asserts of this form repeated auto-generated assertions from vnode_if.src for VOPs, in the incorrect way. In two places where the assertions would be meaningful, convert them to ASSERT_VOP_LOCKED() statements. Reviewed by: markj, mjg Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D38576 --- sys/fs/tmpfs/tmpfs_subr.c | 3 ++- sys/fs/tmpfs/tmpfs_vnops.c | 24 ++++++++---------------- 2 files changed, 10 insertions(+), 17 deletions(-) diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c index ccb9977c39eb..cfd4787fb712 100644 --- a/sys/fs/tmpfs/tmpfs_subr.c +++ b/sys/fs/tmpfs/tmpfs_subr.c @@ -1110,7 +1110,8 @@ out: *vpp = vp; #ifdef INVARIANTS - MPASS(*vpp != NULL && VOP_ISLOCKED(*vpp)); + MPASS(*vpp != NULL); + ASSERT_VOP_LOCKED(*vpp, __func__); TMPFS_NODE_LOCK(node); MPASS(*vpp == node->tn_vnode); TMPFS_NODE_UNLOCK(node); diff --git a/sys/fs/tmpfs/tmpfs_vnops.c b/sys/fs/tmpfs/tmpfs_vnops.c index b1d6bce6754f..ea09170661e7 100644 --- a/sys/fs/tmpfs/tmpfs_vnops.c +++ b/sys/fs/tmpfs/tmpfs_vnops.c @@ -218,11 +218,18 @@ tmpfs_lookup1(struct vnode *dvp, struct vnode **vpp, struct componentname *cnp) cache_enter(dvp, *vpp, cnp); out: +#ifdef INVARIANTS /* * If there were no errors, *vpp cannot be null and it must be * locked. */ - MPASS(IFF(error == 0, *vpp != NULLVP && VOP_ISLOCKED(*vpp))); + if (error == 0) { + MPASS(*vpp != NULLVP); + ASSERT_VOP_LOCKED(*vpp, __func__); + } else { + MPASS(*vpp == NULL); + } +#endif return (error); } @@ -545,7 +552,6 @@ tmpfs_setattr(struct vop_setattr_args *v) int error; - MPASS(VOP_ISLOCKED(vp)); ASSERT_VOP_IN_SEQC(vp); error = 0; @@ -588,8 +594,6 @@ tmpfs_setattr(struct vop_setattr_args *v) */ tmpfs_update(vp); - MPASS(VOP_ISLOCKED(vp)); - return (error); } @@ -725,8 +729,6 @@ tmpfs_fsync(struct vop_fsync_args *v) { struct vnode *vp = v->a_vp; - MPASS(VOP_ISLOCKED(vp)); - tmpfs_check_mtime(vp); tmpfs_update(vp); @@ -745,9 +747,6 @@ tmpfs_remove(struct vop_remove_args *v) struct tmpfs_node *dnode; struct tmpfs_node *node; - MPASS(VOP_ISLOCKED(dvp)); - MPASS(VOP_ISLOCKED(vp)); - if (vp->v_type == VDIR) { error = EISDIR; goto out; @@ -796,7 +795,6 @@ tmpfs_link(struct vop_link_args *v) struct tmpfs_dirent *de; struct tmpfs_node *node; - MPASS(VOP_ISLOCKED(dvp)); MPASS(dvp != vp); /* XXX When can this be false? */ node = VP_TO_TMPFS_NODE(vp); @@ -987,9 +985,6 @@ tmpfs_rename(struct vop_rename_args *v) int error; bool want_seqc_end; - MPASS(VOP_ISLOCKED(tdvp)); - MPASS(IMPLIES(tvp != NULL, VOP_ISLOCKED(tvp))); - want_seqc_end = false; /* @@ -1323,9 +1318,6 @@ tmpfs_rmdir(struct vop_rmdir_args *v) struct tmpfs_node *dnode; struct tmpfs_node *node; - MPASS(VOP_ISLOCKED(dvp)); - MPASS(VOP_ISLOCKED(vp)); - tmp = VFS_TO_TMPFS(dvp->v_mount); dnode = VP_TO_TMPFS_DIR(dvp); node = VP_TO_TMPFS_DIR(vp);