Since NFSv4 is not SMP safe, nfsiod needs to acquire Giant for NFSv4 mounts
before doing the read/write. Reported by: Chuck Lever.
This commit is contained in:
parent
75b773ae3d
commit
5bbfbd1422
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=158905
@ -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 */
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user