diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2014-11-05 12:12:46 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-05 21:24:10 -0500 |
commit | 3ff51a199f9e85aed843471bc10dae9e94dbb0fc (patch) | |
tree | f5e5eae66eb92fe22f9b7da6eb582ceb59bb91c9 | |
parent | c8483bc9deff9bf9118aaab2e840b973b75cac3e (diff) |
tty: Remove TTY_HUPPING
Now that tty_ldisc_hangup() does not drop the tty lock, it is no
longer possible to observe TTY_HUPPING while holding the tty lock
on another cpu.
Remove TTY_HUPPING bit definition.
Reviewed-by: Alan Cox <alan@linux.intel.com>
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
-rw-r--r-- | drivers/tty/tty_io.c | 12 | ||||
-rw-r--r-- | drivers/tty/tty_ldisc.c | 3 | ||||
-rw-r--r-- | include/linux/tty.h | 1 |
3 files changed, 2 insertions, 14 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index 9d1e247ee330..873793c426df 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -690,9 +690,6 @@ static void __tty_hangup(struct tty_struct *tty, int exit_session) | |||
690 | return; | 690 | return; |
691 | } | 691 | } |
692 | 692 | ||
693 | /* some functions below drop BTM, so we need this bit */ | ||
694 | set_bit(TTY_HUPPING, &tty->flags); | ||
695 | |||
696 | /* inuse_filps is protected by the single tty lock, | 693 | /* inuse_filps is protected by the single tty lock, |
697 | this really needs to change if we want to flush the | 694 | this really needs to change if we want to flush the |
698 | workqueue with the lock held */ | 695 | workqueue with the lock held */ |
@@ -717,10 +714,6 @@ static void __tty_hangup(struct tty_struct *tty, int exit_session) | |||
717 | while (refs--) | 714 | while (refs--) |
718 | tty_kref_put(tty); | 715 | tty_kref_put(tty); |
719 | 716 | ||
720 | /* | ||
721 | * it drops BTM and thus races with reopen | ||
722 | * we protect the race by TTY_HUPPING | ||
723 | */ | ||
724 | tty_ldisc_hangup(tty); | 717 | tty_ldisc_hangup(tty); |
725 | 718 | ||
726 | spin_lock_irq(&tty->ctrl_lock); | 719 | spin_lock_irq(&tty->ctrl_lock); |
@@ -752,8 +745,6 @@ static void __tty_hangup(struct tty_struct *tty, int exit_session) | |||
752 | * can't yet guarantee all that. | 745 | * can't yet guarantee all that. |
753 | */ | 746 | */ |
754 | set_bit(TTY_HUPPED, &tty->flags); | 747 | set_bit(TTY_HUPPED, &tty->flags); |
755 | clear_bit(TTY_HUPPING, &tty->flags); | ||
756 | |||
757 | tty_unlock(tty); | 748 | tty_unlock(tty); |
758 | 749 | ||
759 | if (f) | 750 | if (f) |
@@ -1461,8 +1452,7 @@ static int tty_reopen(struct tty_struct *tty) | |||
1461 | { | 1452 | { |
1462 | struct tty_driver *driver = tty->driver; | 1453 | struct tty_driver *driver = tty->driver; |
1463 | 1454 | ||
1464 | if (test_bit(TTY_CLOSING, &tty->flags) || | 1455 | if (test_bit(TTY_CLOSING, &tty->flags)) |
1465 | test_bit(TTY_HUPPING, &tty->flags)) | ||
1466 | return -EIO; | 1456 | return -EIO; |
1467 | 1457 | ||
1468 | if (driver->type == TTY_DRIVER_TYPE_PTY && | 1458 | if (driver->type == TTY_DRIVER_TYPE_PTY && |
diff --git a/drivers/tty/tty_ldisc.c b/drivers/tty/tty_ldisc.c index 28858ebe2912..49001fa2ea2f 100644 --- a/drivers/tty/tty_ldisc.c +++ b/drivers/tty/tty_ldisc.c | |||
@@ -544,8 +544,7 @@ int tty_set_ldisc(struct tty_struct *tty, int ldisc) | |||
544 | 544 | ||
545 | old_ldisc = tty->ldisc; | 545 | old_ldisc = tty->ldisc; |
546 | 546 | ||
547 | if (test_bit(TTY_HUPPING, &tty->flags) || | 547 | if (test_bit(TTY_HUPPED, &tty->flags)) { |
548 | test_bit(TTY_HUPPED, &tty->flags)) { | ||
549 | /* We were raced by the hangup method. It will have stomped | 548 | /* We were raced by the hangup method. It will have stomped |
550 | the ldisc data and closed the ldisc down */ | 549 | the ldisc data and closed the ldisc down */ |
551 | tty_ldisc_enable_pair(tty, o_tty); | 550 | tty_ldisc_enable_pair(tty, o_tty); |
diff --git a/include/linux/tty.h b/include/linux/tty.h index b36b0b445c1f..ff0dd7aeaf3b 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -321,7 +321,6 @@ struct tty_file_private { | |||
321 | #define TTY_PTY_LOCK 16 /* pty private */ | 321 | #define TTY_PTY_LOCK 16 /* pty private */ |
322 | #define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ | 322 | #define TTY_NO_WRITE_SPLIT 17 /* Preserve write boundaries to driver */ |
323 | #define TTY_HUPPED 18 /* Post driver->hangup() */ | 323 | #define TTY_HUPPED 18 /* Post driver->hangup() */ |
324 | #define TTY_HUPPING 21 /* ->hangup() in progress */ | ||
325 | #define TTY_LDISC_HALTED 22 /* Line discipline is halted */ | 324 | #define TTY_LDISC_HALTED 22 /* Line discipline is halted */ |
326 | 325 | ||
327 | #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) | 326 | #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty)) |