linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jiri Slaby <jslaby@suse.cz>
To: gregkh@suse.de
Cc: linux-kernel@vger.kernel.org, alan@linux.intel.com, jirislaby@gmail.com
Subject: [PATCH 5/5] TTY: get rid of BTM around devpts_*
Date: Mon, 30 Jan 2012 21:14:32 +0100	[thread overview]
Message-ID: <1327954472-26594-5-git-send-email-jslaby@suse.cz> (raw)
In-Reply-To: <1327954472-26594-1-git-send-email-jslaby@suse.cz>

devpts operations are protected by inode mutexes and dentry
refcounting. There is no need to hold BTM.

Signed-off-by: Jiri Slaby <jslaby@suse.cz>
---
 drivers/tty/pty.c    |    6 ++----
 drivers/tty/tty_io.c |    2 +-
 2 files changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/tty/pty.c b/drivers/tty/pty.c
index ddec9f3..39afd04 100644
--- a/drivers/tty/pty.c
+++ b/drivers/tty/pty.c
@@ -54,8 +54,8 @@ static void pty_close(struct tty_struct *tty, struct file *filp)
 	wake_up_interruptible(&tty->link->write_wait);
 	if (tty->driver->subtype == PTY_TYPE_MASTER) {
 		set_bit(TTY_OTHER_CLOSED, &tty->flags);
-		devpts_pty_kill(tty->link);
 		tty_unlock();
+		devpts_pty_kill(tty->link);
 		tty_vhangup(tty->link);
 		tty_lock();
 	}
@@ -613,9 +613,7 @@ static int ptmx_open(struct inode *inode, struct file *filp)
 		return retval;
 
 	/* find a device that is not in use. */
-	tty_lock();
 	index = devpts_new_index(inode);
-	tty_unlock();
 	if (index < 0) {
 		retval = index;
 		goto err_file;
@@ -650,8 +648,8 @@ err_release:
 	tty_release(inode, filp);
 	return retval;
 out:
-	devpts_kill_index(inode, index);
 	tty_unlock();
+	devpts_kill_index(inode, index);
 err_file:
 	tty_free_file(filp);
 	return retval;
diff --git a/drivers/tty/tty_io.c b/drivers/tty/tty_io.c
index 44736f9..ea7ebe2 100644
--- a/drivers/tty/tty_io.c
+++ b/drivers/tty/tty_io.c
@@ -1789,11 +1789,11 @@ int tty_release(struct inode *inode, struct file *filp)
 	 * the slots and preserving the termios structure.
 	 */
 	release_tty(tty, idx);
+	tty_unlock();
 
 	/* Make this pty number available for reallocation */
 	if (devpts)
 		devpts_kill_index(inode, idx);
-	tty_unlock();
 	return 0;
 }
 
-- 
1.7.8.3



  parent reply	other threads:[~2012-01-30 20:21 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-01-30 20:14 [PATCH 1/5] TTY: provide tty_standard_install helper Jiri Slaby
2012-01-30 20:14 ` [PATCH 2/5] USB: serial, use tty_standard_install Jiri Slaby
2012-01-30 20:14 ` [PATCH 3/5] TTY: " Jiri Slaby
2012-01-30 20:37   ` Alan Cox
2012-02-01  9:40   ` Jiri Slaby
2012-02-01  9:52     ` Jiri Slaby
2012-02-02 23:05   ` Greg KH
2012-02-02 23:23     ` Jiri Slaby
2012-02-02 23:49       ` Greg KH
2012-01-30 20:14 ` [PATCH 4/5] TTY: pty, remove superfluous ptm test Jiri Slaby
2012-01-30 20:37   ` Alan Cox
2012-01-30 20:14 ` Jiri Slaby [this message]
2012-01-30 20:36 ` [PATCH 1/5] TTY: provide tty_standard_install helper Alan Cox

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=1327954472-26594-5-git-send-email-jslaby@suse.cz \
    --to=jslaby@suse.cz \
    --cc=alan@linux.intel.com \
    --cc=gregkh@suse.de \
    --cc=jirislaby@gmail.com \
    --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;
as well as URLs for NNTP newsgroup(s).