aboutsummaryrefslogtreecommitdiffstats
path: root/fs/devpts/inode.c
diff options
context:
space:
mode:
authorSukadev Bhattiprolu <sukadev@linux.vnet.ibm.com>2009-03-07 13:11:41 -0500
committerAl Viro <viro@zeniv.linux.org.uk>2009-03-27 14:44:04 -0400
commit945cf2c79f6fbb1b74e3b0ca08f48b6af56ad412 (patch)
tree82ef6088dc080f12bd330c095e605c06ef66dd50 /fs/devpts/inode.c
parent482984f06df54d886995a4383d2f5bb85e3de945 (diff)
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,
338 fsi = DEVPTS_SB(mnt->mnt_sb); 338 fsi = DEVPTS_SB(mnt->mnt_sb);
339 memcpy(&fsi->mount_opts, opts, sizeof(opts)); 339 memcpy(&fsi->mount_opts, opts, sizeof(opts));
340 340
341 err = mknod_ptmx(mnt->mnt_sb);
342 if (err)
343 goto fail;
344
345 return 0; 341 return 0;
346
347fail:
348 dput(mnt->mnt_sb->s_root);
349 up_write(&mnt->mnt_sb->s_umount);
350 deactivate_super(mnt->mnt_sb);
351 return err;
352} 342}
353 343
354/* 344/*
@@ -416,13 +406,6 @@ static int init_pts_mount(struct file_system_type *fs_type, int flags,
416 if (err) 406 if (err)
417 return err; 407 return err;
418 408
419 err = mknod_ptmx(mnt->mnt_sb);
420 if (err) {
421 dput(mnt->mnt_sb->s_root);
422 up_write(&mnt->mnt_sb->s_umount);
423 deactivate_super(mnt->mnt_sb);
424 }
425
426 return err; 409 return err;
427} 410}
428 411
@@ -440,9 +423,24 @@ static int devpts_get_sb(struct file_system_type *fs_type,
440 } 423 }
441 424
442 if (opts.newinstance) 425 if (opts.newinstance)
443 return new_pts_mount(fs_type, flags, data, &opts, mnt); 426 error = new_pts_mount(fs_type, flags, data, &opts, mnt);
444 else 427 else
445 return init_pts_mount(fs_type, flags, data, &opts, mnt); 428 error = init_pts_mount(fs_type, flags, data, &opts, mnt);
429
430 if (error)
431 return error;
432
433 error = mknod_ptmx(mnt->mnt_sb);
434 if (error)
435 goto out_dput;
436
437 return 0;
438
439out_dput:
440 dput(mnt->mnt_sb->s_root);
441 up_write(&mnt->mnt_sb->s_umount);
442 deactivate_super(mnt->mnt_sb);
443 return error;
446} 444}
447 445
448#else 446#else