diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2011-06-03 17:33:24 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2011-06-03 17:33:24 -0400 |
commit | 55db4c64eddf37e31279ec15fe90314713bc9cfa (patch) | |
tree | 4bd186333049c5fcc1eacdff0efc82ac8b80ff5e /drivers/isdn | |
parent | 1fa7b6a29c61358cc2ca6f64cef4aa0e1a7ca74c (diff) |
Revert "tty: make receive_buf() return the amout of bytes received"
This reverts commit b1c43f82c5aa265442f82dba31ce985ebb7aa71c.
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 a5660b41af6a: "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 a5660b41af6a.
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>
Diffstat (limited to 'drivers/isdn')
-rw-r--r-- | drivers/isdn/gigaset/ser-gigaset.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/drivers/isdn/gigaset/ser-gigaset.c b/drivers/isdn/gigaset/ser-gigaset.c index 1d44d470897c..86a5c4f7775e 100644 --- a/drivers/isdn/gigaset/ser-gigaset.c +++ b/drivers/isdn/gigaset/ser-gigaset.c | |||
@@ -674,7 +674,7 @@ gigaset_tty_ioctl(struct tty_struct *tty, struct file *file, | |||
674 | * cflags buffer containing error flags for received characters (ignored) | 674 | * cflags buffer containing error flags for received characters (ignored) |
675 | * count number of received characters | 675 | * count number of received characters |
676 | */ | 676 | */ |
677 | static unsigned int | 677 | static void |
678 | gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf, | 678 | gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf, |
679 | char *cflags, int count) | 679 | char *cflags, int count) |
680 | { | 680 | { |
@@ -683,12 +683,12 @@ gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
683 | struct inbuf_t *inbuf; | 683 | struct inbuf_t *inbuf; |
684 | 684 | ||
685 | if (!cs) | 685 | if (!cs) |
686 | return -ENODEV; | 686 | return; |
687 | inbuf = cs->inbuf; | 687 | inbuf = cs->inbuf; |
688 | if (!inbuf) { | 688 | if (!inbuf) { |
689 | dev_err(cs->dev, "%s: no inbuf\n", __func__); | 689 | dev_err(cs->dev, "%s: no inbuf\n", __func__); |
690 | cs_put(cs); | 690 | cs_put(cs); |
691 | return -EINVAL; | 691 | return; |
692 | } | 692 | } |
693 | 693 | ||
694 | tail = inbuf->tail; | 694 | tail = inbuf->tail; |
@@ -725,8 +725,6 @@ gigaset_tty_receive(struct tty_struct *tty, const unsigned char *buf, | |||
725 | gig_dbg(DEBUG_INTR, "%s-->BH", __func__); | 725 | gig_dbg(DEBUG_INTR, "%s-->BH", __func__); |
726 | gigaset_schedule_event(cs); | 726 | gigaset_schedule_event(cs); |
727 | cs_put(cs); | 727 | cs_put(cs); |
728 | |||
729 | return count; | ||
730 | } | 728 | } |
731 | 729 | ||
732 | /* | 730 | /* |