From: Christian Brauner <christian@brauner.io>
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 <christian@brauner.io>
Subject: [PATCH 2/2] devpts: simplify devpts_fill_super()
Date: Mon, 28 Jan 2019 18:11:33 +0100 [thread overview]
Message-ID: <20190128171133.539-2-christian@brauner.io> (raw)
In-Reply-To: <20190128171133.539-1-christian@brauner.io>
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 <viro@zeniv.linux.org.uk>
Signed-off-by: Christian Brauner <christian@brauner.io>
---
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);
}
/*
--
2.20.1
next prev parent reply other threads:[~2019-01-28 17:11 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-28 17:11 [PATCH 1/2] devpts: remove unneeded inode_lock in mknod_ptmx Christian Brauner
2019-01-28 17:11 ` Christian Brauner [this message]
2019-02-19 9:24 ` Christian Brauner
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=20190128171133.539-2-christian@brauner.io \
--to=christian@brauner.io \
--cc=dhowells@redhat.com \
--cc=ebiederm@xmission.com \
--cc=ebiggers@google.com \
--cc=gregkh@linuxfoundation.org \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=viro@zeniv.linux.org.uk \
--cc=willy@infradead.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).