* [PATCH] Fix for the PPTP hangs that have been reported
@ 2006-06-12 2:16 Paul Mackerras
2006-06-12 17:22 ` Michael Buesch
2006-06-12 21:38 ` Lee Revell
0 siblings, 2 replies; 3+ messages in thread
From: Paul Mackerras @ 2006-06-12 2:16 UTC (permalink / raw)
To: akpm, torvalds, Alan Cox; +Cc: linux-kernel, xxebxebx
People have been reporting that PPP connections over ptys, such as
used with PPTP, will hang randomly when transferring large amounts of
data, for instance in http://bugzilla.kernel.org/show_bug.cgi?id=6530.
I have managed to reproduce the problem, and the patch below fixes the
actual cause.
The problem is not in fact in ppp_async.c but in n_tty.c. What
happens is that when pptp reads from the pty, we call read_chan() in
drivers/char/n_tty.c on the master side of the pty. That copies all
the characters out of its buffer to userspace and then calls
check_unthrottle(), which calls the pty unthrottle routine, which
calls tty_wakeup on the slave side, which calls ppp_asynctty_wakeup,
which calls tasklet_schedule. So far so good. Since we are in
process context, the tasklet runs immediately and calls
ppp_async_process(), which calls ppp_async_push, which calls the
tty->driver->write function to send some more output.
However, tty->driver->write() returns zero, because the master
tty->receive_room is still zero. We haven't returned from
check_unthrottle() yet, and read_chan() only updates tty->receive_room
_after_ calling check_unthrottle. That means that the driver->write
call in ppp_async_process() returns 0. That would be fine if we were
going to get a subsequent wakeup call, but we aren't (we just had it,
and the buffer is now empty).
The solution is for n_tty.c to update tty->receive_room _before_
calling the driver unthrottle routine. The patch below does this.
With this patch I was able to transfer a 900MB file over a PPTP
connection (taking about 25 minutes), whereas without the patch the
connection would always stall in under a minute.
Signed-off-by: Paul Mackerras <paulus@samba.org>
---
Linus & Andrew, I think this one is a 2.6.17 candidate. It's a small
and harmless patch and it fixes a bug that has been annoying quite a
few people, if the bugzilla reports are anything to go by. I think it
should solve bugzilla 6402 as well.
diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
index ede365d..b9371d5 100644
--- a/drivers/char/n_tty.c
+++ b/drivers/char/n_tty.c
@@ -1384,8 +1384,10 @@ do_it_again:
* longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode,
* we won't get any more characters.
*/
- if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE)
+ if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) {
+ n_tty_set_room(tty);
check_unthrottle(tty);
+ }
if (b - buf >= minimum)
break;
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix for the PPTP hangs that have been reported
2006-06-12 2:16 [PATCH] Fix for the PPTP hangs that have been reported Paul Mackerras
@ 2006-06-12 17:22 ` Michael Buesch
2006-06-12 21:38 ` Lee Revell
1 sibling, 0 replies; 3+ messages in thread
From: Michael Buesch @ 2006-06-12 17:22 UTC (permalink / raw)
To: Paul Mackerras; +Cc: akpm, torvalds, Alan Cox, linux-kernel, xxebxebx, Greg KH
On Monday 12 June 2006 04:16, Paul Mackerras wrote:
> Signed-off-by: Paul Mackerras <paulus@samba.org>
> ---
> Linus & Andrew, I think this one is a 2.6.17 candidate.
What about 2.6.16-stable?
I just applied that patch to my server running 2.6.16.20.
Seems to be ok, but I did not stresstest it.
> It's a small
> and harmless patch and it fixes a bug that has been annoying quite a
> few people, if the bugzilla reports are anything to go by. I think it
> should solve bugzilla 6402 as well.
>
> diff --git a/drivers/char/n_tty.c b/drivers/char/n_tty.c
> index ede365d..b9371d5 100644
> --- a/drivers/char/n_tty.c
> +++ b/drivers/char/n_tty.c
> @@ -1384,8 +1384,10 @@ do_it_again:
> * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode,
> * we won't get any more characters.
> */
> - if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE)
> + if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) {
> + n_tty_set_room(tty);
> check_unthrottle(tty);
> + }
>
> if (b - buf >= minimum)
> break;
--
Greetings Michael.
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Fix for the PPTP hangs that have been reported
2006-06-12 2:16 [PATCH] Fix for the PPTP hangs that have been reported Paul Mackerras
2006-06-12 17:22 ` Michael Buesch
@ 2006-06-12 21:38 ` Lee Revell
1 sibling, 0 replies; 3+ messages in thread
From: Lee Revell @ 2006-06-12 21:38 UTC (permalink / raw)
To: Paul Mackerras; +Cc: akpm, torvalds, Alan Cox, linux-kernel, xxebxebx
On Mon, 2006-06-12 at 12:16 +1000, Paul Mackerras wrote:
> People have been reporting that PPP connections over ptys, such as
> used with PPTP, will hang randomly when transferring large amounts of
> data, for instance in http://bugzilla.kernel.org/show_bug.cgi?id=6530.
> I have managed to reproduce the problem, and the patch below fixes the
> actual cause.
I was terribly afflicted by this bug and the patch seems to help.
Strangely, it made PPTP completely unusable with the -rt kernel - the
connection would hang forever - but with 2.6.16 it only seemed to slow
things down.
Lee
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2006-06-12 21:38 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-12 2:16 [PATCH] Fix for the PPTP hangs that have been reported Paul Mackerras
2006-06-12 17:22 ` Michael Buesch
2006-06-12 21:38 ` Lee Revell
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox