From patchwork Mon Jan 28 17:11:33 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Brauner X-Patchwork-Id: 10784135 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E7651922 for ; Mon, 28 Jan 2019 17:11:56 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CEC092BD33 for ; Mon, 28 Jan 2019 17:11:56 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CCEB32BC68; Mon, 28 Jan 2019 17:11:56 +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=-8.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,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 64B7B2BD17 for ; Mon, 28 Jan 2019 17:11:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732788AbfA1RLu (ORCPT ); Mon, 28 Jan 2019 12:11:50 -0500 Received: from mail-ed1-f67.google.com ([209.85.208.67]:43049 "EHLO mail-ed1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731722AbfA1RLn (ORCPT ); Mon, 28 Jan 2019 12:11:43 -0500 Received: by mail-ed1-f67.google.com with SMTP id f9so13624496eds.10 for ; Mon, 28 Jan 2019 09:11:42 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=brauner.io; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=dqkRLJwycOZaBeHT2bTXLK850dqnbWqpyFavVlWZuKE=; b=DcsLqm07CZbcVI1hVmgbMfjvoa8E48Uv22C85WcucmXu+dy5r0a0BBBfZrpHC07bSy aYUtGoZG6Jv5VfmGTI96kcwSCErmpynwEFYY6y7XVorZaObZuqwVYD7+XOZWDkRjh30c jzRItwHjsWdIsN1ElsxMks52JJBRxFDuxJy4i0VYOjmrdrL8o5oToaSPoGH8ukYXEaGj SaxkQ+gnHBiGvliLv53wzAe57cpqOyCRqksUoO1ZUECZsOaB941adlGCjukOapOa96fi iPrdMrZS9Jbn6eLNKCaK7Cmdl7gGJcorQOVa4MZRyLKQM9D+88axQfusR6UjW/8PyHBR 2L3g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=dqkRLJwycOZaBeHT2bTXLK850dqnbWqpyFavVlWZuKE=; b=mijVcGrg9KbGROMjMEqUec08aF3yh2WMLgp0bYmVncxy3WGIri5jUNyqz8UtKCLhTj WQNwFBWA3uvUMbXcQHEmprjp3cfA/6BMQTk/R48xKsrmmgUJJhGNTrz1CZXLCjmMvchs bnoTemORgnmlKnUVf9MyGpGOM2N01i9KDZ1IQOs3nAPRXaLW2B5x7lpHNEIJ3qe5UlP/ bU/qg7e8nyd6awv09VaOCZLiBHZuZyIxeehKgKHUzEDjzFd/AIbpODHARzRIExOJixcG 6jYzOFIXgpkfqqCYIBGdrFlU/0dl/GJRPihmzQ84V6vU201GQ6qFJFEqtMcqGjqkcXL1 /mtQ== X-Gm-Message-State: AJcUukdybC7H/Hmtu3mwIbR6zIdn2bciwo/f4GbJ0lnsb8aYt/erKxDb ++OhGIgtg/bqQCeVLSXg+n5I5g== X-Google-Smtp-Source: ALg8bN58AXRgoam3UUpDoX6Q4zLHNt4RErbLiGABDIqi0h3Xxhx/D43XHhaMtUput7cJXkWTMfTILg== X-Received: by 2002:a17:906:6d46:: with SMTP id a6mr18631038ejt.203.1548695501432; Mon, 28 Jan 2019 09:11:41 -0800 (PST) Received: from localhost.localdomain ([2a02:8109:b6bf:f9e4:2130:3a9e:3894:d6a6]) by smtp.gmail.com with ESMTPSA id l51sm13989804edb.36.2019.01.28.09.11.40 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Jan 2019 09:11:40 -0800 (PST) From: Christian Brauner To: linux-kernel@vger.kernel.org, viro@zeniv.linux.org.uk, linux-fsdevel@vger.kernel.org Cc: gregkh@linuxfoundation.org, ebiederm@xmission.com, ebiggers@google.com, willy@infradead.org, dhowells@redhat.com, Christian Brauner Subject: [PATCH 2/2] devpts: simplify devpts_fill_super() Date: Mon, 28 Jan 2019 18:11:33 +0100 Message-Id: <20190128171133.539-2-christian@brauner.io> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190128171133.539-1-christian@brauner.io> References: <20190128171133.539-1-christian@brauner.io> MIME-Version: 1.0 X-Patchwork-Bot: notify 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 When devpts_fill_super() fails deactivate_locked_super() will cleanup dentries for us so there's no need to do that work in devpts_fill_super() itself. This allows us to simplify that function quite a bit. Cc: Al Viro Signed-off-by: Christian Brauner --- fs/devpts/inode.c | 22 ++++++---------------- 1 file changed, 6 insertions(+), 16 deletions(-) diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c index 8fa1492f9712..59b7625a2110 100644 --- a/fs/devpts/inode.c +++ b/fs/devpts/inode.c @@ -450,19 +450,18 @@ devpts_fill_super(struct super_block *s, void *data, int silent) s->s_op = &devpts_sops; s->s_time_gran = 1; - error = -ENOMEM; s->s_fs_info = new_pts_fs_info(s); if (!s->s_fs_info) - goto fail; + return -ENOMEM; error = parse_mount_options(data, PARSE_MOUNT, &DEVPTS_SB(s)->mount_opts); if (error) - goto fail; + return error; - error = -ENOMEM; inode = new_inode(s); if (!inode) - goto fail; + return -ENOMEM; + inode->i_ino = 1; inode->i_mtime = inode->i_atime = inode->i_ctime = current_time(inode); inode->i_mode = S_IFDIR | S_IRUGO | S_IXUGO | S_IWUSR; @@ -473,19 +472,10 @@ devpts_fill_super(struct super_block *s, void *data, int silent) s->s_root = d_make_root(inode); if (!s->s_root) { pr_err("get root dentry failed\n"); - goto fail; + return -ENOMEM; } - error = mknod_ptmx(s); - if (error) - goto fail_dput; - - return 0; -fail_dput: - dput(s->s_root); - s->s_root = NULL; -fail: - return error; + return mknod_ptmx(s); } /*