Fix for a potential NFS client race where shared data is updated from

base context as well as the socket callback.

Submitted by:	Mohan Srinivasan
This commit is contained in:
Paul Saab 2005-02-18 23:41:39 +00:00
parent 6ee20ab521
commit 7a5147540a

View File

@ -1027,10 +1027,12 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum,
error = nfs_send(nmp->nm_so, nmp->nm_nam, m2, rep);
nfs_sndunlock(rep);
}
mtx_lock(&nfs_reqq_mtx);
if (!error && (rep->r_flags & R_MUSTRESEND) == 0) {
nmp->nm_sent += NFS_CWNDSCALE;
rep->r_flags |= R_SENT;
}
mtx_unlock(&nfs_reqq_mtx);
} else {
splx(s);
rep->r_rtt = -1;
@ -1056,10 +1058,12 @@ nfs_request(struct vnode *vp, struct mbuf *mrest, int procnum,
/*
* Decrement the outstanding request count.
*/
mtx_lock(&nfs_reqq_mtx);
if (rep->r_flags & R_SENT) {
rep->r_flags &= ~R_SENT; /* paranoia */
nmp->nm_sent -= NFS_CWNDSCALE;
}
mtx_unlock(&nfs_reqq_mtx);
/*
* If there was a successful reply and a tprintf msg.