tty: Revert the tty locking series, it needs more work
This reverts the tty layer change to use per-tty locking, because it's not correct yet, and fixing it will require some more deep surgery. The main revert isd29f3ef39b
("tty_lock: Localise the lock"), but there are several smaller commits that built upon it, they also get reverted here. The list of reverted commits is:fde86d3108
- tty: add lockdep annotations8f6576ad47
- tty: fix ldisc lock inversion traced3ca8b64b9
- pty: Fix lock inversionb1d679afd7
- tty: drop the pty lock during hangupabcefe5fc3
- tty/amiserial: Add missing argument for tty_unlock()fd11b42e35
- cris: fix missing tty arg in wait_event_interruptible_tty calld29f3ef39b
- tty_lock: Localise the lock The revert had a trivial conflict in the 68360serial.c staging driver that got removed in the meantime. Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
このコミットが含まれているのは:
@@ -4,70 +4,29 @@
|
||||
#include <linux/semaphore.h>
|
||||
#include <linux/sched.h>
|
||||
|
||||
/* Legacy tty mutex glue */
|
||||
|
||||
enum {
|
||||
TTY_MUTEX_NORMAL,
|
||||
TTY_MUTEX_NESTED,
|
||||
};
|
||||
/*
|
||||
* The 'big tty mutex'
|
||||
*
|
||||
* This mutex is taken and released by tty_lock() and tty_unlock(),
|
||||
* replacing the older big kernel lock.
|
||||
* It can no longer be taken recursively, and does not get
|
||||
* released implicitly while sleeping.
|
||||
*
|
||||
* Don't use in new code.
|
||||
*/
|
||||
static DEFINE_MUTEX(big_tty_mutex);
|
||||
|
||||
/*
|
||||
* Getting the big tty mutex.
|
||||
*/
|
||||
|
||||
static void __lockfunc tty_lock_nested(struct tty_struct *tty,
|
||||
unsigned int subclass)
|
||||
void __lockfunc tty_lock(void)
|
||||
{
|
||||
if (tty->magic != TTY_MAGIC) {
|
||||
printk(KERN_ERR "L Bad %p\n", tty);
|
||||
WARN_ON(1);
|
||||
return;
|
||||
}
|
||||
tty_kref_get(tty);
|
||||
mutex_lock_nested(&tty->legacy_mutex, subclass);
|
||||
}
|
||||
|
||||
void __lockfunc tty_lock(struct tty_struct *tty)
|
||||
{
|
||||
return tty_lock_nested(tty, TTY_MUTEX_NORMAL);
|
||||
mutex_lock(&big_tty_mutex);
|
||||
}
|
||||
EXPORT_SYMBOL(tty_lock);
|
||||
|
||||
void __lockfunc tty_unlock(struct tty_struct *tty)
|
||||
void __lockfunc tty_unlock(void)
|
||||
{
|
||||
if (tty->magic != TTY_MAGIC) {
|
||||
printk(KERN_ERR "U Bad %p\n", tty);
|
||||
WARN_ON(1);
|
||||
return;
|
||||
}
|
||||
mutex_unlock(&tty->legacy_mutex);
|
||||
tty_kref_put(tty);
|
||||
mutex_unlock(&big_tty_mutex);
|
||||
}
|
||||
EXPORT_SYMBOL(tty_unlock);
|
||||
|
||||
/*
|
||||
* Getting the big tty mutex for a pair of ttys with lock ordering
|
||||
* On a non pty/tty pair tty2 can be NULL which is just fine.
|
||||
*/
|
||||
void __lockfunc tty_lock_pair(struct tty_struct *tty,
|
||||
struct tty_struct *tty2)
|
||||
{
|
||||
if (tty < tty2) {
|
||||
tty_lock(tty);
|
||||
tty_lock_nested(tty2, TTY_MUTEX_NESTED);
|
||||
} else {
|
||||
if (tty2 && tty2 != tty)
|
||||
tty_lock(tty2);
|
||||
tty_lock_nested(tty, TTY_MUTEX_NESTED);
|
||||
}
|
||||
}
|
||||
EXPORT_SYMBOL(tty_lock_pair);
|
||||
|
||||
void __lockfunc tty_unlock_pair(struct tty_struct *tty,
|
||||
struct tty_struct *tty2)
|
||||
{
|
||||
tty_unlock(tty);
|
||||
if (tty2 && tty2 != tty)
|
||||
tty_unlock(tty2);
|
||||
}
|
||||
EXPORT_SYMBOL(tty_unlock_pair);
|
||||
|
新しいイシューから参照
ユーザーをブロックする