diff options
author | Jiri Slaby <jslaby@suse.cz> | 2011-08-25 09:12:06 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2011-08-25 12:00:40 -0400 |
commit | a57a7bf3fc7eff00f07eb9c805774d911a3f2472 (patch) | |
tree | e69628dba2da099c90bdff8bac4644d2f76b3e4b /include/linux/tty.h | |
parent | bafb0bd24d7e0e0124318625b239a55d58c757a2 (diff) |
TTY: define tty_wait_until_sent_from_close
We need this helper to fix system stalls. The issue is that the rest
of the system TTYs wait for us to finish waiting. This wasn't an issue
with BKL. BKL used to unlock implicitly.
This is based on the Arnd suggestion.
Signed-off-by: Jiri Slaby <jslaby@suse.cz>
Acked-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'include/linux/tty.h')
-rw-r--r-- | include/linux/tty.h | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/include/linux/tty.h b/include/linux/tty.h index 6d5eceb165be..0ad68889fc1a 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h | |||
@@ -602,6 +602,24 @@ extern void __lockfunc tty_lock(void) __acquires(tty_lock); | |||
602 | extern void __lockfunc tty_unlock(void) __releases(tty_lock); | 602 | extern void __lockfunc tty_unlock(void) __releases(tty_lock); |
603 | 603 | ||
604 | /* | 604 | /* |
605 | * this shall be called only from where BTM is held (like close) | ||
606 | * | ||
607 | * We need this to ensure nobody waits for us to finish while we are waiting. | ||
608 | * Without this we were encountering system stalls. | ||
609 | * | ||
610 | * This should be indeed removed with BTM removal later. | ||
611 | * | ||
612 | * Locking: BTM required. Nobody is allowed to hold port->mutex. | ||
613 | */ | ||
614 | static inline void tty_wait_until_sent_from_close(struct tty_struct *tty, | ||
615 | long timeout) | ||
616 | { | ||
617 | tty_unlock(); /* tty->ops->close holds the BTM, drop it while waiting */ | ||
618 | tty_wait_until_sent(tty, timeout); | ||
619 | tty_lock(); | ||
620 | } | ||
621 | |||
622 | /* | ||
605 | * wait_event_interruptible_tty -- wait for a condition with the tty lock held | 623 | * wait_event_interruptible_tty -- wait for a condition with the tty lock held |
606 | * | 624 | * |
607 | * The condition we are waiting for might take a long time to | 625 | * The condition we are waiting for might take a long time to |