Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 26 Sep 2019 02:54:45 +0000 (UTC)
From:      Rick Macklem <rmacklem@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org
Subject:   svn commit: r352736 - in head/sys/fs: nfs nfsclient
Message-ID:  <201909260254.x8Q2sjbi005158@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: rmacklem
Date: Thu Sep 26 02:54:45 2019
New Revision: 352736
URL: https://svnweb.freebsd.org/changeset/base/352736

Log:
  Replace all mtx_assert() calls for n_mtx and ncl_iod_mutex with macros.
  
  To be consistent with replacing the mtx_lock()/mtx_unlock() calls on
  the NFS node mutex (n_mtx) and ncl_iod_mutex, this patch replaces
  all mtx_assert() calls on these mutexes with macros as well.
  This will simplify changing these locks to sx locks in a future commit.
  However, this change may be delayed indefinitely, since it appears there
  is a deadlock when vnode_pager_setsize() is called to shrink the size
  and the NFS node lock is held.
  There is no semantic change as a result of this commit.
  
  Suggested by:	kib
  MFC after:	1 week

Modified:
  head/sys/fs/nfs/nfsport.h
  head/sys/fs/nfsclient/nfs_clnfsiod.c
  head/sys/fs/nfsclient/nfs_clnode.c

Modified: head/sys/fs/nfs/nfsport.h
==============================================================================
--- head/sys/fs/nfs/nfsport.h	Thu Sep 26 01:54:24 2019	(r352735)
+++ head/sys/fs/nfs/nfsport.h	Thu Sep 26 02:54:45 2019	(r352736)
@@ -688,10 +688,12 @@ void nfsrvd_rcv(struct socket *, void *, int);
 #define	NFSUNLOCKV4ROOTMUTEX()	mtx_unlock(&nfs_v4root_mutex)
 #define	NFSLOCKNODE(n)		mtx_lock(&((n)->n_mtx))
 #define	NFSUNLOCKNODE(n)	mtx_unlock(&((n)->n_mtx))
+#define	NFSASSERTNODE(n)	mtx_assert(&((n)->n_mtx), MA_OWNED)
 #define	NFSLOCKMNT(m)		mtx_lock(&((m)->nm_mtx))
 #define	NFSUNLOCKMNT(m)		mtx_unlock(&((m)->nm_mtx))
 #define	NFSLOCKIOD()		mtx_lock(&ncl_iod_mutex)
 #define	NFSUNLOCKIOD()		mtx_unlock(&ncl_iod_mutex)
+#define	NFSASSERTIOD()		mtx_assert(&ncl_iod_mutex, MA_OWNED)
 #define	NFSLOCKREQUEST(r)	mtx_lock(&((r)->r_mtx))
 #define	NFSUNLOCKREQUEST(r)	mtx_unlock(&((r)->r_mtx))
 #define	NFSLOCKSOCKREQ(r)	mtx_lock(&((r)->nr_mtx))

Modified: head/sys/fs/nfsclient/nfs_clnfsiod.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clnfsiod.c	Thu Sep 26 01:54:24 2019	(r352735)
+++ head/sys/fs/nfsclient/nfs_clnfsiod.c	Thu Sep 26 02:54:45 2019	(r352736)
@@ -169,7 +169,7 @@ nfs_nfsiodnew_sync(void)
 {
 	int error, i;
 
-	mtx_assert(&ncl_iod_mutex, MA_OWNED);
+	NFSASSERTIOD();
 	for (i = 0; i < ncl_iodmax; i++) {
 		if (nfs_asyncdaemon[i] == 0) {
 			nfs_asyncdaemon[i] = 1;
@@ -206,7 +206,7 @@ void
 ncl_nfsiodnew(void)
 {
 
-	mtx_assert(&ncl_iod_mutex, MA_OWNED);
+	NFSASSERTIOD();
 	taskqueue_enqueue(taskqueue_thread, &ncl_nfsiodnew_task);
 }
 

Modified: head/sys/fs/nfsclient/nfs_clnode.c
==============================================================================
--- head/sys/fs/nfsclient/nfs_clnode.c	Thu Sep 26 01:54:24 2019	(r352735)
+++ head/sys/fs/nfsclient/nfs_clnode.c	Thu Sep 26 02:54:45 2019	(r352736)
@@ -212,7 +212,7 @@ ncl_releasesillyrename(struct vnode *vp, struct thread
 
 	ASSERT_VOP_ELOCKED(vp, "releasesillyrename");
 	np = VTONFS(vp);
-	mtx_assert(&np->n_mtx, MA_OWNED);
+	NFSASSERTNODE(np);
 	if (vp->v_type != VDIR) {
 		sp = np->n_sillyrename;
 		np->n_sillyrename = NULL;



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