summaryrefslogtreecommitdiffstats
path: root/fs/devpts
diff options
context:
space:
mode:
authorChristian Brauner <christian.brauner@ubuntu.com>2018-03-13 17:55:24 +0100
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2018-07-17 11:39:26 +0200
commitcd360be6488cf3e455ca6be57fff6f6fcc787b15 (patch)
treed63e9f528d7db0697279711264e042c1832edd20 /fs/devpts
parent7499390b8ba5e4c9d378d301f7fd7db9be28f922 (diff)
downloadlinux-stable-cd360be6488cf3e455ca6be57fff6f6fcc787b15.tar.gz
linux-stable-cd360be6488cf3e455ca6be57fff6f6fcc787b15.tar.bz2
linux-stable-cd360be6488cf3e455ca6be57fff6f6fcc787b15.zip
devpts: hoist out check for DEVPTS_SUPER_MAGIC
commit 7d71109df186d630a41280670c8d71d0cf9b0da9 upstream. Hoist the check whether we have already found a suitable devpts filesystem out of devpts_ptmx_path() in preparation for the devpts bind-mount resolution patch. This is a non-functional change. Signed-off-by: Christian Brauner <christian.brauner@ubuntu.com> Reviewed-by: "Eric W. Biederman" <ebiederm@xmission.com> Acked-by: Linus Torvalds <torvalds@linux-foundation.org> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'fs/devpts')
-rw-r--r--fs/devpts/inode.c26
1 files changed, 15 insertions, 11 deletions
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index e31d6ed3ec32..71b901936113 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -138,10 +138,6 @@ static int devpts_ptmx_path(struct path *path)
struct super_block *sb;
int err;
- /* Has the devpts filesystem already been found? */
- if (path->mnt->mnt_sb->s_magic == DEVPTS_SUPER_MAGIC)
- return 0;
-
/* Is a devpts filesystem at "pts" in the same directory? */
err = path_pts(path);
if (err)
@@ -159,21 +155,25 @@ static int devpts_ptmx_path(struct path *path)
struct vfsmount *devpts_mntget(struct file *filp, struct pts_fs_info *fsi)
{
struct path path;
- int err;
+ int err = 0;
path = filp->f_path;
path_get(&path);
- err = devpts_ptmx_path(&path);
+ /* Has the devpts filesystem already been found? */
+ if (path.mnt->mnt_sb->s_magic != DEVPTS_SUPER_MAGIC)
+ err = devpts_ptmx_path(&path);
dput(path.dentry);
if (err) {
mntput(path.mnt);
return ERR_PTR(err);
}
+
if (DEVPTS_SB(path.mnt->mnt_sb) != fsi) {
mntput(path.mnt);
return ERR_PTR(-ENODEV);
}
+
return path.mnt;
}
@@ -182,15 +182,19 @@ struct pts_fs_info *devpts_acquire(struct file *filp)
struct pts_fs_info *result;
struct path path;
struct super_block *sb;
- int err;
path = filp->f_path;
path_get(&path);
- err = devpts_ptmx_path(&path);
- if (err) {
- result = ERR_PTR(err);
- goto out;
+ /* Has the devpts filesystem already been found? */
+ if (path.mnt->mnt_sb->s_magic != DEVPTS_SUPER_MAGIC) {
+ int err;
+
+ err = devpts_ptmx_path(&path);
+ if (err) {
+ result = ERR_PTR(err);
+ goto out;
+ }
}
/*