From: Peter Hurley <peter@hurleysoftware.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: linux-kernel@vger.kernel.org,
Linus Torvalds <torvalds@linux-foundation.org>,
Mikael Pettersson <mikpelinux@gmail.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-serial@vger.kernel.org,
Peter Hurley <peter@hurleysoftware.com>,
stable@kernel.org
Subject: [PATCH] n_tty: Ensure reader restarts worker for next reader
Date: Thu, 7 Nov 2013 13:59:46 -0500 [thread overview]
Message-ID: <1383850796-24300-1-git-send-email-peter@hurleysoftware.com> (raw)
In-Reply-To: <20131017211236.GA6155@kroah.com>
A departing reader must restart a flush_to_ldisc() worker _before_
the next reader enters the read loop; this is to avoid the new reader
concluding no more i/o is available and prematurely exiting, when the
old reader simply hasn't re-started the worker yet.
Cc: stable@kernel.org # 3.12
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
drivers/tty/n_tty.c | 5 +++--
1 file changed, 3 insertions(+), 2 deletions(-)
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index 7a744b6..ce11cd5 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -2250,6 +2250,9 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
if (time)
timeout = time;
}
+ n_tty_set_room(tty);
+ up_read(&tty->termios_rwsem);
+
mutex_unlock(&ldata->atomic_read_lock);
remove_wait_queue(&tty->read_wait, &wait);
@@ -2260,8 +2263,6 @@ static ssize_t n_tty_read(struct tty_struct *tty, struct file *file,
if (b - buf)
retval = b - buf;
- n_tty_set_room(tty);
- up_read(&tty->termios_rwsem);
return retval;
}
--
1.8.1.2
next prev parent reply other threads:[~2013-11-07 19:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-10-05 17:34 [GIT PATCH] TTY/Serial fixes for 3.12-rc4 Greg KH
2013-10-05 18:53 ` Linus Torvalds
2013-10-05 23:57 ` Peter Hurley
2013-10-06 2:11 ` Peter Hurley
2013-10-17 21:12 ` Greg KH
2013-10-23 13:16 ` Peter Hurley
2013-11-07 18:59 ` Peter Hurley [this message]
2013-11-07 20:01 ` [PATCH] n_tty: Ensure reader restarts worker for next reader Peter Hurley
2013-11-20 0:21 ` Linus Torvalds
2013-11-20 0:30 ` Greg Kroah-Hartman
2013-11-20 0:43 ` Linus Torvalds
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1383850796-24300-1-git-send-email-peter@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=akpm@linux-foundation.org \
--cc=gregkh@linuxfoundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=mikpelinux@gmail.com \
--cc=stable@kernel.org \
--cc=torvalds@linux-foundation.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).