Skip to content

Commit 7989807

Browse files
committed
Merge tag '5.11-rc7-smb3-github' of git://github.com/smfrench/smb3-kernel
Pull cifs fixes from Steve French: "Four small smb3 fixes to the new mount API (including a particularly important one for DFS links). These were found in testing this week of additional DFS scenarios, and a user testing of an apache container problem" * tag '5.11-rc7-smb3-github' of git://github.com/smfrench/smb3-kernel: cifs: Set CIFS_MOUNT_USE_PREFIX_PATH flag on setting cifs_sb->prepath. cifs: In the new mount api we get the full devname as source= cifs: do not disable noperm if multiuser mount option is not provided cifs: fix dfs-links
2 parents c6d8570 + a738c93 commit 7989807

File tree

4 files changed

+28
-4
lines changed

4 files changed

+28
-4
lines changed

fs/cifs/cifsfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ cifs_show_cache_flavor(struct seq_file *s, struct cifs_sb_info *cifs_sb)
469469
static int cifs_show_devname(struct seq_file *m, struct dentry *root)
470470
{
471471
struct cifs_sb_info *cifs_sb = CIFS_SB(root->d_sb);
472-
char *devname = kstrdup(cifs_sb->ctx->UNC, GFP_KERNEL);
472+
char *devname = kstrdup(cifs_sb->ctx->source, GFP_KERNEL);
473473

474474
if (devname == NULL)
475475
seq_puts(m, "none");

fs/cifs/connect.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2756,6 +2756,7 @@ int cifs_setup_cifs_sb(struct cifs_sb_info *cifs_sb)
27562756
cifs_sb->prepath = kstrdup(ctx->prepath, GFP_KERNEL);
27572757
if (cifs_sb->prepath == NULL)
27582758
return -ENOMEM;
2759+
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_USE_PREFIX_PATH;
27592760
}
27602761

27612762
return 0;
@@ -2983,6 +2984,14 @@ expand_dfs_referral(const unsigned int xid, struct cifs_ses *ses,
29832984
rc = PTR_ERR(mdata);
29842985
mdata = NULL;
29852986
} else {
2987+
/*
2988+
* We can not clear out the whole structure since we
2989+
* no longer have an explicit function to parse
2990+
* a mount-string. Instead we need to clear out the
2991+
* individual fields that are no longer valid.
2992+
*/
2993+
kfree(ctx->prepath);
2994+
ctx->prepath = NULL;
29862995
rc = cifs_setup_volume_info(ctx, mdata, fake_devname);
29872996
}
29882997
kfree(fake_devname);

fs/cifs/fs_context.c

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,6 @@ const struct fs_parameter_spec smb3_fs_parameters[] = {
148148

149149
/* Mount options which take string value */
150150
fsparam_string("source", Opt_source),
151-
fsparam_string("unc", Opt_source),
152151
fsparam_string("user", Opt_user),
153152
fsparam_string("username", Opt_user),
154153
fsparam_string("pass", Opt_pass),
@@ -178,6 +177,11 @@ const struct fs_parameter_spec smb3_fs_parameters[] = {
178177
fsparam_flag_no("auto", Opt_ignore),
179178
fsparam_string("cred", Opt_ignore),
180179
fsparam_string("credentials", Opt_ignore),
180+
/*
181+
* UNC and prefixpath is now extracted from Opt_source
182+
* in the new mount API so we can just ignore them going forward.
183+
*/
184+
fsparam_string("unc", Opt_ignore),
181185
fsparam_string("prefixpath", Opt_ignore),
182186
{}
183187
};
@@ -313,6 +317,7 @@ smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context *ctx
313317
new_ctx->password = NULL;
314318
new_ctx->domainname = NULL;
315319
new_ctx->UNC = NULL;
320+
new_ctx->source = NULL;
316321
new_ctx->iocharset = NULL;
317322

318323
/*
@@ -323,6 +328,7 @@ smb3_fs_context_dup(struct smb3_fs_context *new_ctx, struct smb3_fs_context *ctx
323328
DUP_CTX_STR(username);
324329
DUP_CTX_STR(password);
325330
DUP_CTX_STR(UNC);
331+
DUP_CTX_STR(source);
326332
DUP_CTX_STR(domainname);
327333
DUP_CTX_STR(nodename);
328334
DUP_CTX_STR(iocharset);
@@ -732,6 +738,7 @@ static int smb3_reconfigure(struct fs_context *fc)
732738
* just use what we already have in cifs_sb->ctx.
733739
*/
734740
STEAL_STRING(cifs_sb, ctx, UNC);
741+
STEAL_STRING(cifs_sb, ctx, source);
735742
STEAL_STRING(cifs_sb, ctx, username);
736743
STEAL_STRING(cifs_sb, ctx, password);
737744
STEAL_STRING(cifs_sb, ctx, domainname);
@@ -974,6 +981,11 @@ static int smb3_fs_context_parse_param(struct fs_context *fc,
974981
cifs_dbg(VFS, "Unknown error parsing devname\n");
975982
goto cifs_parse_mount_err;
976983
}
984+
ctx->source = kstrdup(param->string, GFP_KERNEL);
985+
if (ctx->source == NULL) {
986+
cifs_dbg(VFS, "OOM when copying UNC string\n");
987+
goto cifs_parse_mount_err;
988+
}
977989
fc->source = kstrdup(param->string, GFP_KERNEL);
978990
if (fc->source == NULL) {
979991
cifs_dbg(VFS, "OOM when copying UNC string\n");
@@ -1396,6 +1408,8 @@ smb3_cleanup_fs_context_contents(struct smb3_fs_context *ctx)
13961408
ctx->password = NULL;
13971409
kfree(ctx->UNC);
13981410
ctx->UNC = NULL;
1411+
kfree(ctx->source);
1412+
ctx->source = NULL;
13991413
kfree(ctx->domainname);
14001414
ctx->domainname = NULL;
14011415
kfree(ctx->nodename);
@@ -1533,8 +1547,8 @@ void smb3_update_mnt_flags(struct cifs_sb_info *cifs_sb)
15331547
cifs_sb->mnt_cifs_flags |= (CIFS_MOUNT_MULTIUSER |
15341548
CIFS_MOUNT_NO_PERM);
15351549
else
1536-
cifs_sb->mnt_cifs_flags &= ~(CIFS_MOUNT_MULTIUSER |
1537-
CIFS_MOUNT_NO_PERM);
1550+
cifs_sb->mnt_cifs_flags &= ~CIFS_MOUNT_MULTIUSER;
1551+
15381552

15391553
if (ctx->strict_io)
15401554
cifs_sb->mnt_cifs_flags |= CIFS_MOUNT_STRICT_IO;

fs/cifs/fs_context.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -159,6 +159,7 @@ struct smb3_fs_context {
159159
char *username;
160160
char *password;
161161
char *domainname;
162+
char *source;
162163
char *UNC;
163164
char *nodename;
164165
char *iocharset; /* local code page for mapping to and from Unicode */

0 commit comments

Comments
 (0)