svn commit: r311524 - head/sys/fs/tmpfs

Konstantin Belousov kib at FreeBSD.org
Fri Jan 6 17:32:46 UTC 2017


Author: kib
Date: Fri Jan  6 17:32:44 2017
New Revision: 311524
URL: https://svnweb.freebsd.org/changeset/base/311524

Log:
  Use vnode lock assertion expression, and upgrade it to assert the
  required exclusive state of the vnode lock in tmpfs chflags, chmod,
  chown, chsize, chtimes operations.
  
  Fix nearby style.
  
  Reviewed by:	mjg
  Tested by:	pho
  Sponsored by:	The FreeBSD Foundation
  MFC after:	1 week

Modified:
  head/sys/fs/tmpfs/tmpfs_subr.c

Modified: head/sys/fs/tmpfs/tmpfs_subr.c
==============================================================================
--- head/sys/fs/tmpfs/tmpfs_subr.c	Fri Jan  6 17:03:08 2017	(r311523)
+++ head/sys/fs/tmpfs/tmpfs_subr.c	Fri Jan  6 17:32:44 2017	(r311524)
@@ -1462,7 +1462,7 @@ tmpfs_chflags(struct vnode *vp, u_long f
 	int error;
 	struct tmpfs_node *node;
 
-	MPASS(VOP_ISLOCKED(vp));
+	ASSERT_VOP_ELOCKED(vp, "chflags");
 
 	node = VP_TO_TMPFS_NODE(vp);
 
@@ -1502,9 +1502,9 @@ tmpfs_chflags(struct vnode *vp, u_long f
 	node->tn_flags = flags;
 	node->tn_status |= TMPFS_NODE_CHANGED;
 
-	MPASS(VOP_ISLOCKED(vp));
+	ASSERT_VOP_ELOCKED(vp, "chflags2");
 
-	return 0;
+	return (0);
 }
 
 /*
@@ -1518,7 +1518,7 @@ tmpfs_chmod(struct vnode *vp, mode_t mod
 	int error;
 	struct tmpfs_node *node;
 
-	MPASS(VOP_ISLOCKED(vp));
+	ASSERT_VOP_ELOCKED(vp, "chmod");
 
 	node = VP_TO_TMPFS_NODE(vp);
 
@@ -1558,9 +1558,9 @@ tmpfs_chmod(struct vnode *vp, mode_t mod
 
 	node->tn_status |= TMPFS_NODE_CHANGED;
 
-	MPASS(VOP_ISLOCKED(vp));
+	ASSERT_VOP_ELOCKED(vp, "chmod2");
 
-	return 0;
+	return (0);
 }
 
 /*
@@ -1579,7 +1579,7 @@ tmpfs_chown(struct vnode *vp, uid_t uid,
 	uid_t ouid;
 	gid_t ogid;
 
-	MPASS(VOP_ISLOCKED(vp));
+	ASSERT_VOP_ELOCKED(vp, "chown");
 
 	node = VP_TO_TMPFS_NODE(vp);
 
@@ -1629,9 +1629,9 @@ tmpfs_chown(struct vnode *vp, uid_t uid,
 			node->tn_mode &= ~(S_ISUID | S_ISGID);
 	}
 
-	MPASS(VOP_ISLOCKED(vp));
+	ASSERT_VOP_ELOCKED(vp, "chown2");
 
-	return 0;
+	return (0);
 }
 
 /*
@@ -1646,7 +1646,7 @@ tmpfs_chsize(struct vnode *vp, u_quad_t 
 	int error;
 	struct tmpfs_node *node;
 
-	MPASS(VOP_ISLOCKED(vp));
+	ASSERT_VOP_ELOCKED(vp, "chsize");
 
 	node = VP_TO_TMPFS_NODE(vp);
 
@@ -1684,9 +1684,9 @@ tmpfs_chsize(struct vnode *vp, u_quad_t 
 	/* tmpfs_truncate will raise the NOTE_EXTEND and NOTE_ATTRIB kevents
 	 * for us, as will update tn_status; no need to do that here. */
 
-	MPASS(VOP_ISLOCKED(vp));
+	ASSERT_VOP_ELOCKED(vp, "chsize2");
 
-	return error;
+	return (error);
 }
 
 /*
@@ -1701,7 +1701,7 @@ tmpfs_chtimes(struct vnode *vp, struct v
 	int error;
 	struct tmpfs_node *node;
 
-	MPASS(VOP_ISLOCKED(vp));
+	ASSERT_VOP_ELOCKED(vp, "chtimes");
 
 	node = VP_TO_TMPFS_NODE(vp);
 
@@ -1730,9 +1730,9 @@ tmpfs_chtimes(struct vnode *vp, struct v
 
 	if (vap->va_birthtime.tv_sec != VNOVAL)
 		node->tn_birthtime = vap->va_birthtime;
-	MPASS(VOP_ISLOCKED(vp));
+	ASSERT_VOP_ELOCKED(vp, "chtimes2");
 
-	return 0;
+	return (0);
 }
 
 /* Sync timestamps */


More information about the svn-src-head mailing list