Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 364219
b: refs/heads/master
c: e91e52e
h: refs/heads/master
i:
  364217: 0897ebf
  364215: 5a0be97
v: v3
  • Loading branch information
Peter Hurley authored and Greg Kroah-Hartman committed Mar 18, 2013
1 parent 33c628f commit a3e520c
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 12 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 70bc126471af30bb115e635512dcf6d86fe6e29a
refs/heads/master: e91e52e42814b130c20d17bc1e2adf813c50db11
28 changes: 17 additions & 11 deletions trunk/drivers/tty/n_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -1468,14 +1468,14 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
* mode. We don't want to throttle the driver if we're in
* canonical mode and don't have a newline yet!
*/
if (tty->receive_room < TTY_THRESHOLD_THROTTLE)
tty_throttle(tty);

/* FIXME: there is a tiny race here if the receive room check runs
before the other work executes and empties the buffer (upping
the receiving room and unthrottling. We then throttle and get
stuck. This has been observed and traced down by Vincent Pillet/
We need to address this when we sort out out the rx path locking */
while (1) {
tty_set_flow_change(tty, TTY_THROTTLE_SAFE);
if (tty->receive_room >= TTY_THRESHOLD_THROTTLE)
break;
if (!tty_throttle_safe(tty))
break;
}
__tty_set_flow_change(tty, 0);
}

int is_ignored(int sig)
Expand Down Expand Up @@ -1944,11 +1944,17 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
* 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) {
while (1) {
tty_set_flow_change(tty, TTY_UNTHROTTLE_SAFE);
if (n_tty_chars_in_buffer(tty) > TTY_THRESHOLD_UNTHROTTLE)
break;
if (!tty->count)
break;
n_tty_set_room(tty);
if (tty->count)
tty_unthrottle(tty);
if (!tty_unthrottle_safe(tty))
break;
}
__tty_set_flow_change(tty, 0);

if (b - buf >= minimum)
break;
Expand Down

0 comments on commit a3e520c

Please sign in to comment.