Author: rmacklem
Date: Wed Oct 30 01:57:40 2019
New Revision: 354164
URL: https://svnweb.freebsd.org/changeset/base/354164

Log:
  MFC: r352736
  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.

Modified:
  stable/12/sys/fs/nfs/nfsport.h
  stable/12/sys/fs/nfsclient/nfs_clnfsiod.c
  stable/12/sys/fs/nfsclient/nfs_clnode.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/nfs/nfsport.h
==============================================================================
--- stable/12/sys/fs/nfs/nfsport.h      Wed Oct 30 01:41:49 2019        
(r354163)
+++ stable/12/sys/fs/nfs/nfsport.h      Wed Oct 30 01:57:40 2019        
(r354164)
@@ -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        NFSPROCLISTLOCK()       sx_slock(&allproc_lock)

Modified: stable/12/sys/fs/nfsclient/nfs_clnfsiod.c
==============================================================================
--- stable/12/sys/fs/nfsclient/nfs_clnfsiod.c   Wed Oct 30 01:41:49 2019        
(r354163)
+++ stable/12/sys/fs/nfsclient/nfs_clnfsiod.c   Wed Oct 30 01:57:40 2019        
(r354164)
@@ -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: stable/12/sys/fs/nfsclient/nfs_clnode.c
==============================================================================
--- stable/12/sys/fs/nfsclient/nfs_clnode.c     Wed Oct 30 01:41:49 2019        
(r354163)
+++ stable/12/sys/fs/nfsclient/nfs_clnode.c     Wed Oct 30 01:57:40 2019        
(r354164)
@@ -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;
_______________________________________________
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"

Reply via email to