summaryrefslogtreecommitdiffstats
path: root/sys/nfsclient
diff options
context:
space:
mode:
authorrwatson <rwatson@FreeBSD.org>2004-07-06 16:55:41 +0000
committerrwatson <rwatson@FreeBSD.org>2004-07-06 16:55:41 +0000
commit7e85c099fce5fdf71a435eaa2e2d4981adc06d24 (patch)
treee7f8335dd5bbd0d5180e081cd497abd82a7406d0 /sys/nfsclient
parent67f23990b6f1f28b43ade386d13dcfe738ccd3a1 (diff)
downloadFreeBSD-src-7e85c099fce5fdf71a435eaa2e2d4981adc06d24.zip
FreeBSD-src-7e85c099fce5fdf71a435eaa2e2d4981adc06d24.tar.gz
Acquire socket lock in nfs_connect() connection/sleep loop to protect
socket state and avoid missed wakeups.
Diffstat (limited to 'sys/nfsclient')
-rw-r--r--sys/nfsclient/nfs_socket.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/sys/nfsclient/nfs_socket.c b/sys/nfsclient/nfs_socket.c
index 43a6f7e..f602e42 100644
--- a/sys/nfsclient/nfs_socket.c
+++ b/sys/nfsclient/nfs_socket.c
@@ -156,7 +156,7 @@ int
nfs_connect(struct nfsmount *nmp, struct nfsreq *rep)
{
struct socket *so;
- int s, error, rcvreserve, sndreserve;
+ int error, rcvreserve, sndreserve;
int pktscale;
struct sockaddr *saddr;
struct thread *td = &thread0; /* only used for socreate and sobind */
@@ -241,25 +241,25 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep)
* connect system call but with the wait timing out so
* that interruptible mounts don't hang here for a long time.
*/
- s = splnet();
+ SOCK_LOCK(so);
while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
- (void) tsleep(&so->so_timeo,
+ (void) msleep(&so->so_timeo, SOCK_MTX(so),
PSOCK, "nfscon", 2 * hz);
if ((so->so_state & SS_ISCONNECTING) &&
so->so_error == 0 && rep &&
(error = nfs_sigintr(nmp, rep, rep->r_td)) != 0) {
so->so_state &= ~SS_ISCONNECTING;
- splx(s);
+ SOCK_UNLOCK(so);
goto bad;
}
}
if (so->so_error) {
error = so->so_error;
so->so_error = 0;
- splx(s);
+ SOCK_UNLOCK(so);
goto bad;
}
- splx(s);
+ SOCK_UNLOCK(so);
}
so->so_rcv.sb_timeo = 5 * hz;
so->so_snd.sb_timeo = 5 * hz;
OpenPOWER on IntegriCloud