summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRonnie Sahlberg <lsahlber@redhat.com>2020-11-10 09:12:31 +1000
committerSteve French <stfrench@microsoft.com>2020-12-13 19:12:07 -0600
commita2a52a8a3601c37a68b31b734f5a06af8a7903f1 (patch)
tree2c4c2a0c0778590f5563076a546dc430df56cfef
parentd17abdf7566566fc402c31899b353044a7ff3cf4 (diff)
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: Ronnie Sahlberg <lsahlber@redhat.com> Reviewed-by: Shyam Prasad N <sprasad@microsoft.com> Signed-off-by: Steve French <stfrench@microsoft.com>
-rw-r--r--fs/cifs/cifs_dfs_ref.c3
-rw-r--r--fs/cifs/cifs_fs_sb.h1
-rw-r--r--fs/cifs/cifsfs.c7
-rw-r--r--fs/cifs/connect.c19
4 files changed, 12 insertions, 18 deletions
diff --git a/fs/cifs/cifs_dfs_ref.c b/fs/cifs/cifs_dfs_ref.c
index 81f6066d5865..6f7187b90fda 100644
--- a/fs/cifs/cifs_dfs_ref.c
+++ b/fs/cifs/cifs_dfs_ref.c
@@ -23,6 +23,7 @@
#include "cifs_debug.h"
#include "cifs_unicode.h"
#include "dfs_cache.h"
+#include "fs_context.h"
static LIST_HEAD(cifs_dfs_automount_list);
@@ -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 */
/* 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);
if (IS_ERR(mountdata)) {
kfree(devname);
diff --git a/fs/cifs/cifs_fs_sb.h b/fs/cifs/cifs_fs_sb.h
index 34d0229c0519..8ee37c80880a 100644
--- a/fs/cifs/cifs_fs_sb.h
+++ b/fs/cifs/cifs_fs_sb.h
@@ -74,7 +74,6 @@ struct cifs_sb_info {
umode_t mnt_file_mode;
umode_t mnt_dir_mode;
unsigned int mnt_cifs_flags;
- char *mountdata; /* options received at mount time or via DFS refs */
struct delayed_work prune_tlinks;
struct rcu_head rcu;
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 7fe6502e1672..4f27f77d3053 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -812,12 +812,6 @@ cifs_smb3_do_mount(struct file_system_type *fs_type,
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);
if (rc) {
root = ERR_PTR(rc);
@@ -872,7 +866,6 @@ out_super:
out:
if (cifs_sb) {
kfree(cifs_sb->prepath);
- kfree(cifs_sb->mountdata);
cifs_cleanup_volume_info(cifs_sb->ctx);
kfree(cifs_sb);
}
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 5146c4645537..95b12f148735 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -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
*
*
- * 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
* will be left untouched.
*
@@ -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),
ref_path, &referral, NULL);
if (!rc) {
- mdata = cifs_compose_mount_options(cifs_sb->mountdata,
+ mdata = cifs_compose_mount_options(cifs_sb->ctx->mount_options,
full_path + 1, &referral);
free_dfs_info_param(&referral);
@@ -3049,8 +3049,8 @@ expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses,
cifs_cleanup_volume_info_contents(ctx);
rc = cifs_setup_volume_info(ctx);
}
- kfree(cifs_sb->mountdata);
- cifs_sb->mountdata = mdata;
+ kfree(cifs_sb->ctx->mount_options);
+ cifs_sb->ctx->mount_options = mdata;
}
kfree(full_path);
return rc;
@@ -3109,7 +3109,8 @@ static int setup_dfs_tgt_conn(const char *path, const char *full_path,
if (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);
if (IS_ERR(mdata)) {
@@ -3438,7 +3439,8 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
goto error;
}
/* 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) {
rc = -ENOMEM;
goto error;
@@ -3462,12 +3464,12 @@ int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx)
break;
}
/* 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);
if (rc)
break;
/* 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);
rc = mount_get_conns(ctx, cifs_sb, &xid, &server, &ses, &tcon);
}
@@ -3774,7 +3776,6 @@ cifs_umount(struct cifs_sb_info *cifs_sb)
}
spin_unlock(&cifs_sb->tlink_tree_lock);
- kfree(cifs_sb->mountdata);
kfree(cifs_sb->prepath);
#ifdef CONFIG_CIFS_DFS_UPCALL
dfs_cache_del_vol(cifs_sb->origin_fullpath);