提交 7879a9f9 编写于 作者: P Peter Hurley 提交者: Greg Kroah-Hartman

n_tty: Buffer work should not reschedule itself

Although the driver-side input path must update the available
buffer space, it should not reschedule itself. If space is still
available and the flip buffers are not empty, flush_to_ldisc()
will loop again.
Signed-off-by: NPeter Hurley <peter@hurleysoftware.com>
Signed-off-by: NGreg Kroah-Hartman <gregkh@linuxfoundation.org>
上级 b8483052
...@@ -118,14 +118,14 @@ static inline int tty_put_user(struct tty_struct *tty, unsigned char x, ...@@ -118,14 +118,14 @@ static inline int tty_put_user(struct tty_struct *tty, unsigned char x,
* n_tty_set_room - receive space * n_tty_set_room - receive space
* @tty: terminal * @tty: terminal
* *
* Sets tty->receive_room to reflect the currently available space * Updates tty->receive_room to reflect the currently available space
* in the input buffer, and re-schedules the flip buffer work if space * in the input buffer, and re-schedules the flip buffer work if space
* just became available. * just became available.
* *
* Locks: Concurrent update is protected with read_lock * Locks: Concurrent update is protected with read_lock
*/ */
static void n_tty_set_room(struct tty_struct *tty) static int set_room(struct tty_struct *tty)
{ {
struct n_tty_data *ldata = tty->disc_data; struct n_tty_data *ldata = tty->disc_data;
int left; int left;
...@@ -155,8 +155,13 @@ static void n_tty_set_room(struct tty_struct *tty) ...@@ -155,8 +155,13 @@ static void n_tty_set_room(struct tty_struct *tty)
raw_spin_unlock_irqrestore(&ldata->read_lock, flags); raw_spin_unlock_irqrestore(&ldata->read_lock, flags);
return left && !old_left;
}
static void n_tty_set_room(struct tty_struct *tty)
{
/* Did this open up the receive buffer? We may need to flip */ /* Did this open up the receive buffer? We may need to flip */
if (left && !old_left) { if (set_room(tty)) {
WARN_RATELIMIT(tty->port->itty == NULL, WARN_RATELIMIT(tty->port->itty == NULL,
"scheduling with invalid itty\n"); "scheduling with invalid itty\n");
/* see if ldisc has been killed - if so, this means that /* see if ldisc has been killed - if so, this means that
...@@ -1459,7 +1464,7 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp, ...@@ -1459,7 +1464,7 @@ static void n_tty_receive_buf(struct tty_struct *tty, const unsigned char *cp,
tty->ops->flush_chars(tty); tty->ops->flush_chars(tty);
} }
n_tty_set_room(tty); set_room(tty);
if ((!ldata->icanon && (ldata->read_cnt >= ldata->minimum_to_wake)) || if ((!ldata->icanon && (ldata->read_cnt >= ldata->minimum_to_wake)) ||
L_EXTPROC(tty)) { L_EXTPROC(tty)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册