]> git.baikalelectronics.ru Git - kernel.git/commit
Revert "tty: make receive_buf() return the amout of bytes received"
authorLinus Torvalds <torvalds@linux-foundation.org>
Fri, 3 Jun 2011 21:33:24 +0000 (06:33 +0900)
committerLinus Torvalds <torvalds@linux-foundation.org>
Fri, 3 Jun 2011 21:33:24 +0000 (06:33 +0900)
commit19b581e4ec073af40598f835b5aeedff9f6326ce
tree4bd186333049c5fcc1eacdff0efc82ac8b80ff5e
parent1981e8afde848cb23fcf84c50b8e9b8817907f73
Revert "tty: make receive_buf() return the amout of bytes received"

This reverts commit b6907b413d831e89623713dba26ca1c0faafa1cf.

It was broken in so many ways, and results in random odd pty issues.

It re-introduced the buggy schedule_work() in flush_to_ldisc() that can
cause endless work-loops (see commit adaa72067b15: "tty: fix endless
work loop when the buffer fills up").

It also used an "unsigned int" return value fo the ->receive_buf()
function, but then made multiple functions return a negative error code,
and didn't actually check for the error in the caller.

And it didn't actually work at all.  BenH bisected down odd tty behavior
to it:
  "It looks like the patch is causing some major malfunctions of the X
   server for me, possibly related to PTYs.  For example, cat'ing a
   large file in a gnome terminal hangs the kernel for -minutes- in a
   loop of what looks like flush_to_ldisc/workqueue code, (some ftrace
   data in the quoted bits further down).

   ...

   Some more data: It -looks- like what happens is that the
   flush_to_ldisc work queue entry constantly re-queues itself (because
   the PTY is full ?) and the workqueue thread will basically loop
   forver calling it without ever scheduling, thus starving the consumer
   process that could have emptied the PTY."

which is pretty much exactly the problem we fixed in adaa72067b15.

Milton Miller pointed out the 'unsigned int' issue.

Reported-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Reported-by: Milton Miller <miltonm@bga.com>
Cc: Stefan Bigler <stefan.bigler@keymile.com>
Cc: Toby Gray <toby.gray@realvnc.com>
Cc: Felipe Balbi <balbi@ti.com>
Cc: Greg Kroah-Hartman <gregkh@suse.de>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
20 files changed:
drivers/bluetooth/hci_ldisc.c
drivers/input/serio/serport.c
drivers/isdn/gigaset/ser-gigaset.c
drivers/misc/ti-st/st_core.c
drivers/net/caif/caif_serial.c
drivers/net/can/slcan.c
drivers/net/hamradio/6pack.c
drivers/net/hamradio/mkiss.c
drivers/net/irda/irtty-sir.c
drivers/net/ppp_async.c
drivers/net/ppp_synctty.c
drivers/net/slip.c
drivers/net/wan/x25_asy.c
drivers/tty/n_gsm.c
drivers/tty/n_hdlc.c
drivers/tty/n_r3964.c
drivers/tty/n_tty.c
drivers/tty/tty_buffer.c
drivers/tty/vt/selection.c
include/linux/tty_ldisc.h