Merge branch 'tty-linus' into 'tty-testing'
authorGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Nov 2014 03:43:23 +0000 (19:43 -0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Nov 2014 03:43:23 +0000 (19:43 -0800)
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 <gregkh@linuxfoundation.org>
1  2 
drivers/tty/serial/serial_core.c
drivers/tty/tty_io.c

Simple merge
index aa83cd1bf07161c95dd1ea9f46cce878129f3589,0508a1d8e4cd73a7b679f9cc70d2e19f0716b69a..4bd48f79b94bd0bc9f2e8a409dfecf308f0e59b2
@@@ -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;
                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));