diff options
author | Ronnie Sahlberg <lsahlber@redhat.com> | 2020-12-14 16:40:18 +1000 |
---|---|---|
committer | Steve French <stfrench@microsoft.com> | 2020-12-14 09:26:30 -0600 |
commit | d6a78783407cdf9f8dcf677f7e5a26b1aa22bc0e (patch) | |
tree | f70595ea4274885269726d9e3ae5493b5d88947c /fs/cifs | |
parent | 522aa3b575322597efdd64a517c65b2f43fb6b9c (diff) |
cifs: add initial reconfigure support
Signed-off-by: Ronnie Sahlberg <lsahlber@redhat.com>
Signed-off-by: Steve French <stfrench@microsoft.com>
Diffstat (limited to 'fs/cifs')
-rw-r--r-- | fs/cifs/fs_context.c | 36 |
1 files changed, 33 insertions, 3 deletions
diff --git a/fs/cifs/fs_context.c b/fs/cifs/fs_context.c index b7f5633a1c64..18b469fab521 100644 --- a/fs/cifs/fs_context.c +++ b/fs/cifs/fs_context.c @@ -621,14 +621,44 @@ static void smb3_fs_context_free(struct fs_context *fc) smb3_cleanup_fs_context(ctx); } -static int smb3_reconfigure(struct fs_context *fc) +/* + * Compare the old and new proposed context during reconfigure + * and check if the changes are compatible. + */ +static int smb3_verify_reconfigure_ctx(struct smb3_fs_context *new_ctx, + struct smb3_fs_context *old_ctx) { - // TODO: struct smb3_fs_context *ctx = smb3_fc2context(fc); + if (new_ctx->sectype != old_ctx->sectype) { + cifs_dbg(VFS, "can not change sec during remount\n"); + return -EINVAL; + } - /* FIXME : add actual reconfigure */ return 0; } +static int smb3_reconfigure(struct fs_context *fc) +{ + struct smb3_fs_context *ctx = smb3_fc2context(fc); + struct dentry *root = fc->root; + struct cifs_sb_info *cifs_sb = CIFS_SB(root->d_sb); + int rc; + + rc = smb3_verify_reconfigure_ctx(ctx, cifs_sb->ctx); + if (rc) + return rc; + + /* + * Steal the UNC from the old and to be destroyed context. + */ + ctx->UNC = cifs_sb->ctx->UNC; + cifs_sb->ctx->UNC = NULL; + + smb3_cleanup_fs_context_contents(cifs_sb->ctx); + rc = smb3_fs_context_dup(cifs_sb->ctx, ctx); + + return rc; +} + static int smb3_fs_context_parse_param(struct fs_context *fc, struct fs_parameter *param) { |