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
This commit is contained in:
Rick Macklem 2019-09-26 02:54:45 +00:00
parent 407c48f060
commit ee7201a725
3 changed files with 5 additions and 3 deletions

View File

@ -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))

View File

@ -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);
}

View File

@ -212,7 +212,7 @@ ncl_releasesillyrename(struct vnode *vp, struct thread *td)
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;