svn commit: r351438 - head/sys/sys

Mateusz Guzik mjg at FreeBSD.org
Fri Aug 23 21:05:37 UTC 2019


Author: mjg
Date: Fri Aug 23 21:05:37 2019
New Revision: 351438
URL: https://svnweb.freebsd.org/changeset/base/351438

Log:
  vfs: assert the lock held in MNT_REF/MNT_REL
  
  Sponsored by:	The FreeBSD Foundation

Modified:
  head/sys/sys/mount.h

Modified: head/sys/sys/mount.h
==============================================================================
--- head/sys/sys/mount.h	Fri Aug 23 19:53:11 2019	(r351437)
+++ head/sys/sys/mount.h	Fri Aug 23 21:05:37 2019	(r351438)
@@ -265,8 +265,12 @@ void          __mnt_vnode_markerfree_active(struct vno
 #define	MNT_ITRYLOCK(mp) mtx_trylock(&(mp)->mnt_mtx)
 #define	MNT_IUNLOCK(mp)	mtx_unlock(&(mp)->mnt_mtx)
 #define	MNT_MTX(mp)	(&(mp)->mnt_mtx)
-#define	MNT_REF(mp)	(mp)->mnt_ref++
+#define	MNT_REF(mp)	do {						\
+	mtx_assert(MNT_MTX(mp), MA_OWNED);				\
+	(mp)->mnt_ref++;						\
+} while (0)
 #define	MNT_REL(mp)	do {						\
+	mtx_assert(MNT_MTX(mp), MA_OWNED);				\
 	KASSERT((mp)->mnt_ref > 0, ("negative mnt_ref"));		\
 	(mp)->mnt_ref--;						\
 	if ((mp)->mnt_ref == 0)						\


More information about the svn-src-head mailing list