|
@@ -325,6 +325,24 @@ static inline void __tty_ldisc_unlock(struct tty_struct *tty)
|
|
return ldsem_up_write(&tty->ldisc_sem);
|
|
return ldsem_up_write(&tty->ldisc_sem);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+static int __lockfunc
|
|
|
|
+tty_ldisc_lock(struct tty_struct *tty, unsigned long timeout)
|
|
|
|
+{
|
|
|
|
+ int ret;
|
|
|
|
+
|
|
|
|
+ ret = __tty_ldisc_lock(tty, timeout);
|
|
|
|
+ if (!ret)
|
|
|
|
+ return -EBUSY;
|
|
|
|
+ set_bit(TTY_LDISC_HALTED, &tty->flags);
|
|
|
|
+ return 0;
|
|
|
|
+}
|
|
|
|
+
|
|
|
|
+static void tty_ldisc_unlock(struct tty_struct *tty)
|
|
|
|
+{
|
|
|
|
+ clear_bit(TTY_LDISC_HALTED, &tty->flags);
|
|
|
|
+ __tty_ldisc_unlock(tty);
|
|
|
|
+}
|
|
|
|
+
|
|
static int __lockfunc
|
|
static int __lockfunc
|
|
tty_ldisc_lock_pair_timeout(struct tty_struct *tty, struct tty_struct *tty2,
|
|
tty_ldisc_lock_pair_timeout(struct tty_struct *tty, struct tty_struct *tty2,
|
|
unsigned long timeout)
|
|
unsigned long timeout)
|
|
@@ -682,7 +700,7 @@ void tty_ldisc_hangup(struct tty_struct *tty)
|
|
*
|
|
*
|
|
* Avoid racing set_ldisc or tty_ldisc_release
|
|
* Avoid racing set_ldisc or tty_ldisc_release
|
|
*/
|
|
*/
|
|
- tty_ldisc_lock_pair(tty, tty->link);
|
|
|
|
|
|
+ tty_ldisc_lock(tty, MAX_SCHEDULE_TIMEOUT);
|
|
|
|
|
|
if (tty->ldisc) {
|
|
if (tty->ldisc) {
|
|
|
|
|
|
@@ -704,7 +722,7 @@ void tty_ldisc_hangup(struct tty_struct *tty)
|
|
WARN_ON(tty_ldisc_open(tty, tty->ldisc));
|
|
WARN_ON(tty_ldisc_open(tty, tty->ldisc));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- tty_ldisc_enable_pair(tty, tty->link);
|
|
|
|
|
|
+ tty_ldisc_unlock(tty);
|
|
if (reset)
|
|
if (reset)
|
|
tty_reset_termios(tty);
|
|
tty_reset_termios(tty);
|
|
|
|
|