diff options
author | Peter Hurley <peter@hurleysoftware.com> | 2014-11-05 12:12:53 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2014-11-05 21:30:43 -0500 |
commit | 0911261d4cb614ef6900cd2906be2c61a87f43ff (patch) | |
tree | 0d69b4db079286579460737708fbe732f032a24b | |
parent | 04980706c8febe41ec598116b174bd3a2dc82355 (diff) |
tty: Don't take tty_mutex for tty count changes
Holding tty_mutex is no longer required to serialize changes to
the tty_count or to prevent concurrent opens of closing ttys;
tty_lock() is sufficient.
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 | 6 |
1 files changed, 0 insertions, 6 deletions
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c index ea8c6cae8d12..e59de81c39a9 100644 --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c | |||
@@ -1804,10 +1804,6 @@ int tty_release(struct inode *inode, struct file *filp) | |||
1804 | * each iteration we avoid any problems. | 1804 | * each iteration we avoid any problems. |
1805 | */ | 1805 | */ |
1806 | while (1) { | 1806 | while (1) { |
1807 | /* Guard against races with tty->count changes elsewhere and | ||
1808 | opens on /dev/tty */ | ||
1809 | |||
1810 | mutex_lock(&tty_mutex); | ||
1811 | tty_lock_pair(tty, o_tty); | 1807 | tty_lock_pair(tty, o_tty); |
1812 | tty_closing = tty->count <= 1; | 1808 | tty_closing = tty->count <= 1; |
1813 | o_tty_closing = o_tty && | 1809 | o_tty_closing = o_tty && |
@@ -1840,7 +1836,6 @@ int tty_release(struct inode *inode, struct file *filp) | |||
1840 | printk(KERN_WARNING "%s: %s: read/write wait queue active!\n", | 1836 | printk(KERN_WARNING "%s: %s: read/write wait queue active!\n", |
1841 | __func__, tty_name(tty, buf)); | 1837 | __func__, tty_name(tty, buf)); |
1842 | tty_unlock_pair(tty, o_tty); | 1838 | tty_unlock_pair(tty, o_tty); |
1843 | mutex_unlock(&tty_mutex); | ||
1844 | schedule(); | 1839 | schedule(); |
1845 | } | 1840 | } |
1846 | 1841 | ||
@@ -1891,7 +1886,6 @@ int tty_release(struct inode *inode, struct file *filp) | |||
1891 | read_unlock(&tasklist_lock); | 1886 | read_unlock(&tasklist_lock); |
1892 | } | 1887 | } |
1893 | 1888 | ||
1894 | mutex_unlock(&tty_mutex); | ||
1895 | tty_unlock_pair(tty, o_tty); | 1889 | tty_unlock_pair(tty, o_tty); |
1896 | /* At this point, the tty->count == 0 should ensure a dead tty | 1890 | /* At this point, the tty->count == 0 should ensure a dead tty |
1897 | cannot be re-opened by a racing opener */ | 1891 | cannot be re-opened by a racing opener */ |