Commit a2a52a8a authored by Ronnie Sahlberg's avatar Ronnie Sahlberg Committed by Steve French

cifs: get rid of cifs_sb->mountdata

as we now have a full smb3_fs_context as part of the cifs superblock
we no longer need a local copy of the mount options and can just
reference the copy in the smb3_fs_context.
Signed-off-by: default avatarRonnie Sahlberg <lsahlber@redhat.com>
Reviewed-by: default avatarShyam Prasad N <sprasad@microsoft.com>
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent d17abdf7
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include "cifs_debug.h" #include "cifs_debug.h"
#include "cifs_unicode.h" #include "cifs_unicode.h"
#include "dfs_cache.h" #include "dfs_cache.h"
#include "fs_context.h"
static LIST_HEAD(cifs_dfs_automount_list); static LIST_HEAD(cifs_dfs_automount_list);
...@@ -275,7 +276,7 @@ static struct vfsmount *cifs_dfs_do_mount(struct dentry *mntpt, ...@@ -275,7 +276,7 @@ static struct vfsmount *cifs_dfs_do_mount(struct dentry *mntpt,
/* See afs_mntpt_do_automount in fs/afs/mntpt.c for an example */ /* See afs_mntpt_do_automount in fs/afs/mntpt.c for an example */
/* strip first '\' from fullpath */ /* strip first '\' from fullpath */
mountdata = cifs_compose_mount_options(cifs_sb->mountdata, mountdata = cifs_compose_mount_options(cifs_sb->ctx->mount_options,
fullpath + 1, NULL); fullpath + 1, NULL);
if (IS_ERR(mountdata)) { if (IS_ERR(mountdata)) {
kfree(devname); kfree(devname);
......
...@@ -74,7 +74,6 @@ struct cifs_sb_info { ...@@ -74,7 +74,6 @@ struct cifs_sb_info {
umode_t mnt_file_mode; umode_t mnt_file_mode;
umode_t mnt_dir_mode; umode_t mnt_dir_mode;
unsigned int mnt_cifs_flags; unsigned int mnt_cifs_flags;
char *mountdata; /* options received at mount time or via DFS refs */
struct delayed_work prune_tlinks; struct delayed_work prune_tlinks;
struct rcu_head rcu; struct rcu_head rcu;
......
...@@ -812,12 +812,6 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, ...@@ -812,12 +812,6 @@ cifs_smb3_do_mount(struct file_system_type *fs_type,
goto out; goto out;
} }
cifs_sb->mountdata = kstrndup(cifs_sb->ctx->mount_options, PAGE_SIZE, GFP_KERNEL);
if (cifs_sb->mountdata == NULL) {
root = ERR_PTR(-ENOMEM);
goto out;
}
rc = cifs_setup_cifs_sb(cifs_sb->ctx, cifs_sb); rc = cifs_setup_cifs_sb(cifs_sb->ctx, cifs_sb);
if (rc) { if (rc) {
root = ERR_PTR(rc); root = ERR_PTR(rc);
...@@ -872,7 +866,6 @@ cifs_smb3_do_mount(struct file_system_type *fs_type, ...@@ -872,7 +866,6 @@ cifs_smb3_do_mount(struct file_system_type *fs_type,
out: out:
if (cifs_sb) { if (cifs_sb) {
kfree(cifs_sb->prepath); kfree(cifs_sb->prepath);
kfree(cifs_sb->mountdata);
cifs_cleanup_volume_info(cifs_sb->ctx); cifs_cleanup_volume_info(cifs_sb->ctx);
kfree(cifs_sb); kfree(cifs_sb);
} }
......
...@@ -3012,7 +3012,7 @@ build_unc_path_to_root(const struct smb3_fs_context *ctx, ...@@ -3012,7 +3012,7 @@ build_unc_path_to_root(const struct smb3_fs_context *ctx,
* expand_dfs_referral - Perform a dfs referral query and update the cifs_sb * expand_dfs_referral - Perform a dfs referral query and update the cifs_sb
* *
* *
* If a referral is found, cifs_sb->mountdata will be (re-)allocated * If a referral is found, cifs_sb->ctx->mount_options will be (re-)allocated
* to a string containing updated options for the submount. Otherwise it * to a string containing updated options for the submount. Otherwise it
* will be left untouched. * will be left untouched.
* *
...@@ -3038,7 +3038,7 @@ expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses, ...@@ -3038,7 +3038,7 @@ expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses,
rc = dfs_cache_find(xid, ses, cifs_sb->local_nls, cifs_remap(cifs_sb), rc = dfs_cache_find(xid, ses, cifs_sb->local_nls, cifs_remap(cifs_sb),
ref_path, &referral, NULL); ref_path, &referral, NULL);
if (!rc) { if (!rc) {
mdata = cifs_compose_mount_options(cifs_sb->mountdata, mdata = cifs_compose_mount_options(cifs_sb->ctx->mount_options,
full_path + 1, &referral); full_path + 1, &referral);
free_dfs_info_param(&referral); free_dfs_info_param(&referral);
...@@ -3049,8 +3049,8 @@ expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses, ...@@ -3049,8 +3049,8 @@ expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses,
cifs_cleanup_volume_info_contents(ctx); cifs_cleanup_volume_info_contents(ctx);
rc = cifs_setup_volume_info(ctx); rc = cifs_setup_volume_info(ctx);
} }
kfree(cifs_sb->mountdata); kfree(cifs_sb->ctx->mount_options);
cifs_sb->mountdata = mdata; cifs_sb->ctx->mount_options = mdata;
} }
kfree(full_path); kfree(full_path);
return rc; return rc;
...@@ -3109,7 +3109,8 @@ static int setup_dfs_tgt_conn(const char *path, const char *full_path, ...@@ -3109,7 +3109,8 @@ static int setup_dfs_tgt_conn(const char *path, const char *full_path,
if (rc) if (rc)
return rc; return rc;
mdata = cifs_compose_mount_options(cifs_sb->mountdata, full_path + 1, &ref); mdata = cifs_compose_mount_options(cifs_sb->ctx->mount_options,
full_path + 1, &ref);
free_dfs_info_param(&ref); free_dfs_info_param(&ref);
if (IS_ERR(mdata)) { if (IS_ERR(mdata)) {
...@@ -3438,7 +3439,8 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) ...@@ -3438,7 +3439,8 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
goto error; goto error;
} }
/* Save mount options */ /* Save mount options */
mntdata = kstrndup(cifs_sb->mountdata, strlen(cifs_sb->mountdata), GFP_KERNEL); mntdata = kstrndup(cifs_sb->ctx->mount_options,
strlen(cifs_sb->ctx->mount_options), GFP_KERNEL);
if (!mntdata) { if (!mntdata) {
rc = -ENOMEM; rc = -ENOMEM;
goto error; goto error;
...@@ -3462,12 +3464,12 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx) ...@@ -3462,12 +3464,12 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
break; break;
} }
/* Chase referral */ /* Chase referral */
oldmnt = cifs_sb->mountdata; oldmnt = cifs_sb->ctx->mount_options;
rc = expand_dfs_referral(xid, root_ses, ctx, cifs_sb, ref_path + 1); rc = expand_dfs_referral(xid, root_ses, ctx, cifs_sb, ref_path + 1);
if (rc) if (rc)
break; break;
/* Connect to new DFS target only if we were redirected */ /* Connect to new DFS target only if we were redirected */
if (oldmnt != cifs_sb->mountdata) { if (oldmnt != cifs_sb->ctx->mount_options) {
mount_put_conns(cifs_sb, xid, server, ses, tcon); mount_put_conns(cifs_sb, xid, server, ses, tcon);
rc = mount_get_conns(ctx, cifs_sb, &xid, &server, &ses, &tcon); rc = mount_get_conns(ctx, cifs_sb, &xid, &server, &ses, &tcon);
} }
...@@ -3774,7 +3776,6 @@ cifs_umount(struct cifs_sb_info *cifs_sb) ...@@ -3774,7 +3776,6 @@ cifs_umount(struct cifs_sb_info *cifs_sb)
} }
spin_unlock(&cifs_sb->tlink_tree_lock); spin_unlock(&cifs_sb->tlink_tree_lock);
kfree(cifs_sb->mountdata);
kfree(cifs_sb->prepath); kfree(cifs_sb->prepath);
#ifdef CONFIG_CIFS_DFS_UPCALL #ifdef CONFIG_CIFS_DFS_UPCALL
dfs_cache_del_vol(cifs_sb->origin_fullpath); dfs_cache_del_vol(cifs_sb->origin_fullpath);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment