From: Arnd Bergmann <arnd@arndb.de>
To: LKML <linux-kernel@vger.kernel.org>
Cc: Alan Cox <alan@lxorguk.ukuu.org.uk>, Greg KH <gregkh@suse.de>,
Frederic Weisbecker <fweisbec@gmail.com>,
Thomas Gleixner <tglx@linutronix.de>,
Andrew Morton <akpm@linux-foundation.org>,
John Kacur <jkacur@redhat.com>, Al Viro <viro@zeniv.linux.org.uk>,
Ingo Molnar <mingo@elte.hu>, Arnd Bergmann <arnd@arndb.de>
Subject: [RFC 7/9] ppp: use big tty mutex
Date: Tue, 30 Mar 2010 22:56:18 +0200 [thread overview]
Message-ID: <1269982580-9361-8-git-send-email-arnd@arndb.de> (raw)
In-Reply-To: <1269982580-9361-1-git-send-email-arnd@arndb.de>
ppp interacts with the tty layer, so it should
take the BTM instead of the BKL.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/net/ppp_generic.c | 29 +++++++++++++++--------------
1 files changed, 15 insertions(+), 14 deletions(-)
diff --git a/drivers/net/ppp_generic.c b/drivers/net/ppp_generic.c
index 6d61602..bc89a1b 100644
--- a/drivers/net/ppp_generic.c
+++ b/drivers/net/ppp_generic.c
@@ -40,7 +40,7 @@
#include <linux/if_arp.h>
#include <linux/ip.h>
#include <linux/tcp.h>
-#include <linux/smp_lock.h>
+#include <linux/tty.h>
#include <linux/spinlock.h>
#include <linux/rwsem.h>
#include <linux/stddef.h>
@@ -362,7 +362,8 @@ static const int npindex_to_ethertype[NUM_NP] = {
*/
static int ppp_open(struct inode *inode, struct file *file)
{
- cycle_kernel_lock();
+ tty_lock();
+ tty_unlock();
/*
* This could (should?) be enforced by the permissions on /dev/ppp.
*/
@@ -584,7 +585,7 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
* this fd and reopening /dev/ppp.
*/
err = -EINVAL;
- lock_kernel();
+ tty_lock();
if (pf->kind == INTERFACE) {
ppp = PF_TO_PPP(pf);
if (file == ppp->owner)
@@ -596,7 +597,7 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
} else
printk(KERN_DEBUG "PPPIOCDETACH file->f_count=%ld\n",
atomic_long_read(&file->f_count));
- unlock_kernel();
+ tty_unlock();
return err;
}
@@ -604,7 +605,7 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
struct channel *pch;
struct ppp_channel *chan;
- lock_kernel();
+ tty_lock();
pch = PF_TO_CHANNEL(pf);
switch (cmd) {
@@ -626,7 +627,7 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
err = chan->ops->ioctl(chan, cmd, arg);
up_read(&pch->chan_sem);
}
- unlock_kernel();
+ tty_unlock();
return err;
}
@@ -636,7 +637,7 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
return -EINVAL;
}
- lock_kernel();
+ tty_lock();
ppp = PF_TO_PPP(pf);
switch (cmd) {
case PPPIOCSMRU:
@@ -784,7 +785,7 @@ static long ppp_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
default:
err = -ENOTTY;
}
- unlock_kernel();
+ tty_unlock();
return err;
}
@@ -797,7 +798,7 @@ static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf,
struct ppp_net *pn;
int __user *p = (int __user *)arg;
- lock_kernel();
+ tty_lock();
switch (cmd) {
case PPPIOCNEWUNIT:
/* Create a new ppp unit */
@@ -820,7 +821,7 @@ static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf,
break;
err = -ENXIO;
pn = ppp_pernet(net);
- mutex_lock(&pn->all_ppp_mutex);
+ mutex_lock_tty_on(&pn->all_ppp_mutex);
ppp = ppp_find_unit(pn, unit);
if (ppp) {
atomic_inc(&ppp->file.refcnt);
@@ -848,7 +849,7 @@ static int ppp_unattached_ioctl(struct net *net, struct ppp_file *pf,
default:
err = -ENOTTY;
}
- unlock_kernel();
+ tty_unlock();
return err;
}
@@ -2553,7 +2554,7 @@ ppp_create_interface(struct net *net, int unit, int *retp)
dev_net_set(dev, net);
ret = -EEXIST;
- mutex_lock(&pn->all_ppp_mutex);
+ mutex_lock_tty_on(&pn->all_ppp_mutex);
if (unit < 0) {
unit = unit_get(&pn->units_idr, ppp);
@@ -2628,7 +2629,7 @@ static void ppp_shutdown_interface(struct ppp *ppp)
struct ppp_net *pn;
pn = ppp_pernet(ppp->ppp_net);
- mutex_lock(&pn->all_ppp_mutex);
+ mutex_lock_tty(&pn->all_ppp_mutex);
/* This will call dev_close() for us. */
ppp_lock(ppp);
@@ -2737,7 +2738,7 @@ ppp_connect_channel(struct channel *pch, int unit)
pn = ppp_pernet(pch->chan_net);
- mutex_lock(&pn->all_ppp_mutex);
+ mutex_lock_tty_on(&pn->all_ppp_mutex);
ppp = ppp_find_unit(pn, unit);
if (!ppp)
goto out;
--
1.7.0
next prev parent reply other threads:[~2010-03-30 20:57 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-03-30 20:56 [RFC 0/9] BKL conversion in TTY drivers Arnd Bergmann
2010-03-30 20:56 ` [RFC 1/9] tty: replace BKL with a new tty_lock Arnd Bergmann
2010-03-30 22:23 ` Frederic Weisbecker
2010-03-30 20:56 ` [RFC 2/9] tty: make atomic_write_lock release tty_lock Arnd Bergmann
2010-03-30 20:56 ` [RFC 3/9] tty: make tty_port->mutex nest under tty_lock Arnd Bergmann
2010-03-30 20:56 ` [RFC 4/9] tty: make termios mutex " Arnd Bergmann
2010-03-30 20:56 ` [RFC 5/9] tty: make ldisc_mutex " Arnd Bergmann
2010-03-30 20:56 ` [RFC 6/9] tty: never hold tty_lock() while getting tty_mutex Arnd Bergmann
2010-03-30 20:56 ` Arnd Bergmann [this message]
2010-03-31 4:37 ` [RFC 7/9] ppp: use big tty mutex Américo Wang
2010-03-31 7:39 ` Arnd Bergmann
2010-03-30 20:56 ` [RFC 8/9] tty: release tty lock when blocking Arnd Bergmann
2010-03-30 20:56 ` [RFC 9/9] tty: implement BTM as mutex instead of BKL Arnd Bergmann
2010-03-30 22:50 ` Frederic Weisbecker
2010-03-30 22:37 ` [RFC 0/9] BKL conversion in TTY drivers Alan Cox
2010-03-31 7:57 ` Arnd Bergmann
2010-03-31 10:02 ` Alan Cox
2010-04-01 12:51 ` Arnd Bergmann
2010-04-01 14:17 ` Alan Cox
2010-04-01 15:24 ` Greg KH
2010-04-01 19:10 ` Arnd Bergmann
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=1269982580-9361-8-git-send-email-arnd@arndb.de \
--to=arnd@arndb.de \
--cc=akpm@linux-foundation.org \
--cc=alan@lxorguk.ukuu.org.uk \
--cc=fweisbec@gmail.com \
--cc=gregkh@suse.de \
--cc=jkacur@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@elte.hu \
--cc=tglx@linutronix.de \
--cc=viro@zeniv.linux.org.uk \
/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
all inboxes | Powered by JetHome®