Just use devpts_remount and by doing so ensuring that ptxmode
actually get propogated to /dev/pts/ptmx on the initial mount
of devpts.

Signed-off-by: "Eric W. Biederman" <ebied...@xmission.com>
---
 fs/devpts/inode.c | 26 ++++++++++++--------------
 1 file changed, 12 insertions(+), 14 deletions(-)

diff --git a/fs/devpts/inode.c b/fs/devpts/inode.c
index c3d53d2f7c3e..14be886f987c 100644
--- a/fs/devpts/inode.c
+++ b/fs/devpts/inode.c
@@ -338,12 +338,6 @@ static int mknod_ptmx(struct super_block *sb)
 
        inode_lock(d_inode(root));
 
-       /* If we have already created ptmx node, return */
-       if (fsi->ptmx_dentry) {
-               rc = 0;
-               goto out;
-       }
-
        dentry = d_alloc_name(root, "ptmx");
        if (!dentry) {
                pr_err("Unable to alloc dentry for ptmx node\n");
@@ -552,16 +546,20 @@ static struct dentry *devpts_mount(struct 
file_system_type *fs_type,
                error = devpts_fill_super(s, data, flags & MS_SILENT ? 1 : 0);
                if (error)
                        goto out_undo_sget;
-               s->s_flags |= MS_ACTIVE;
-       }
 
-       error = parse_mount_options(data, &DEVPTS_SB(s)->mount_opts);
-       if (error)
-               goto out_undo_sget;
+               error = parse_mount_options(data, &DEVPTS_SB(s)->mount_opts);
+               if (error)
+                       goto out_undo_sget;
+
+               error = mknod_ptmx(s);
+               if (error)
+                       goto out_undo_sget;
 
-       error = mknod_ptmx(s);
-       if (error)
-               goto out_undo_sget;
+               s->s_flags |= MS_ACTIVE;
+       } else {
+               /* Match mount_single ignore errors on remount */
+               devpts_remount(s, &flags, data);
+       }
 
        return dget(s->s_root);
 
-- 
2.6.3

Reply via email to