summaryrefslogtreecommitdiff
path: root/sys/nfs/nfs_socket.c
diff options
context:
space:
mode:
authorMartin Pieuchot <mpi@cvs.openbsd.org>2017-07-24 15:07:40 +0000
committerMartin Pieuchot <mpi@cvs.openbsd.org>2017-07-24 15:07:40 +0000
commit00a099821c8c92b74dc093d2a4f5cf17d15fc251 (patch)
tree79ce659725b59939ad77aa9e7c48120e3099ab67 /sys/nfs/nfs_socket.c
parent72254b8249e7586e88058b821ee2518031371e5c (diff)
Extend the scope of the socket lock to protect `so_state' in connect(2).
As a side effect, soconnect() and soconnect2() now expect a locked socket, so update all the callers. ok bluhm@
Diffstat (limited to 'sys/nfs/nfs_socket.c')
-rw-r--r--sys/nfs/nfs_socket.c8
1 files changed, 5 insertions, 3 deletions
diff --git a/sys/nfs/nfs_socket.c b/sys/nfs/nfs_socket.c
index 748fd82d1fc..ae2ebb0fd35 100644
--- a/sys/nfs/nfs_socket.c
+++ b/sys/nfs/nfs_socket.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: nfs_socket.c,v 1.119 2017/06/27 12:02:43 mpi Exp $ */
+/* $OpenBSD: nfs_socket.c,v 1.120 2017/07/24 15:07:39 mpi Exp $ */
/* $NetBSD: nfs_socket.c,v 1.27 1996/04/15 20:20:00 thorpej Exp $ */
/*
@@ -297,16 +297,18 @@ nfs_connect(struct nfsmount *nmp, struct nfsreq *rep)
goto bad;
}
} else {
+ s = solock(so);
error = soconnect(so, nmp->nm_nam);
- if (error)
+ if (error) {
+ sounlock(s);
goto bad;
+ }
/*
* Wait for the connection to complete. Cribbed from the
* connect system call but with the wait timing out so
* that interruptible mounts don't hang here for a long time.
*/
- s = solock(so);
while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
sosleep(so, &so->so_timeo, PSOCK, "nfscon", 2 * hz);
if ((so->so_state & SS_ISCONNECTING) &&