summaryrefslogtreecommitdiff
path: root/fs/cifs
diff options
context:
space:
mode:
authorAl Viro <viro@zeniv.linux.org.uk>2011-06-17 09:29:57 -0400
committerAl Viro <viro@zeniv.linux.org.uk>2011-06-24 18:39:42 -0400
commit97d1152acec0647b72f8c6ecc57da0d6fed574de (patch)
treea5d8fc4720ca10d65e6a56cd7281841c91acabe7 /fs/cifs
parent2a9b99516c662d1713d58648e4a4c9aef72051bc (diff)
cifs: pull cifs_mount() call up
... to the point prior to sget(). Now we have cifs_sb set up early enough. 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')
-rw-r--r--fs/cifs/cifsfs.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 2af14d4577a7..4004bc647a72 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -104,8 +104,7 @@ cifs_sb_deactive(struct super_block *sb)
}
static int
-cifs_read_super(struct super_block *sb, struct smb_vol *volume_info,
- const char *devname, int silent)
+cifs_read_super(struct super_block *sb)
{
struct inode *inode;
struct cifs_sb_info *cifs_sb;
@@ -113,14 +112,6 @@ cifs_read_super(struct super_block *sb, struct smb_vol *volume_info,
cifs_sb = CIFS_SB(sb);
- rc = cifs_mount(cifs_sb, volume_info);
-
- if (rc) {
- if (!silent)
- cERROR(1, "cifs_mount failed w/return code = %d", rc);
- return rc;
- }
-
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_POSIXACL)
sb->s_flags |= MS_POSIXACL;
@@ -692,6 +683,17 @@ cifs_do_mount(struct file_system_type *fs_type,
cifs_setup_cifs_sb(volume_info, cifs_sb);
+ rc = cifs_mount(cifs_sb, volume_info);
+ if (rc) {
+ if (!(flags & MS_SILENT))
+ cERROR(1, "cifs_mount failed w/return code = %d", rc);
+ root = ERR_PTR(rc);
+ unload_nls(volume_info->local_nls);
+ kfree(cifs_sb->mountdata);
+ kfree(cifs_sb);
+ goto out;
+ }
+
mnt_data.vol = volume_info;
mnt_data.cifs_sb = cifs_sb;
mnt_data.flags = flags;
@@ -699,11 +701,13 @@ cifs_do_mount(struct file_system_type *fs_type,
sb = sget(fs_type, cifs_match_super, set_anon_super, &mnt_data);
if (IS_ERR(sb)) {
root = ERR_CAST(sb);
+ cifs_umount(cifs_sb);
goto out_cifs_sb;
}
if (sb->s_fs_info) {
cFYI(1, "Use existing superblock");
+ cifs_umount(cifs_sb);
kfree(cifs_sb->mountdata);
unload_nls(cifs_sb->local_nls);
kfree(cifs_sb);
@@ -715,8 +719,7 @@ cifs_do_mount(struct file_system_type *fs_type,
sb->s_flags |= MS_NODIRATIME | MS_NOATIME;
sb->s_fs_info = cifs_sb;
- rc = cifs_read_super(sb, volume_info, dev_name,
- flags & MS_SILENT ? 1 : 0);
+ rc = cifs_read_super(sb);
if (rc) {
root = ERR_PTR(rc);
goto out_super;