Skip site navigation (1)Skip section navigation (2)
Date:      Fri, 23 Aug 2019 21:05:37 +0000 (UTC)
From:      Mateusz Guzik <mjg@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r351438 - head/sys/sys
Message-ID:  <201908232105.x7NL5bFT069278@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
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)						\



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