Skip to content

Commit

Permalink
cifs: allocate mountdata earlier
Browse files Browse the repository at this point in the history
pull mountdata allocation up, so that it won't stand in the way when
we lift cifs_mount() to location before sget().

Acked-by: Pavel Shilovsky <piastryyy@gmail.com>
Reviewed-by: Jeff Layton <jlayton@redhat.com>
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
  • Loading branch information
Al Viro committed Jun 24, 2011
1 parent d687ca3 commit 5d3bc60
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions fs/cifs/cifsfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -687,6 +687,14 @@ cifs_do_mount(struct file_system_type *fs_type,
goto out;
}

cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL);
if (cifs_sb->mountdata == NULL) {
root = ERR_PTR(-ENOMEM);
unload_nls(volume_info->local_nls);
kfree(cifs_sb);
goto out;
}

cifs_setup_cifs_sb(volume_info, cifs_sb);

mnt_data.vol = volume_info;
Expand All @@ -701,22 +709,12 @@ cifs_do_mount(struct file_system_type *fs_type,

if (sb->s_fs_info) {
cFYI(1, "Use existing superblock");
kfree(cifs_sb->mountdata);
unload_nls(cifs_sb->local_nls);
kfree(cifs_sb);
goto out_shared;
}

/*
* Copy mount params for use in submounts. Better to do
* the copy here and deal with the error before cleanup gets
* complicated post-mount.
*/
cifs_sb->mountdata = kstrndup(data, PAGE_SIZE, GFP_KERNEL);
if (cifs_sb->mountdata == NULL) {
root = ERR_PTR(-ENOMEM);
goto out_super;
}

sb->s_flags = flags;
/* BB should we make this contingent on mount parm? */
sb->s_flags |= MS_NODIRATIME | MS_NOATIME;
Expand Down Expand Up @@ -749,6 +747,7 @@ cifs_do_mount(struct file_system_type *fs_type,
goto out;

out_cifs_sb:
kfree(cifs_sb->mountdata);
unload_nls(cifs_sb->local_nls);
kfree(cifs_sb);

Expand Down

0 comments on commit 5d3bc60

Please sign in to comment.