From: Peter Hurley <peter@hurleysoftware.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: Jiri Slaby <jslaby@suse.cz>,
linux-kernel@vger.kernel.org,
Peter Hurley <peter@hurleysoftware.com>
Subject: [PATCH v2 2/7] tty, n_tty: Remove fasync() ldisc notification
Date: Sat, 9 Jan 2016 21:45:09 -0800 [thread overview]
Message-ID: <1452404714-9295-3-git-send-email-peter@hurleysoftware.com> (raw)
In-Reply-To: <1452404714-9295-1-git-send-email-peter@hurleysoftware.com>
Only the N_TTY line discipline implements the signal-driven i/o
notification enabled/disabled by fcntl(F_SETFL, O_ASYNC). The ldisc
fasync() notification is sent to the ldisc when the enable state has
changed (the tty core is notified via the fasync() VFS file operation).
The N_TTY line discipline used the enable state to change the wakeup
condition (minimum_to_wake = 1) for notifying the signal handler i/o is
available. However, just the presence of data is sufficient and necessary
to signal i/o is available, so changing minimum_to_wake is unnecessary
(and creates a race condition with read() and poll() which may be
concurrently updating minimum_to_wake).
Furthermore, since the kill_fasync() VFS helper performs no action if
the fasync list is empty, calling unconditionally is preferred; if
signal driven i/o just has been disabled, no signal will be sent by
kill_fasync() anyway so notification of the change via the ldisc
fasync() method is superfluous.
Signed-off-by: Peter Hurley <peter@hurleysoftware.com>
---
drivers/tty/n_tty.c | 5 -----
drivers/tty/tty_io.c | 8 --------
include/linux/tty_ldisc.h | 6 ------
3 files changed, 19 deletions(-)
diff --git a/drivers/tty/n_tty.c b/drivers/tty/n_tty.c
index d04f398..a93e4c7 100644
--- a/drivers/tty/n_tty.c
+++ b/drivers/tty/n_tty.c
@@ -2448,10 +2448,6 @@ static int n_tty_ioctl(struct tty_struct *tty, struct file *file,
}
}
-static void n_tty_fasync(struct tty_struct *tty, int on)
-{
-}
-
static struct tty_ldisc_ops n_tty_ops = {
.magic = TTY_LDISC_MAGIC,
.name = "n_tty",
@@ -2465,7 +2461,6 @@ static struct tty_ldisc_ops n_tty_ops = {
.poll = n_tty_poll,
.receive_buf = n_tty_receive_buf,
.write_wakeup = n_tty_write_wakeup,
- .fasync = n_tty_fasync,
.receive_buf2 = n_tty_receive_buf2,
};
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 48281a5..e8b431e 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -2219,7 +2219,6 @@ static unsigned int tty_poll(struct file *filp, poll_table *wait)
static int __tty_fasync(int fd, struct file *filp, int on)
{
struct tty_struct *tty = file_tty(filp);
- struct tty_ldisc *ldisc;
unsigned long flags;
int retval = 0;
@@ -2230,13 +2229,6 @@ static int __tty_fasync(int fd, struct file *filp, int on)
if (retval <= 0)
goto out;
- ldisc = tty_ldisc_ref(tty);
- if (ldisc) {
- if (ldisc->ops->fasync)
- ldisc->ops->fasync(tty, on);
- tty_ldisc_deref(ldisc);
- }
-
if (on) {
enum pid_type type;
struct pid *pid;
diff --git a/include/linux/tty_ldisc.h b/include/linux/tty_ldisc.h
index 6101ab8..3971cf0 100644
--- a/include/linux/tty_ldisc.h
+++ b/include/linux/tty_ldisc.h
@@ -98,11 +98,6 @@
* seek to perform this action quickly but should wait until
* any pending driver I/O is completed.
*
- * void (*fasync)(struct tty_struct *, int on)
- *
- * Notify line discipline when signal-driven I/O is enabled or
- * disabled.
- *
* void (*dcd_change)(struct tty_struct *tty, unsigned int status)
*
* Tells the discipline that the DCD pin has changed its status.
@@ -202,7 +197,6 @@ struct tty_ldisc_ops {
char *fp, int count);
void (*write_wakeup)(struct tty_struct *);
void (*dcd_change)(struct tty_struct *, unsigned int);
- void (*fasync)(struct tty_struct *tty, int on);
int (*receive_buf2)(struct tty_struct *, const unsigned char *cp,
char *fp, int count);
--
2.7.0
next prev parent reply other threads:[~2016-01-10 5:46 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-12 22:16 [PATCH 0/6] More n_tty fixes Peter Hurley
2015-12-12 22:16 ` [PATCH 1/6] n_tty: Always wake up read()/poll() if new input Peter Hurley
2015-12-13 14:49 ` Johannes Stezenbach
2015-12-13 19:53 ` Peter Hurley
2015-12-12 22:16 ` [PATCH 2/6] tty, n_tty: Remove fasync() ldisc notification Peter Hurley
2015-12-12 22:16 ` [PATCH 3/6] tty: Add fasync() hung up file operation Peter Hurley
2015-12-12 22:16 ` [PATCH 4/6] tty: Fix ioctl(FIOASYNC) on hungup file Peter Hurley
2015-12-12 22:16 ` [PATCH 5/6] n_tty: Fix stuck write wakeup Peter Hurley
2015-12-13 15:18 ` Johannes Stezenbach
2015-12-13 18:38 ` Peter Hurley
2015-12-13 19:27 ` Johannes Stezenbach
2015-12-12 22:16 ` [PATCH 6/6] n_tty: Remove tty count checks from unthrottle Peter Hurley
2016-01-10 5:45 ` [PATCH v2 0/7] More n_tty fixes Peter Hurley
2016-01-10 5:45 ` [PATCH v2 1/7] n_tty: Always wake up read()/poll() if new input Peter Hurley
2016-01-10 5:45 ` Peter Hurley [this message]
2016-01-10 5:45 ` [PATCH v2 3/7] tty: Add fasync() hung up file operation Peter Hurley
2016-01-10 5:45 ` [PATCH v2 4/7] tty: Fix ioctl(FIOASYNC) on hungup file Peter Hurley
2016-01-10 5:45 ` [PATCH v2 5/7] n_tty: Fix stuck write wakeup Peter Hurley
2016-01-10 5:45 ` [PATCH v2 6/7] n_tty: Remove tty count checks from unthrottle Peter Hurley
2016-01-10 5:45 ` [PATCH v2 7/7] tty: n_tty: fix SIGIO for output Peter Hurley
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=1452404714-9295-3-git-send-email-peter@hurleysoftware.com \
--to=peter@hurleysoftware.com \
--cc=gregkh@linuxfoundation.org \
--cc=jslaby@suse.cz \
--cc=linux-kernel@vger.kernel.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