Linus's tcp.c patch

Jon Lewis (jlewis@inorganic5.fdt.net)
Sat, 19 Oct 1996 00:46:58 -0400 (EDT)


Enough people have asked me about Linus's tcp.c patch (to correct the
problem of hung httpd's) that I'm forwarding it back to the linux-kernel
list and a few others where people might need it.

On the system that was encountering this problem almost daily (sometimes
twice daily) I'm up to about 8.5 days without a recurrence.

---------------------------------------------------------------------
> This should cause httpd children to die after they've used 6 minutes of
> CPU time. The below should therefore not be happening:
>
> USER PID %CPU %MEM SIZE RSS TTY STAT START TIME COMMAND
> nobody 26962 59.7 0.4 1144 472 ? R 18:49 22:49 ./httpd-1.1.1-limit

The patch below should fix it, and while it is done against 2.0.22 it should
actually apply to just about any reasonably recent kernel.

Linus

---
diff -u --recursive v2.0.22/linux/net/ipv4/tcp.c linux/net/ipv4/tcp.c
--- v2.0.22/linux/net/ipv4/tcp.c	Tue Oct  8 21:20:15 1996
+++ linux/net/ipv4/tcp.c	Wed Oct  9 18:28:34 1996
@@ -873,6 +873,8 @@
 		sk->socket->flags &= ~SO_NOSPACE;
 		add_wait_queue(sk->sleep, &wait);
 		for (;;) {
+			if (current->signal & ~current->blocked)
+				break;
 			current->state = TASK_INTERRUPTIBLE;
 			if (tcp_memory_free(sk))
 				break;
-----

------------------------------------------------------------------ Jon Lewis <jlewis@fdt.net> | Unsolicited commercial e-mail will Network Administrator | be proof-read for $199/hr. ________Finger jlewis@inorganic5.fdt.net for PGP public key_______