aboutsummaryrefslogtreecommitdiff
path: root/sys/fs
diff options
context:
space:
mode:
authorRobert Watson <rwatson@FreeBSD.org>2004-06-24 00:47:23 +0000
committerRobert Watson <rwatson@FreeBSD.org>2004-06-24 00:47:23 +0000
commit1cf30f57e1e007149604099d18d8583a73eb4a91 (patch)
tree324f20945f6d7db8d2f6360eb56a794f329ed2be /sys/fs
parent4a03551ddd977e9931e0af7f8455589ff1c6b0d6 (diff)
downloadsrc-1cf30f57e1e007149604099d18d8583a73eb4a91.tar.gz
src-1cf30f57e1e007149604099d18d8583a73eb4a91.zip
Remove spls from portal_open(). Acquire socket lock while sleeping
waiting for the socket to connect and use msleep() on the socket mute rather than tsleep(). Acquire socket buffer mutexes around read-modify-write of socket buffer flags.
Notes
Notes: svn path=/head/; revision=131003
Diffstat (limited to 'sys/fs')
-rw-r--r--sys/fs/portalfs/portal_vnops.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/sys/fs/portalfs/portal_vnops.c b/sys/fs/portalfs/portal_vnops.c
index 261e62688624..dce916592b4e 100644
--- a/sys/fs/portalfs/portal_vnops.c
+++ b/sys/fs/portalfs/portal_vnops.c
@@ -216,7 +216,6 @@ portal_open(ap)
struct portalnode *pt;
struct thread *td = ap->a_td;
struct vnode *vp = ap->a_vp;
- int s;
struct uio auio;
struct iovec aiov[2];
int res;
@@ -284,16 +283,18 @@ portal_open(ap)
* will happen if the server dies. Sleep for 5 second intervals
* and keep polling the reference count. XXX.
*/
- s = splnet();
+ /* XXXRW: Locking? */
+ SOCK_LOCK(so);
while ((so->so_state & SS_ISCONNECTING) && so->so_error == 0) {
if (fmp->pm_server->f_count == 1) {
+ SOCK_UNLOCK(so);
error = ECONNREFUSED;
- splx(s);
goto bad;
}
- (void) tsleep((caddr_t) &so->so_timeo, PSOCK, "portalcon", 5 * hz);
+ (void) msleep((caddr_t) &so->so_timeo, SOCK_MTX(so), PSOCK,
+ "portalcon", 5 * hz);
}
- splx(s);
+ SOCK_UNLOCK(so);
if (so->so_error) {
error = so->so_error;
@@ -303,12 +304,12 @@ portal_open(ap)
/*
* Set miscellaneous flags
*/
- so->so_rcv.sb_timeo = 0;
- so->so_snd.sb_timeo = 0;
SOCKBUF_LOCK(&so->so_rcv);
+ so->so_rcv.sb_timeo = 0;
so->so_rcv.sb_flags |= SB_NOINTR;
SOCKBUF_UNLOCK(&so->so_rcv);
SOCKBUF_LOCK(&so->so_snd);
+ so->so_snd.sb_timeo = 0;
so->so_snd.sb_flags |= SB_NOINTR;
SOCKBUF_UNLOCK(&so->so_snd);