Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 364249
b: refs/heads/master
c: 2162293
h: refs/heads/master
i:
  364247: 4e437c0
v: v3
  • Loading branch information
Peter Hurley authored and Greg Kroah-Hartman committed Mar 18, 2013
1 parent 7e37ed3 commit b6c3d73
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 2 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: 91debb0383d6564e0dc8ae76181f6daf8e24717a
refs/heads/master: 21622939fc452c7fb739464b8e49368c3ceaa0ee
8 changes: 8 additions & 0 deletions trunk/drivers/tty/n_tty.c
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,12 @@ static void n_tty_set_room(struct tty_struct *tty)
if (left && !old_left) {
WARN_RATELIMIT(tty->port->itty == NULL,
"scheduling with invalid itty\n");
/* see if ldisc has been killed - if so, this means that
* even though the ldisc has been halted and ->buf.work
* cancelled, ->buf.work is about to be rescheduled
*/
WARN_RATELIMIT(test_bit(TTY_LDISC_HALTED, &tty->flags),
"scheduling buffer work for halted ldisc\n");
schedule_work(&tty->port->buf.work);
}
}
Expand Down Expand Up @@ -1624,6 +1630,8 @@ static int n_tty_open(struct tty_struct *tty)
goto err_free_bufs;

tty->disc_data = ldata;
/* indicate buffer work may resume */
clear_bit(TTY_LDISC_HALTED, &tty->flags);
reset_buffer_flags(tty);
tty_unthrottle(tty);
ldata->column = 0;
Expand Down
7 changes: 6 additions & 1 deletion trunk/drivers/tty/tty_ldisc.c
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,7 @@ static inline void tty_ldisc_put(struct tty_ldisc *ld)

void tty_ldisc_enable(struct tty_struct *tty)
{
clear_bit(TTY_LDISC_HALTED, &tty->flags);
set_bit(TTY_LDISC, &tty->flags);
clear_bit(TTY_LDISC_CHANGING, &tty->flags);
wake_up(&tty_ldisc_wait);
Expand Down Expand Up @@ -513,8 +514,11 @@ static void tty_ldisc_restore(struct tty_struct *tty, struct tty_ldisc *old)

static int tty_ldisc_halt(struct tty_struct *tty)
{
int scheduled;
clear_bit(TTY_LDISC, &tty->flags);
return cancel_work_sync(&tty->port->buf.work);
scheduled = cancel_work_sync(&tty->port->buf.work);
set_bit(TTY_LDISC_HALTED, &tty->flags);
return scheduled;
}

/**
Expand Down Expand Up @@ -820,6 +824,7 @@ void tty_ldisc_hangup(struct tty_struct *tty)
clear_bit(TTY_LDISC, &tty->flags);
tty_unlock(tty);
cancel_work_sync(&tty->port->buf.work);
set_bit(TTY_LDISC_HALTED, &tty->flags);
mutex_unlock(&tty->ldisc_mutex);
retry:
tty_lock(tty);
Expand Down
1 change: 1 addition & 0 deletions trunk/include/linux/tty.h
Original file line number Diff line number Diff line change
Expand Up @@ -315,6 +315,7 @@ struct tty_file_private {
#define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */
#define TTY_HUPPED 18 /* Post driver->hangup() */
#define TTY_HUPPING 21 /* ->hangup() in progress */
#define TTY_LDISC_HALTED 22 /* Line discipline is halted */

#define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))

Expand Down

0 comments on commit b6c3d73

Please sign in to comment.