Skip to contentSkip to conversation

NE2000

PATCH David S. Miller 1 participant 1 message Nov 9, 2000 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Date: Thu, 09 Nov 2000 21:53:42 +1100
From: Andrew Morton <[email protected]>

Quoted 1 line · David S. Miller

I will compose a patch to fix all this.

I've quickly been through just about all of the kernel wrt waitqueues.

My analysis was in error, BEWARE!

Being on multiple wait queues at once is just fine. I verified this with Linus tonight.

The problem case is in mixing TASK_EXCLUSIVE and non-TASK_EXCLUSIVE sleeps, that is what can actually cause problems.

Everything else is fine. Anyways, the (untested) patch below should cure the lock_sock() cases.

net/ipv4/af_inet.c renamed from net/ipv4/af_inet.c.~1~ +10 -7
@@ -543,24 +543,27 @@
 {
 	DECLARE_WAITQUEUE(wait, current);
 
-	__set_current_state(TASK_INTERRUPTIBLE);
-	add_wait_queue(sk->sleep, &wait);
-
 	/* Basic assumption: if someone sets sk->err, he _must_
 	 * change state of the socket from TCP_SYN_*.
 	 * Connect() does not allow to get error notifications
 	 * without closing the socket.
 	 */
 	while ((1<<sk->state)&(TCPF_SYN_SENT|TCPF_SYN_RECV)) {
+		__set_current_state(TASK_INTERRUPTIBLE);
+		add_wait_queue(sk->sleep, &wait);
+
 		release_sock(sk);
-		timeo = schedule_timeout(timeo);
+
+		if ((1<<sk->state)&(TCPF_SYN_SENT|TCPF_SYN_RECV))
+			timeo = schedule_timeout(timeo);
+
+		__set_current_state(TASK_RUNNING);
+		remove_wait_queue(sk->sleep, &wait);
+
 		lock_sock(sk);
 		if (signal_pending(current) || !timeo)
 			break;
-		set_current_state(TASK_INTERRUPTIBLE);
 	}
-	__set_current_state(TASK_RUNNING);
-	remove_wait_queue(sk->sleep, &wait);
 	return timeo;
 }
 
net/ipv4/tcp.c renamed from net/ipv4/tcp.c.~1~ +37 -23

136 lines not on this page · raw message

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [email protected]
Please read the FAQ at http://www.tux.org/lkml/