From: Greg Kroah-Hartman Date: Thu, 6 Nov 2014 03:43:23 +0000 (-0800) Subject: Merge branch 'tty-linus' into 'tty-testing' X-Git-Url: http://drtracing.org/?a=commitdiff_plain;h=28e1445c650035668514df6f446c81f89990ac52;p=deliverable%2Flinux.git Merge branch 'tty-linus' into 'tty-testing' We need the fixes in drivers/tty/tty_io.c that were done in there for future patches in this branch. Signed-off-by: Greg Kroah-Hartman --- 28e1445c650035668514df6f446c81f89990ac52 diff --cc drivers/tty/tty_io.c index aa83cd1bf071,0508a1d8e4cd..4bd48f79b94b --- a/drivers/tty/tty_io.c +++ b/drivers/tty/tty_io.c @@@ -1759,10 -1705,12 +1759,12 @@@ static int tty_release_checks(struct tt int tty_release(struct inode *inode, struct file *filp) { struct tty_struct *tty = file_tty(filp); - struct tty_struct *o_tty; - int pty_master, tty_closing, o_tty_closing, do_sleep; + struct tty_struct *o_tty = NULL; + int do_sleep, final; int idx; char buf[64]; + long timeout = 0; + int once = 1; if (tty_paranoia_check(tty, inode, __func__)) return 0; @@@ -1832,12 -1791,29 +1834,19 @@@ if (!do_sleep) break; - printk(KERN_WARNING "%s: %s: read/write wait queue active!\n", - __func__, tty_name(tty, buf)); - schedule(); + if (once) { + once = 0; + printk(KERN_WARNING "%s: %s: read/write wait queue active!\n", + __func__, tty_name(tty, buf)); + } - tty_unlock_pair(tty, o_tty); - mutex_unlock(&tty_mutex); + schedule_timeout_killable(timeout); + if (timeout < 120 * HZ) + timeout = 2 * timeout + 1; + else + timeout = MAX_SCHEDULE_TIMEOUT; } - /* - * The closing flags are now consistent with the open counts on - * both sides, and we've completed the last operation that could - * block, so it's safe to proceed with closing. - * - * We must *not* drop the tty_mutex until we ensure that a further - * entry into tty_open can not pick up this tty. - */ - if (pty_master) { + if (o_tty) { if (--o_tty->count < 0) { printk(KERN_WARNING "%s: bad pty slave count (%d) for %s\n", __func__, o_tty->count, tty_name(o_tty, buf));