Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 19 Feb 2023 05:47:20 GMT
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org
Subject:   git: d152426ddf35 - stable/13 - tmpfs: remove bogus MPASS(VOP_ISLOCKED(vp)) asserts
Message-ID:  <202302190547.31J5lKM8097227@gitrepo.freebsd.org>

next in thread | raw e-mail | index | archive | help
The branch stable/13 has been updated by kib:

URL: https://cgit.FreeBSD.org/src/commit/?id=d152426ddf35cf7fd69e95c024f6a00c582ef809

commit d152426ddf35cf7fd69e95c024f6a00c582ef809
Author:     Konstantin Belousov <kib@FreeBSD.org>
AuthorDate: 2023-02-13 23:23:24 +0000
Commit:     Konstantin Belousov <kib@FreeBSD.org>
CommitDate: 2023-02-19 05:16:25 +0000

    tmpfs: remove bogus MPASS(VOP_ISLOCKED(vp)) asserts
    
    (cherry picked from commit 9ff2fbdf2ded59e276fdbf7ef7d18c726386b6fb)
---
 sys/fs/tmpfs/tmpfs_subr.c  |  3 ++-
 sys/fs/tmpfs/tmpfs_vnops.c | 23 ++++++++---------------
 2 files changed, 10 insertions(+), 16 deletions(-)

diff --git a/sys/fs/tmpfs/tmpfs_subr.c b/sys/fs/tmpfs/tmpfs_subr.c
index 1c0b4406e460..351530a56698 100644
--- a/sys/fs/tmpfs/tmpfs_subr.c
+++ b/sys/fs/tmpfs/tmpfs_subr.c
@@ -1108,7 +1108,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 0074e3203bbb..aa4089b7c50d 100644
--- a/sys/fs/tmpfs/tmpfs_vnops.c
+++ b/sys/fs/tmpfs/tmpfs_vnops.c
@@ -222,11 +222,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);
 }
@@ -549,7 +556,6 @@ tmpfs_setattr(struct vop_setattr_args *v)
 
 	int error;
 
-	MPASS(VOP_ISLOCKED(vp));
 	ASSERT_VOP_IN_SEQC(vp);
 
 	error = 0;
@@ -592,8 +598,6 @@ tmpfs_setattr(struct vop_setattr_args *v)
 	 */
 	tmpfs_update(vp);
 
-	MPASS(VOP_ISLOCKED(vp));
-
 	return (error);
 }
 
@@ -723,8 +727,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);
 
@@ -743,9 +745,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;
@@ -794,7 +793,6 @@ tmpfs_link(struct vop_link_args *v)
 	struct tmpfs_dirent *de;
 	struct tmpfs_node *node;
 
-	MPASS(VOP_ISLOCKED(dvp));
 	MPASS(cnp->cn_flags & HASBUF);
 	MPASS(dvp != vp); /* XXX When can this be false? */
 	node = VP_TO_TMPFS_NODE(vp);
@@ -986,8 +984,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)));
 	MPASS(fcnp->cn_flags & HASBUF);
 	MPASS(tcnp->cn_flags & HASBUF);
 
@@ -1302,9 +1298,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);



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?202302190547.31J5lKM8097227>