diff options
author | ps <ps@FreeBSD.org> | 2005-02-18 23:41:39 +0000 |
---|---|---|
committer | ps <ps@FreeBSD.org> | 2005-02-18 23:41:39 +0000 |
commit | f6b334da2c4bd3e9930220d802f7047868064bdc (patch) | |
tree | 470faa5e53aa3191bba0f0c6761c0086453af3c9 | |
parent | 79c91b9063b488741efc68e2badefc608f4fb4d4 (diff) | |
download | FreeBSD-src-f6b334da2c4bd3e9930220d802f7047868064bdc.zip FreeBSD-src-f6b334da2c4bd3e9930220d802f7047868064bdc.tar.gz |
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
-rw-r--r-- | sys/nfsclient/nfs_socket.c | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/sys/nfsclient/nfs_socket.c b/sys/nfsclient/nfs_socket.c index e18973f..57d58bb 100644 --- a/sys/nfsclient/nfs_socket.c +++ b/sys/nfsclient/nfs_socket.c @@ -1027,10 +1027,12 @@ tryagain: 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 @@ tryagain: /* * 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. |