From: Ronnie Sahlberg <lsahlber@redhat.com>
To: linux-cifs <linux-cifs@vger.kernel.org>
Cc: Steve French <smfrench@gmail.com>
Subject: [PATCH 11/21] cifs: move cifs_cleanup_volume_info[_content] to fs_context.c
Date: Tue, 8 Dec 2020 09:36:36 +1000 [thread overview]
Message-ID: <20201207233646.29823-11-lsahlber@redhat.com> (raw)
In-Reply-To: <20201207233646.29823-1-lsahlber@redhat.com>
and rename it to smb3_cleanup_fs_context[_content]
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
---
fs/cifs/cifsfs.c | 2 +-
fs/cifs/cifsproto.h | 3 ---
fs/cifs/connect.c | 47 ++++-------------------------------------------
fs/cifs/dfs_cache.c | 4 ++--
fs/cifs/fs_context.c | 45 ++++++++++++++++++++++++++++++++++++++++++---
fs/cifs/fs_context.h | 2 ++
6 files changed, 51 insertions(+), 52 deletions(-)
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index e432de7c6ca1..0288632233f6 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -866,7 +866,7 @@ cifs_smb3_do_mount(struct file_system_type *fs_type,
out:
if (cifs_sb) {
kfree(cifs_sb->prepath);
- cifs_cleanup_volume_info(cifs_sb->ctx);
+ smb3_cleanup_fs_context(cifs_sb->ctx);
kfree(cifs_sb);
}
return root;
diff --git a/fs/cifs/cifsproto.h b/fs/cifs/cifsproto.h
index 19ee76f3a96f..b04f7270e04a 100644
--- a/fs/cifs/cifsproto.h
+++ b/fs/cifs/cifsproto.h
@@ -237,7 +237,6 @@ extern int cifs_read_page_from_socket(struct TCP_Server_Info *server,
extern int cifs_setup_cifs_sb(struct smb3_fs_context *ctx,
struct cifs_sb_info *cifs_sb);
extern int cifs_match_super(struct super_block *, void *);
-extern void cifs_cleanup_volume_info(struct smb3_fs_context *ctx);
extern int cifs_mount(struct cifs_sb_info *cifs_sb, struct smb3_fs_context *ctx);
extern void cifs_umount(struct cifs_sb_info *);
extern void cifs_mark_open_files_invalid(struct cifs_tcon *tcon);
@@ -552,8 +551,6 @@ extern int SMBencrypt(unsigned char *passwd, const unsigned char *c8,
extern int
cifs_setup_volume_info(struct smb3_fs_context *ctx);
-extern void
-cifs_cleanup_volume_info_contents(struct smb3_fs_context *ctx);
extern struct TCP_Server_Info *
cifs_find_tcp_session(struct smb3_fs_context *ctx);
diff --git a/fs/cifs/connect.c b/fs/cifs/connect.c
index 47e2fe8c19a2..054cb09b8087 100644
--- a/fs/cifs/connect.c
+++ b/fs/cifs/connect.c
@@ -2777,45 +2777,6 @@ int cifs_setup_cifs_sb(struct smb3_fs_context *ctx,
return 0;
}
-void
-cifs_cleanup_volume_info_contents(struct smb3_fs_context *ctx)
-{
- if (ctx == NULL)
- return;
-
- /*
- * Make sure this stays in sync with smb3_fs_context_dup()
- */
- kfree(ctx->mount_options);
- ctx->mount_options = NULL;
- kfree(ctx->username);
- ctx->username = NULL;
- kfree_sensitive(ctx->password);
- ctx->password = NULL;
- kfree(ctx->UNC);
- ctx->UNC = NULL;
- kfree(ctx->domainname);
- ctx->domainname = NULL;
- kfree(ctx->nodename);
- ctx->nodename = NULL;
- kfree(ctx->iocharset);
- ctx->iocharset = NULL;
- kfree(ctx->prepath);
- ctx->prepath = NULL;
-
- unload_nls(ctx->local_nls);
- ctx->local_nls = NULL;
-}
-
-void
-cifs_cleanup_volume_info(struct smb3_fs_context *ctx)
-{
- if (!ctx)
- return;
- cifs_cleanup_volume_info_contents(ctx);
- kfree(ctx);
-}
-
/* Release all succeed connections */
static inline void mount_put_conns(struct cifs_sb_info *cifs_sb,
unsigned int xid,
@@ -3027,7 +2988,7 @@ expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses,
rc = PTR_ERR(mdata);
mdata = NULL;
} else {
- cifs_cleanup_volume_info_contents(ctx);
+ smb3_cleanup_fs_context_contents(ctx);
rc = cifs_setup_volume_info(ctx);
}
kfree(cifs_sb->ctx->mount_options);
@@ -3119,7 +3080,7 @@ static int setup_dfs_tgt_conn(const char *path, const char *full_path,
rc = update_vol_info(tgt_it, &fake_ctx, ctx);
}
}
- cifs_cleanup_volume_info_contents(&fake_ctx);
+ smb3_cleanup_fs_context_contents(&fake_ctx);
return rc;
}
@@ -3366,7 +3327,7 @@ static int check_dfs_prepath(struct cifs_sb_info *cifs_sb, struct smb3_fs_contex
break;
rc = -EREMOTE;
npath = build_unc_path_to_root(&v, cifs_sb, true);
- cifs_cleanup_volume_info_contents(&v);
+ smb3_cleanup_fs_context_contents(&v);
} else {
v.UNC = ctx->UNC;
v.prepath = path + 1;
@@ -3729,7 +3690,7 @@ static void delayed_free(struct rcu_head *p)
{
struct cifs_sb_info *cifs_sb = container_of(p, struct cifs_sb_info, rcu);
unload_nls(cifs_sb->local_nls);
- cifs_cleanup_volume_info(cifs_sb->ctx);
+ smb3_cleanup_fs_context(cifs_sb->ctx);
kfree(cifs_sb);
}
diff --git a/fs/cifs/dfs_cache.c b/fs/cifs/dfs_cache.c
index 6bccff4596bf..6ad6ba5f6ebe 100644
--- a/fs/cifs/dfs_cache.c
+++ b/fs/cifs/dfs_cache.c
@@ -587,7 +587,7 @@ static void __vol_release(struct vol_info *vi)
{
kfree(vi->fullpath);
kfree(vi->mntdata);
- cifs_cleanup_volume_info_contents(&vi->ctx);
+ smb3_cleanup_fs_context_contents(&vi->ctx);
kfree(vi);
}
@@ -1468,7 +1468,7 @@ static struct cifs_ses *find_root_ses(struct vol_info *vi,
ses = cifs_get_smb_ses(server, &ctx);
out:
- cifs_cleanup_volume_info_contents(&ctx);
+ smb3_cleanup_fs_context_contents(&ctx);
kfree(mdata);
kfree(rpath);
diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c
index 1e69fdbe76d8..8b74b87d7af7 100644
--- a/fs/cifs/fs_context.c
+++ b/fs/cifs/fs_context.c
@@ -288,7 +288,7 @@ do { \
if (ctx->field) { \
new_ctx->field = kstrdup(ctx->field, GFP_ATOMIC); \
if (new_ctx->field == NULL) { \
- cifs_cleanup_volume_info_contents(new_ctx); \
+ smb3_cleanup_fs_context_contents(new_ctx); \
return -ENOMEM; \
} \
} \
@@ -311,7 +311,7 @@ smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context *ctx
new_ctx->iocharset = NULL;
/*
- * Make sure to stay in sync with cifs_cleanup_volume_info_contents()
+ * Make sure to stay in sync with smb3_cleanup_fs_context_contents()
*/
DUP_CTX_STR(prepath);
DUP_CTX_STR(mount_options);
@@ -615,7 +615,7 @@ static void smb3_fs_context_free(struct fs_context *fc)
{
struct smb3_fs_context *ctx = smb3_fc2context(fc);
- cifs_cleanup_volume_info(ctx);
+ smb3_cleanup_fs_context(ctx);
}
static int smb3_reconfigure(struct fs_context *fc)
@@ -1231,3 +1231,42 @@ int smb3_init_fs_context(struct fs_context *fc)
fc->ops = &smb3_fs_context_ops;
return 0;
}
+
+void
+smb3_cleanup_fs_context_contents(struct smb3_fs_context *ctx)
+{
+ if (ctx == NULL)
+ return;
+
+ /*
+ * Make sure this stays in sync with smb3_fs_context_dup()
+ */
+ kfree(ctx->mount_options);
+ ctx->mount_options = NULL;
+ kfree(ctx->username);
+ ctx->username = NULL;
+ kfree_sensitive(ctx->password);
+ ctx->password = NULL;
+ kfree(ctx->UNC);
+ ctx->UNC = NULL;
+ kfree(ctx->domainname);
+ ctx->domainname = NULL;
+ kfree(ctx->nodename);
+ ctx->nodename = NULL;
+ kfree(ctx->iocharset);
+ ctx->iocharset = NULL;
+ kfree(ctx->prepath);
+ ctx->prepath = NULL;
+
+ unload_nls(ctx->local_nls);
+ ctx->local_nls = NULL;
+}
+
+void
+smb3_cleanup_fs_context(struct smb3_fs_context *ctx)
+{
+ if (!ctx)
+ return;
+ smb3_cleanup_fs_context_contents(ctx);
+ kfree(ctx);
+}
diff --git a/fs/cifs/fs_context.h b/fs/cifs/fs_context.h
index 6e98ef526895..bb3fdce6d7f2 100644
--- a/fs/cifs/fs_context.h
+++ b/fs/cifs/fs_context.h
@@ -252,6 +252,8 @@ extern int cifs_parse_cache_flavor(char *value,
extern int cifs_parse_security_flavors(char *value,
struct smb3_fs_context *ctx);
extern int smb3_init_fs_context(struct fs_context *fc);
+extern void smb3_cleanup_fs_context_contents(struct smb3_fs_context *ctx);
+extern void smb3_cleanup_fs_context(struct smb3_fs_context *ctx);
static inline struct smb3_fs_context *smb3_fc2context(const struct fs_context *fc \
)
--
2.13.6
next prev parent reply other threads:[~2020-12-07 23:40 UTC|newest]
Thread overview: 25+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20201207233646.29823-1-lsahlber@redhat.com>
2020-12-07 23:36 ` [PATCH 02/21] cifs: rename dup_vol to smb3_fs_context_dup and move it into fs_context.c Ronnie Sahlberg
2020-12-07 23:36 ` [PATCH 03/21] cifs: move the enum for cifs parameters into fs_context.h Ronnie Sahlberg
2020-12-07 23:36 ` [PATCH 04/21] cifs: move cifs_parse_devname to fs_context.c Ronnie Sahlberg
2020-12-07 23:36 ` [PATCH 05/21] cifs: switch to new mount api Ronnie Sahlberg
2020-12-07 23:36 ` [PATCH 06/21] cifs: remove the devname argument to cifs_compose_mount_options Ronnie Sahlberg
2020-12-07 23:36 ` [PATCH 07/21] cifs: add an smb3_fs_context to cifs_sb Ronnie Sahlberg
2020-12-07 23:36 ` [PATCH 08/21] cifs: get rid of cifs_sb->mountdata Ronnie Sahlberg
2020-12-07 23:36 ` [PATCH 09/21] cifs: remove [gu]id/backup[gu]id/file_mode/dir_mode from cifs_sb Ronnie Sahlberg
2020-12-12 19:42 ` Steve French
2020-12-07 23:36 ` [PATCH 10/21] cifs: remove actimeo " Ronnie Sahlberg
2020-12-12 19:44 ` Steve French
2020-12-07 23:36 ` Ronnie Sahlberg [this message]
2020-12-07 23:36 ` [PATCH 12/21] cifs: move [brw]size from cifs_sb to cifs_sb->ctx Ronnie Sahlberg
2020-12-07 23:36 ` [PATCH 13/21] cifs: add initial reconfigure support Ronnie Sahlberg
2020-12-07 23:36 ` [PATCH 14/21] cifs: we do not allow changing username/password/unc/... during remount Ronnie Sahlberg
2020-12-08 5:06 ` Steve French
2020-12-08 18:42 ` Pavel Shilovsky
2020-12-08 21:38 ` ronnie sahlberg
2020-12-07 23:36 ` [PATCH 15/21] cifs: simplify handling of cifs_sb/ctx->local_nls Ronnie Sahlberg
2020-12-07 23:36 ` [PATCH 16/21] cifs: don't create a temp nls in cifs_setup_ipc Ronnie Sahlberg
2020-12-07 23:36 ` [PATCH 17/21] cifs: uncomplicate printing the iocharset parameter Ronnie Sahlberg
2020-12-07 23:36 ` [PATCH 18/21] cifs: do not allow changing posix_paths during remount Ronnie Sahlberg
2020-12-07 23:36 ` [PATCH 19/21] cifs: remove ctx argument from cifs_setup_cifs_sb Ronnie Sahlberg
2020-12-07 23:36 ` [PATCH 20/21] cifs: move update of flags into a separate function Ronnie Sahlberg
2020-12-07 23:36 ` [PATCH 21/21] cifs: update mnt_cifs_flags during reconfigure Ronnie Sahlberg
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201207233646.29823-11-lsahlber@redhat.com \
--to=lsahlber@redhat.com \
--cc=linux-cifs@vger.kernel.org \
--cc=smfrench@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).