Skip to content

Commit

Permalink
Move common mknod_ptmx() calls into caller
Browse files Browse the repository at this point in the history
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 <[email protected]>
Acked-by: Serge Hallyn <[email protected]>
Signed-off-by: Al Viro <[email protected]>
  • Loading branch information
Sukadev Bhattiprolu authored and Al Viro committed Mar 27, 2009
1 parent 482984f commit 945cf2c
Showing 1 changed file with 17 additions and 19 deletions.
36 changes: 17 additions & 19 deletions fs/devpts/inode.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

/*
Expand Down Expand Up @@ -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;
}

Expand All @@ -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
Expand Down

0 comments on commit 945cf2c

Please sign in to comment.