tty: Prevent "read/write wait queue active!" log flooding
authorPeter Hurley <peter@hurleysoftware.com>
Thu, 16 Oct 2014 17:54:36 +0000 (13:54 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 6 Nov 2014 00:14:09 +0000 (16:14 -0800)
Only print one warning when a task is on the read_wait or write_wait
wait queue at final tty release.

Cc: <stable@vger.kernel.org> # 3.4.x+
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/tty/tty_io.c

index 4021c10d99080dc42f5012e874a51db067e310ad..0508a1d8e4cd73a7b679f9cc70d2e19f0716b69a 100644 (file)
@@ -1710,6 +1710,7 @@ int tty_release(struct inode *inode, struct file *filp)
        int     idx;
        char    buf[64];
        long    timeout = 0;
+       int     once = 1;
 
        if (tty_paranoia_check(tty, inode, __func__))
                return 0;
@@ -1790,8 +1791,11 @@ int tty_release(struct inode *inode, struct file *filp)
                if (!do_sleep)
                        break;
 
-               printk(KERN_WARNING "%s: %s: read/write wait queue active!\n",
-                               __func__, tty_name(tty, buf));
+               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);