Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/kern sonewconn: insert the socket into the queue *after*...
details: https://anonhg.NetBSD.org/src/rev/f2e221269f96
branches: trunk
changeset: 796046:f2e221269f96
user: rmind <rmind%NetBSD.org@localhost>
date: Sat May 17 23:55:24 2014 +0000
description:
sonewconn: insert the socket into the queue *after* the protocol attach.
This potentially avoids unnecessary race conditions when handling partial
connections.
diffstat:
sys/kern/uipc_socket2.c | 11 +++++------
1 files changed, 5 insertions(+), 6 deletions(-)
diffs (45 lines):
diff -r 29ee450756ff -r f2e221269f96 sys/kern/uipc_socket2.c
--- a/sys/kern/uipc_socket2.c Sat May 17 23:32:32 2014 +0000
+++ b/sys/kern/uipc_socket2.c Sat May 17 23:55:24 2014 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: uipc_socket2.c,v 1.116 2014/05/17 22:52:36 rmind Exp $ */
+/* $NetBSD: uipc_socket2.c,v 1.117 2014/05/17 23:55:24 rmind Exp $ */
/*-
* Copyright (c) 2008 The NetBSD Foundation, Inc.
@@ -58,7 +58,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.116 2014/05/17 22:52:36 rmind Exp $");
+__KERNEL_RCSID(0, "$NetBSD: uipc_socket2.c,v 1.117 2014/05/17 23:55:24 rmind Exp $");
#include "opt_mbuftrace.h"
#include "opt_sb_max.h"
@@ -302,13 +302,11 @@
*/
mutex_obj_hold(head->so_lock);
so->so_lock = head->so_lock;
- soqinsque(head, so, soqueue);
error = (*so->so_proto->pr_usrreq)(so, PRU_ATTACH, NULL, NULL,
NULL, NULL);
KASSERT(solocked(so));
if (error) {
- (void) soqremque(so, soqueue);
out:
KASSERT(so->so_accf == NULL);
soput(so);
@@ -319,9 +317,10 @@
}
/*
- * Update the connection status and wake up any waiters,
- * e.g. processes blocking on accept().
+ * Insert into the queue. If ready, update the connection status
+ * and wake up any waiters, e.g. processes blocking on accept().
*/
+ soqinsque(head, so, soqueue);
if (soready) {
so->so_state |= SS_ISCONNECTED;
sorwakeup(head);
Home |
Main Index |
Thread Index |
Old Index