aboutsummaryrefslogtreecommitdiffstats
path: root/fs/cifs/cifsfs.c
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-06-17 09:56:55 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-06-24 18:39:42 -0400
commit5c4f1ad7c6aa3b729bd3a93b80f9417d7e978c32 (patch)
tree5cae9c65a9be45b7f01efdb10e5c41238f24f6d4 /fs/cifs/cifsfs.c
parentfa18f1bdce898f0efd0c8639c901d826d01be04f (diff)
cifs: tidy cifs_do_mount() up a bit
Acked-by: Pavel Shilovsky <piastryyy@gmail.com> Reviewed-by: Jeff Layton <jlayton@redhat.com> Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'fs/cifs/cifsfs.c')
-rw-r--r--fs/cifs/cifsfs.c44
1 files changed, 22 insertions, 22 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 234e9d08db76..9a6696a5eb78 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -656,16 +656,13 @@ cifs_do_mount(struct file_system_type *fs_type,
656 cifs_sb = kzalloc(sizeof(struct cifs_sb_info), GFP_KERNEL); 656 cifs_sb = kzalloc(sizeof(struct cifs_sb_info), GFP_KERNEL);
657 if (cifs_sb == NULL) { 657 if (cifs_sb == NULL) {
658 root = ERR_PTR(-ENOMEM); 658 root = ERR_PTR(-ENOMEM);
659 unload_nls(volume_info->local_nls); 659 goto out_nls;
660 goto out;
661 } 660 }
662 661
663 cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL); 662 cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL);
664 if (cifs_sb->mountdata == NULL) { 663 if (cifs_sb->mountdata == NULL) {
665 root = ERR_PTR(-ENOMEM); 664 root = ERR_PTR(-ENOMEM);
666 unload_nls(volume_info->local_nls); 665 goto out_cifs_sb;
667 kfree(cifs_sb);
668 goto out;
669 } 666 }
670 667
671 cifs_setup_cifs_sb(volume_info, cifs_sb); 668 cifs_setup_cifs_sb(volume_info, cifs_sb);
@@ -675,10 +672,7 @@ cifs_do_mount(struct file_system_type *fs_type,
675 if (!(flags & MS_SILENT)) 672 if (!(flags & MS_SILENT))
676 cERROR(1, "cifs_mount failed w/return code = %d", rc); 673 cERROR(1, "cifs_mount failed w/return code = %d", rc);
677 root = ERR_PTR(rc); 674 root = ERR_PTR(rc);
678 unload_nls(volume_info->local_nls); 675 goto out_mountdata;
679 kfree(cifs_sb->mountdata);
680 kfree(cifs_sb);
681 goto out;
682 } 676 }
683 677
684 mnt_data.vol = volume_info; 678 mnt_data.vol = volume_info;
@@ -695,22 +689,20 @@ cifs_do_mount(struct file_system_type *fs_type,
695 if (sb->s_root) { 689 if (sb->s_root) {
696 cFYI(1, "Use existing superblock"); 690 cFYI(1, "Use existing superblock");
697 cifs_umount(cifs_sb); 691 cifs_umount(cifs_sb);
698 goto out_shared; 692 } else {
699 } 693 sb->s_flags = flags;
700 694 /* BB should we make this contingent on mount parm? */
701 sb->s_flags = flags; 695 sb->s_flags |= MS_NODIRATIME | MS_NOATIME;
702 /* BB should we make this contingent on mount parm? */ 696
703 sb->s_flags |= MS_NODIRATIME | MS_NOATIME; 697 rc = cifs_read_super(sb);
698 if (rc) {
699 root = ERR_PTR(rc);
700 goto out_super;
701 }
704 702
705 rc = cifs_read_super(sb); 703 sb->s_flags |= MS_ACTIVE;
706 if (rc) {
707 root = ERR_PTR(rc);
708 goto out_super;
709 } 704 }
710 705
711 sb->s_flags |= MS_ACTIVE;
712
713out_shared:
714 root = cifs_get_root(volume_info, sb); 706 root = cifs_get_root(volume_info, sb);
715 if (root == NULL) { 707 if (root == NULL) {
716 root = ERR_PTR(-EINVAL); /* XXX */ 708 root = ERR_PTR(-EINVAL); /* XXX */
@@ -725,6 +717,14 @@ out_super:
725out: 717out:
726 cifs_cleanup_volume_info(&volume_info); 718 cifs_cleanup_volume_info(&volume_info);
727 return root; 719 return root;
720
721out_mountdata:
722 kfree(cifs_sb->mountdata);
723out_cifs_sb:
724 kfree(cifs_sb);
725out_nls:
726 unload_nls(volume_info->local_nls);
727 goto out;
728} 728}
729 729
730static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov, 730static ssize_t cifs_file_aio_write(struct kiocb *iocb, const struct iovec *iov,