Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 222827
b: refs/heads/master
c: acfa747
h: refs/heads/master
i:
  222825: e633c27
  222823: 09512af
v: v3
  • Loading branch information
Jiri Slaby authored and Greg Kroah-Hartman committed Nov 29, 2010
1 parent 2dba738 commit 4854829
Show file tree
Hide file tree
Showing 3 changed files with 11 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: e2efafbf139d2bfdfe96f2901f03189fecd172e4
refs/heads/master: acfa747baf73922021a047f2d87a2d866f5dbab5
10 changes: 9 additions & 1 deletion trunk/drivers/tty/tty_io.c
Original file line number Diff line number Diff line change
Expand Up @@ -559,6 +559,9 @@ void __tty_hangup(struct tty_struct *tty)

tty_lock();

/* some functions below drop BTM, so we need this bit */
set_bit(TTY_HUPPING, &tty->flags);

/* inuse_filps is protected by the single tty lock,
this really needs to change if we want to flush the
workqueue with the lock held */
Expand All @@ -578,6 +581,10 @@ void __tty_hangup(struct tty_struct *tty)
}
spin_unlock(&tty_files_lock);

/*
* it drops BTM and thus races with reopen
* we protect the race by TTY_HUPPING
*/
tty_ldisc_hangup(tty);

read_lock(&tasklist_lock);
Expand Down Expand Up @@ -615,7 +622,6 @@ void __tty_hangup(struct tty_struct *tty)
tty->session = NULL;
tty->pgrp = NULL;
tty->ctrl_status = 0;
set_bit(TTY_HUPPED, &tty->flags);
spin_unlock_irqrestore(&tty->ctrl_lock, flags);

/* Account for the p->signal references we killed */
Expand All @@ -641,6 +647,7 @@ void __tty_hangup(struct tty_struct *tty)
* can't yet guarantee all that.
*/
set_bit(TTY_HUPPED, &tty->flags);
clear_bit(TTY_HUPPING, &tty->flags);
tty_ldisc_enable(tty);

tty_unlock();
Expand Down Expand Up @@ -1311,6 +1318,7 @@ static int tty_reopen(struct tty_struct *tty)
struct tty_driver *driver = tty->driver;

if (test_bit(TTY_CLOSING, &tty->flags) ||
test_bit(TTY_HUPPING, &tty->flags) ||
test_bit(TTY_LDISC_CHANGING, &tty->flags))
return -EIO;

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 @@ -367,6 +367,7 @@ struct tty_file_private {
#define TTY_HUPPED 18 /* Post driver->hangup() */
#define TTY_FLUSHING 19 /* Flushing to ldisc in progress */
#define TTY_FLUSHPENDING 20 /* Queued buffer flush pending */
#define TTY_HUPPING 21 /* ->hangup() in progress */

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

Expand Down

0 comments on commit 4854829

Please sign in to comment.