Re: 2.6.31 regression: system hang after pptp connectionestablished

From: Linus Torvalds
Date: Thu Sep 17 2009 - 17:13:20 EST




On Thu, 17 Sep 2009, Linus Torvalds wrote:
>
> What's interesting about it is that it shows a problem, but the problem it
> shows would seem to have nothing at all to do with ppp or networking or
> pty's. The problem seems to be processes stuck in disk-wait:

Ahh. I think I see what may be going on.

Somebody got a filesystem mutex, and then went to sleep due to IO. Then
pptp comes in, and seems to be stuck in a loop in kernel space, and
it seems to be stuck with preemption off.

So one CPU is stuck, and the thing that we want to run is on the same
run-queue, and not preempting. An looking at your CPU#1 trace, it's likely
looping in ppp_async_push().

And that whole loop is insane (and very prone to infinite loops), but it
also depends on that tty wakeup() thing.

Does this patch make a difference? Make sure to _not_ try to do the whole
wakeup thing if we couldn't actually insert anything into the tty buffers.

Linus
---
drivers/char/pty.c | 6 ++++--
1 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/char/pty.c b/drivers/char/pty.c
index b33d668..53761ce 100644
--- a/drivers/char/pty.c
+++ b/drivers/char/pty.c
@@ -120,8 +120,10 @@ static int pty_write(struct tty_struct *tty, const unsigned char *buf, int c)
/* Stuff the data into the input queue of the other end */
c = tty_insert_flip_string(to, buf, c);
/* And shovel */
- tty_flip_buffer_push(to);
- tty_wakeup(tty);
+ if (c) {
+ tty_flip_buffer_push(to);
+ tty_wakeup(tty);
+ }
}
return c;
}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/