summaryrefslogtreecommitdiff
path: root/fs/devpts/inode.c
diff options
context:
space:
mode:
authorSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>2009-03-07 21:11:41 +0300
committerAl Viro <viro@zeniv.linux.org.uk>2009-03-27 21:44:04 +0300
commit945cf2c79f6fbb1b74e3b0ca08f48b6af56ad412 (patch)
tree82ef6088dc080f12bd330c095e605c06ef66dd50 /fs/devpts/inode.c
parent482984f06df54d886995a4383d2f5bb85e3de945 (diff)
downloadlinux-945cf2c79f6fbb1b74e3b0ca08f48b6af56ad412.tar.xz
Move common mknod_ptmx() calls into caller
We create 'ptmx' node in both single-instance and multiple-instance mounts. So devpts_get_sb() can call mknod_ptmx() once rather than have both modes calling mknod_ptmx() separately. Signed-off-by: Sukadev Bhattiprolu <sukadev@linux.vnet.ibm.com> Acked-by: Serge Hallyn <serue@us.ibm.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/devpts/inode.c')
-rw-r--r--fs/devpts/inode.c36
1 files changed, 17 insertions, 19 deletions
diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index 70013dd8ec70..58b719006af1 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -338,17 +338,7 @@ static int new_pts_mount(struct file_system_type *fs_type, int flags,
fsi = DEVPTS_SB(mnt->mnt_sb);
memcpy(&fsi->mount_opts, opts, sizeof(opts));
- err = mknod_ptmx(mnt->mnt_sb);
- if (err)
- goto fail;
-
return 0;
-
-fail:
- dput(mnt->mnt_sb->s_root);
- up_write(&mnt->mnt_sb->s_umount);
- deactivate_super(mnt->mnt_sb);
- return err;
}
/*
@@ -416,13 +406,6 @@ static int init_pts_mount(struct file_system_type *fs_type, int flags,
if (err)
return err;
- err = mknod_ptmx(mnt->mnt_sb);
- if (err) {
- dput(mnt->mnt_sb->s_root);
- up_write(&mnt->mnt_sb->s_umount);
- deactivate_super(mnt->mnt_sb);
- }
-
return err;
}
@@ -440,9 +423,24 @@ static int devpts_get_sb(struct file_system_type *fs_type,
}
if (opts.newinstance)
- return new_pts_mount(fs_type, flags, data, &opts, mnt);
+ error = new_pts_mount(fs_type, flags, data, &opts, mnt);
else
- return init_pts_mount(fs_type, flags, data, &opts, mnt);
+ error = init_pts_mount(fs_type, flags, data, &opts, mnt);
+
+ if (error)
+ return error;
+
+ error = mknod_ptmx(mnt->mnt_sb);
+ if (error)
+ goto out_dput;
+
+ return 0;
+
+out_dput:
+ dput(mnt->mnt_sb->s_root);
+ up_write(&mnt->mnt_sb->s_umount);
+ deactivate_super(mnt->mnt_sb);
+ return error;
}
#else