289a1e995e
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> Signed-off-by: Linus Torvalds <torvalds@osdl.org> |
||
---|---|---|
.. | ||
agp | ||
drm | ||
ftape | ||
ip2 | ||
ipmi | ||
mwave | ||
pcmcia | ||
rio | ||
tpm | ||
watchdog | ||
.gitignore | ||
amiserial.c | ||
applicom.c | ||
applicom.h | ||
cd1865.h | ||
ChangeLog | ||
consolemap.c | ||
cp437.uni | ||
cs5535_gpio.c | ||
cyclades.c | ||
decserial.c | ||
defkeymap.c_shipped | ||
defkeymap.map | ||
digi1.h | ||
digi.h | ||
digiFep1.h | ||
digiPCI.h | ||
ds1286.c | ||
ds1302.c | ||
ds1620.c | ||
dsp56k.c | ||
dtlk.c | ||
ec3104_keyb.c | ||
efirtc.c | ||
epca.c | ||
epca.h | ||
epcaconfig.h | ||
esp.c | ||
generic_nvram.c | ||
generic_serial.c | ||
genrtc.c | ||
hangcheck-timer.c | ||
hpet.c | ||
hvc_console.c | ||
hvc_console.h | ||
hvc_rtas.c | ||
hvc_vio.c | ||
hvcs.c | ||
hvsi.c | ||
hw_random.c | ||
i8k.c | ||
ip27-rtc.c | ||
isicom.c | ||
istallion.c | ||
ite_gpio.c | ||
Kconfig | ||
keyboard.c | ||
lcd.c | ||
lcd.h | ||
lp.c | ||
Makefile | ||
mbcs.c | ||
mbcs.h | ||
mem.c | ||
misc.c | ||
mmtimer.c | ||
moxa.c | ||
mxser.c | ||
mxser.h | ||
n_hdlc.c | ||
n_r3964.c | ||
n_tty.c | ||
nvram.c | ||
nwbutton.c | ||
nwbutton.h | ||
nwflash.c | ||
ppdev.c | ||
pty.c | ||
qtronix.c | ||
qtronixmap.c_shipped | ||
qtronixmap.map | ||
random.c | ||
raw.c | ||
riscom8_reg.h | ||
riscom8.c | ||
riscom8.h | ||
rocket_int.h | ||
rocket.c | ||
rocket.h | ||
rtc.c | ||
s3c2410-rtc.c | ||
scan_keyb.c | ||
scan_keyb.h | ||
scc.h | ||
scx200_gpio.c | ||
selection.c | ||
ser_a2232.c | ||
ser_a2232.h | ||
ser_a2232fw.ax | ||
ser_a2232fw.h | ||
serial167.c | ||
snsc_event.c | ||
snsc.c | ||
snsc.h | ||
sonypi.c | ||
specialix_io8.h | ||
specialix.c | ||
stallion.c | ||
sx.c | ||
sx.h | ||
sxboards.h | ||
sxwindow.h | ||
synclink_gt.c | ||
synclink.c | ||
synclinkmp.c | ||
sysrq.c | ||
tb0219.c | ||
tipar.c | ||
tlclk.c | ||
toshiba.c | ||
tty_io.c | ||
tty_ioctl.c | ||
vc_screen.c | ||
viocons.c | ||
viotape.c | ||
vme_scc.c | ||
vr41xx_giu.c | ||
vt_ioctl.c | ||
vt.c |