diff options
-rw-r--r-- | sys/nfsclient/nfs.h | 1 | ||||
-rw-r--r-- | sys/nfsclient/nfs_nfsiod.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/sys/nfsclient/nfs.h b/sys/nfsclient/nfs.h index a87966d560de..c0a649f417ca 100644 --- a/sys/nfsclient/nfs.h +++ b/sys/nfsclient/nfs.h @@ -86,6 +86,7 @@ #define NFS_CMPFH(n, f, s) \ ((n)->n_fhsize == (s) && !bcmp((caddr_t)(n)->n_fhp, (caddr_t)(f), (s))) #define NFS_ISV3(v) (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV3) +#define NFS_ISV4(v) (VFSTONFS((v)->v_mount)->nm_flag & NFSMNT_NFSV4) #define NFSSTA_HASWRITEVERF 0x00040000 /* Has write verifier for V3 */ #define NFSSTA_GOTFSINFO 0x00100000 /* Got the V3 fsinfo */ diff --git a/sys/nfsclient/nfs_nfsiod.c b/sys/nfsclient/nfs_nfsiod.c index 4851824d9495..e219c711f3c6 100644 --- a/sys/nfsclient/nfs_nfsiod.c +++ b/sys/nfsclient/nfs_nfsiod.c @@ -248,6 +248,8 @@ nfssvc_iod(void *instance) if (error) break; while ((bp = TAILQ_FIRST(&nmp->nm_bufq)) != NULL) { + int giant_locked = 0; + /* Take one off the front of the list */ TAILQ_REMOVE(&nmp->nm_bufq, bp, b_freelist); nmp->nm_bufqlen--; @@ -256,6 +258,10 @@ nfssvc_iod(void *instance) wakeup(&nmp->nm_bufq); } mtx_unlock(&nfs_iod_mtx); + if (NFS_ISV4(bp->b_vp)) { + giant_locked = 1; + mtx_lock(&Giant); + } if (bp->b_flags & B_DIRECT) { KASSERT((bp->b_iocmd == BIO_WRITE), ("nfscvs_iod: BIO_WRITE not set")); (void)nfs_doio_directwrite(bp); @@ -265,6 +271,8 @@ nfssvc_iod(void *instance) else (void) nfs_doio(bp->b_vp, bp, bp->b_wcred, NULL); } + if (giant_locked) + mtx_unlock(&Giant); mtx_lock(&nfs_iod_mtx); /* * If there are more than one iod on this mount, then defect |