From patchwork Wed Sep 14 18:53:34 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Eric W. Biederman" X-Patchwork-Id: 9332309 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 78C75607FD for ; Wed, 14 Sep 2016 19:08:53 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65BB229F99 for ; Wed, 14 Sep 2016 19:08:53 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A82A2A256; Wed, 14 Sep 2016 19:08:53 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0533B29F99 for ; Wed, 14 Sep 2016 19:08:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1764425AbcINTIv (ORCPT ); Wed, 14 Sep 2016 15:08:51 -0400 Received: from out03.mta.xmission.com ([166.70.13.233]:54667 "EHLO out03.mta.xmission.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1762523AbcINTHj (ORCPT ); Wed, 14 Sep 2016 15:07:39 -0400 Received: from in01.mta.xmission.com ([166.70.13.51]) by out03.mta.xmission.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1bkFWz-00047e-T2; Wed, 14 Sep 2016 13:07:38 -0600 Received: from 97-119-97-64.omah.qwest.net ([97.119.97.64] helo=x220.int.ebiederm.org) by in01.mta.xmission.com with esmtpsa (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.87) (envelope-from ) id 1bkFWz-0000r5-1V; Wed, 14 Sep 2016 13:07:37 -0600 From: "Eric W. Biederman" To: Greg Kroah-Hartman , Jiri Slaby Cc: "H. Peter Anvin" , linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org, Linux Containers , "Eric W. Biederman" Date: Wed, 14 Sep 2016 13:53:34 -0500 Message-Id: <20160914185338.15126-2-ebiederm@xmission.com> X-Mailer: git-send-email 2.8.3 In-Reply-To: <20160914185338.15126-1-ebiederm@xmission.com> References: <87sht25n73.fsf@x220.int.ebiederm.org> <20160914185338.15126-1-ebiederm@xmission.com> X-XM-SPF: eid=1bkFWz-0000r5-1V; ; ; mid=<20160914185338.15126-2-ebiederm@xmission.com>; ; ; hst=in01.mta.xmission.com; ; ; ip=97.119.97.64; ; ; frm=ebiederm@xmission.com; ; ; spf=neutral X-XM-AID: U2FsdGVkX1/x5/on8SbLxL8ELnfPbgfc4Y99MpPOo3U= X-SA-Exim-Connect-IP: 97.119.97.64 X-SA-Exim-Mail-From: ebiederm@xmission.com Subject: [PATCH tty-next 2/6] devpts: Move the creation of /dev/pts/ptmx into fill_super X-SA-Exim-Version: 4.2.1 (built Thu, 05 May 2016 13:38:54 -0600) X-SA-Exim-Scanned: Yes (on in01.mta.xmission.com) Sender: linux-fsdevel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fsdevel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP The code makes more sense here and things are just clearer. Signed-off-by: "Eric W. Biederman" --- fs/devpts/inode.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index c59d39f2d512..43773543a783 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -425,11 +425,19 @@ devpts_fill_super(struct super_block *s, void *data, int silent) set_nlink(inode, 2); s->s_root = d_make_root(inode); - if (s->s_root) - return 0; + if (!s->s_root) { + pr_err("get root dentry failed\n"); + goto fail; + } - pr_err("get root dentry failed\n"); + error = mknod_ptmx(s); + if (error) + goto fail_dput; + return 0; +fail_dput: + dput(s->s_root); + s->s_root = NULL; fail: return error; } @@ -456,11 +464,6 @@ static struct dentry *devpts_mount(struct file_system_type *fs_type, goto out_undo_sget; s->s_flags |= MS_ACTIVE; } - - error = mknod_ptmx(s); - if (error) - goto out_undo_sget; - return dget(s->s_root); out_undo_sget: