/[linux-patches]/genpatches-2.6/trunk/2.6.16/2900_n-tty-throttling.patch
Gentoo

Contents of /genpatches-2.6/trunk/2.6.16/2900_n-tty-throttling.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 488 - (show annotations) (download) (as text)
Thu Jun 15 19:23:15 2006 UTC (14 years, 4 months ago) by dsd
File MIME type: text/x-diff
File size: 2550 byte(s)
Fix PPP/PPTP connection dropping regression
1 From: Paul Mackerras <paulus@samba.org>
2 Date: Mon, 12 Jun 2006 02:16:26 +0000 (+1000)
3 Subject: [PATCH] Fix for the PPTP hangs that have been reported
4 X-Git-Url: http://www.kernel.org/git/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commitdiff;h=289a1e995e74734b5ec76ca8a5490058f4fecc24
5
6 [PATCH] Fix for the PPTP hangs that have been reported
7
8 People have been reporting that PPP connections over ptys, such as
9 used with PPTP, will hang randomly when transferring large amounts of
10 data, for instance in http://bugzilla.kernel.org/show_bug.cgi?id=6530.
11 I have managed to reproduce the problem, and the patch below fixes the
12 actual cause.
13
14 The problem is not in fact in ppp_async.c but in n_tty.c. What
15 happens is that when pptp reads from the pty, we call read_chan() in
16 drivers/char/n_tty.c on the master side of the pty. That copies all
17 the characters out of its buffer to userspace and then calls
18 check_unthrottle(), which calls the pty unthrottle routine, which
19 calls tty_wakeup on the slave side, which calls ppp_asynctty_wakeup,
20 which calls tasklet_schedule. So far so good. Since we are in
21 process context, the tasklet runs immediately and calls
22 ppp_async_process(), which calls ppp_async_push, which calls the
23 tty->driver->write function to send some more output.
24
25 However, tty->driver->write() returns zero, because the master
26 tty->receive_room is still zero. We haven't returned from
27 check_unthrottle() yet, and read_chan() only updates tty->receive_room
28 _after_ calling check_unthrottle. That means that the driver->write
29 call in ppp_async_process() returns 0. That would be fine if we were
30 going to get a subsequent wakeup call, but we aren't (we just had it,
31 and the buffer is now empty).
32
33 The solution is for n_tty.c to update tty->receive_room _before_
34 calling the driver unthrottle routine. The patch below does this.
35 With this patch I was able to transfer a 900MB file over a PPTP
36 connection (taking about 25 minutes), whereas without the patch the
37 connection would always stall in under a minute.
38
39 Signed-off-by: Paul Mackerras <paulus@samba.org>
40 Signed-off-by: Linus Torvalds <torvalds@osdl.org>
41 ---
42
43 --- a/drivers/char/n_tty.c
44 +++ b/drivers/char/n_tty.c
45 @@ -1384,8 +1384,10 @@ do_it_again:
46 * longer than TTY_THRESHOLD_UNTHROTTLE in canonical mode,
47 * we won't get any more characters.
48 */
49 - if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE)
50 + if (n_tty_chars_in_buffer(tty) <= TTY_THRESHOLD_UNTHROTTLE) {
51 + n_tty_set_room(tty);
52 check_unthrottle(tty);
53 + }
54
55 if (b - buf >= minimum)
56 break;

  ViewVC Help
Powered by ViewVC 1.1.20