Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764211AbYJMJ7J (ORCPT ); Mon, 13 Oct 2008 05:59:09 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1760639AbYJMJnW (ORCPT ); Mon, 13 Oct 2008 05:43:22 -0400 Received: from earthlight.etchedpixels.co.uk ([81.2.110.250]:51010 "EHLO lxorguk.ukuu.org.uk" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1761215AbYJMJnV (ORCPT ); Mon, 13 Oct 2008 05:43:21 -0400 From: Alan Cox Subject: [PATCH 64/80] Simplify devpts_pty_new() To: torvalds@linux-foundation.org, linux-kernel@vger.kernel.org Date: Mon, 13 Oct 2008 10:43:18 +0100 Message-ID: <20081013094313.21645.46319.stgit@localhost.localdomain> In-Reply-To: <20081013092758.21645.2359.stgit@localhost.localdomain> References: <20081013092758.21645.2359.stgit@localhost.localdomain> User-Agent: StGIT/0.14.2 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1676 Lines: 49 From: Sukadev Bhattiprolu devpts_pty_new() is called when setting up a new pty and would not will not have an existing dentry or inode for the pty. So don't bother looking for an existing dentry - just create a new one. Signed-off-by: Sukadev Bhattiprolu Signed-off-by: Alan Cox --- fs/devpts/inode.c | 11 ++++++++--- 1 files changed, 8 insertions(+), 3 deletions(-) diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index b292ed7..50e885f 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -220,6 +220,7 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty) dev_t device = MKDEV(driver->major, driver->minor_start+number); struct dentry *dentry; struct inode *inode = new_inode(devpts_mnt->mnt_sb); + char s[12]; /* We're supposed to be given the slave end of a pty */ BUG_ON(driver->type != TTY_DRIVER_TYPE_PTY); @@ -235,9 +236,13 @@ int devpts_pty_new(struct inode *ptmx_inode, struct tty_struct *tty) init_special_inode(inode, S_IFCHR|config.mode, device); inode->i_private = tty; - dentry = get_node(number); - if (!IS_ERR(dentry) && !dentry->d_inode) { - d_instantiate(dentry, inode); + sprintf(s, "%d", number); + + mutex_lock(&devpts_root->d_inode->i_mutex); + + dentry = d_alloc_name(devpts_root, s); + if (!IS_ERR(dentry)) { + d_add(dentry, inode); fsnotify_create(devpts_root->d_inode, dentry); } -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/