devpts: hoist out check for DEVPTS_SUPER_MAGIC
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>
This commit is contained in:
Родитель
f597fbce38
Коммит
7d71109df1
|
@ -138,10 +138,6 @@ static int devpts_ptmx_path(struct path *path)
|
||||||
struct super_block *sb;
|
struct super_block *sb;
|
||||||
int err;
|
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? */
|
/* Is a devpts filesystem at "pts" in the same directory? */
|
||||||
err = path_pts(path);
|
err = path_pts(path);
|
||||||
if (err)
|
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 vfsmount *devpts_mntget(struct file *filp, struct pts_fs_info *fsi)
|
||||||
{
|
{
|
||||||
struct path path;
|
struct path path;
|
||||||
int err;
|
int err = 0;
|
||||||
|
|
||||||
path = filp->f_path;
|
path = filp->f_path;
|
||||||
path_get(&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);
|
dput(path.dentry);
|
||||||
if (err) {
|
if (err) {
|
||||||
mntput(path.mnt);
|
mntput(path.mnt);
|
||||||
return ERR_PTR(err);
|
return ERR_PTR(err);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (DEVPTS_SB(path.mnt->mnt_sb) != fsi) {
|
if (DEVPTS_SB(path.mnt->mnt_sb) != fsi) {
|
||||||
mntput(path.mnt);
|
mntput(path.mnt);
|
||||||
return ERR_PTR(-ENODEV);
|
return ERR_PTR(-ENODEV);
|
||||||
}
|
}
|
||||||
|
|
||||||
return path.mnt;
|
return path.mnt;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -182,15 +182,19 @@ struct pts_fs_info *devpts_acquire(struct file *filp)
|
||||||
struct pts_fs_info *result;
|
struct pts_fs_info *result;
|
||||||
struct path path;
|
struct path path;
|
||||||
struct super_block *sb;
|
struct super_block *sb;
|
||||||
int err;
|
|
||||||
|
|
||||||
path = filp->f_path;
|
path = filp->f_path;
|
||||||
path_get(&path);
|
path_get(&path);
|
||||||
|
|
||||||
err = devpts_ptmx_path(&path);
|
/* Has the devpts filesystem already been found? */
|
||||||
if (err) {
|
if (path.mnt->mnt_sb->s_magic != DEVPTS_SUPER_MAGIC) {
|
||||||
result = ERR_PTR(err);
|
int err;
|
||||||
goto out;
|
|
||||||
|
err = devpts_ptmx_path(&path);
|
||||||
|
if (err) {
|
||||||
|
result = ERR_PTR(err);
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
Загрузка…
Ссылка в новой задаче