From 9c1729db3e6d738f872bcb090212af00473bf666 Mon Sep 17 00:00:00 2001 From: Alan Cox Date: Sun, 15 Jul 2007 23:39:43 -0700 Subject: Prevent an O_NDELAY writer from blocking when a tty write is blocked by the tty atomic writer mutex Without this a tty write could block if a previous blocking tty write was in progress on the same tty and blocked by a line discipline or hardware event. Originally found and reported by Dave Johnson. Signed-off-by: Alan Cox Acked-by: Dave Johnson Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- include/linux/tty.h | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'include') diff --git a/include/linux/tty.h b/include/linux/tty.h index bb4576085203..deaba9ec5004 100644 --- a/include/linux/tty.h +++ b/include/linux/tty.h @@ -338,6 +338,12 @@ extern struct tty_struct *get_current_tty(void); extern struct mutex tty_mutex; +extern void tty_write_unlock(struct tty_struct *tty); +extern int tty_write_lock(struct tty_struct *tty, int ndelay); +#define tty_is_writelocked(tty) (mutex_is_locked(&tty->atomic_write_lock)) + + + /* n_tty.c */ extern struct tty_ldisc tty_ldisc_N_TTY; -- cgit v1.2.3-59-g8ed1b