Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Merge tag '5.11-rc5-smb3' of git://git.samba.org/sfrench/cifs-2.6

Pull cifs fixes from Steve French:
"Four cifs patches found in additional testing of the conversion to the
new mount API: three small option processing ones, and one fixing domain
based DFS referrals"

* tag '5.11-rc5-smb3' of git://git.samba.org/sfrench/cifs-2.6:
cifs: fix dfs domain referrals
cifs: returning mount parm processing errors correctly
cifs: fix mounts to subdirectories of target
cifs: ignore auto and noauto options if given

+81 -20
+8 -4
fs/cifs/cifs_dfs_ref.c
··· 133 133 * Caller is responsible for freeing returned value if it is not error. 134 134 */ 135 135 char *cifs_compose_mount_options(const char *sb_mountdata, 136 - const char *fullpath, 137 - const struct dfs_info3_param *ref) 136 + const char *fullpath, 137 + const struct dfs_info3_param *ref, 138 + char **devname) 138 139 { 139 140 int rc; 140 141 char *name; ··· 232 231 strcat(mountdata, "ip="); 233 232 strcat(mountdata, srvIP); 234 233 235 - kfree(name); 234 + if (devname) 235 + *devname = name; 236 + else 237 + kfree(name); 236 238 237 239 /*cifs_dbg(FYI, "%s: parent mountdata: %s\n", __func__, sb_mountdata);*/ 238 240 /*cifs_dbg(FYI, "%s: submount mountdata: %s\n", __func__, mountdata );*/ ··· 282 278 283 279 /* strip first '\' from fullpath */ 284 280 mountdata = cifs_compose_mount_options(cifs_sb->ctx->mount_options, 285 - fullpath + 1, NULL); 281 + fullpath + 1, NULL, NULL); 286 282 if (IS_ERR(mountdata)) { 287 283 kfree(devname); 288 284 return (struct vfsmount *)mountdata;
+1 -1
fs/cifs/cifsfs.c
··· 822 822 goto out; 823 823 } 824 824 825 - rc = cifs_setup_volume_info(cifs_sb->ctx); 825 + rc = cifs_setup_volume_info(cifs_sb->ctx, NULL, old_ctx->UNC); 826 826 if (rc) { 827 827 root = ERR_PTR(rc); 828 828 goto out;
+4 -2
fs/cifs/cifsproto.h
··· 78 78 int add_treename); 79 79 extern char *build_wildcard_path_from_dentry(struct dentry *direntry); 80 80 extern char *cifs_compose_mount_options(const char *sb_mountdata, 81 - const char *fullpath, const struct dfs_info3_param *ref); 81 + const char *fullpath, const struct dfs_info3_param *ref, 82 + char **devname); 82 83 /* extern void renew_parental_timestamps(struct dentry *direntry);*/ 83 84 extern struct mid_q_entry *AllocMidQEntry(const struct smb_hdr *smb_buffer, 84 85 struct TCP_Server_Info *server); ··· 90 89 extern int cifs_handle_standard(struct TCP_Server_Info *server, 91 90 struct mid_q_entry *mid); 92 91 extern int smb3_parse_devname(const char *devname, struct smb3_fs_context *ctx); 92 + extern int smb3_parse_opt(const char *options, const char *key, char **val); 93 93 extern bool cifs_match_ipaddr(struct sockaddr *srcaddr, struct sockaddr *rhs); 94 94 extern int cifs_discard_remaining_data(struct TCP_Server_Info *server); 95 95 extern int cifs_call_async(struct TCP_Server_Info *server, ··· 551 549 unsigned char *p24); 552 550 553 551 extern int 554 - cifs_setup_volume_info(struct smb3_fs_context *ctx); 552 + cifs_setup_volume_info(struct smb3_fs_context *ctx, const char *mntopts, const char *devname); 555 553 556 554 extern struct TCP_Server_Info * 557 555 cifs_find_tcp_session(struct smb3_fs_context *ctx);
+26 -6
fs/cifs/connect.c
··· 2972 2972 rc = dfs_cache_find(xid, ses, cifs_sb->local_nls, cifs_remap(cifs_sb), 2973 2973 ref_path, &referral, NULL); 2974 2974 if (!rc) { 2975 + char *fake_devname = NULL; 2976 + 2975 2977 mdata = cifs_compose_mount_options(cifs_sb->ctx->mount_options, 2976 - full_path + 1, &referral); 2978 + full_path + 1, &referral, 2979 + &fake_devname); 2977 2980 free_dfs_info_param(&referral); 2978 2981 2979 2982 if (IS_ERR(mdata)) { 2980 2983 rc = PTR_ERR(mdata); 2981 2984 mdata = NULL; 2982 2985 } else { 2983 - smb3_cleanup_fs_context_contents(ctx); 2984 - rc = cifs_setup_volume_info(ctx); 2986 + rc = cifs_setup_volume_info(ctx, mdata, fake_devname); 2985 2987 } 2988 + kfree(fake_devname); 2986 2989 kfree(cifs_sb->ctx->mount_options); 2987 2990 cifs_sb->ctx->mount_options = mdata; 2988 2991 } ··· 3039 3036 struct dfs_info3_param ref = {0}; 3040 3037 char *mdata = NULL; 3041 3038 struct smb3_fs_context fake_ctx = {NULL}; 3039 + char *fake_devname = NULL; 3042 3040 3043 3041 cifs_dbg(FYI, "%s: dfs path: %s\n", __func__, path); 3044 3042 ··· 3048 3044 return rc; 3049 3045 3050 3046 mdata = cifs_compose_mount_options(cifs_sb->ctx->mount_options, 3051 - full_path + 1, &ref); 3047 + full_path + 1, &ref, 3048 + &fake_devname); 3052 3049 free_dfs_info_param(&ref); 3053 3050 3054 3051 if (IS_ERR(mdata)) { 3055 3052 rc = PTR_ERR(mdata); 3056 3053 mdata = NULL; 3057 3054 } else 3058 - rc = cifs_setup_volume_info(&fake_ctx); 3055 + rc = cifs_setup_volume_info(&fake_ctx, mdata, fake_devname); 3059 3056 3060 3057 kfree(mdata); 3058 + kfree(fake_devname); 3061 3059 3062 3060 if (!rc) { 3063 3061 /* ··· 3128 3122 * we should pass a clone of the original context? 3129 3123 */ 3130 3124 int 3131 - cifs_setup_volume_info(struct smb3_fs_context *ctx) 3125 + cifs_setup_volume_info(struct smb3_fs_context *ctx, const char *mntopts, const char *devname) 3132 3126 { 3133 3127 int rc = 0; 3128 + 3129 + smb3_parse_devname(devname, ctx); 3130 + 3131 + if (mntopts) { 3132 + char *ip; 3133 + 3134 + cifs_dbg(FYI, "%s: mntopts=%s\n", __func__, mntopts); 3135 + rc = smb3_parse_opt(mntopts, "ip", &ip); 3136 + if (!rc && !cifs_convert_address((struct sockaddr *)&ctx->dstaddr, ip, 3137 + strlen(ip))) { 3138 + cifs_dbg(VFS, "%s: failed to convert ip address\n", __func__); 3139 + return -EINVAL; 3140 + } 3141 + } 3134 3142 3135 3143 if (ctx->nullauth) { 3136 3144 cifs_dbg(FYI, "Anonymous login\n");
+5 -3
fs/cifs/dfs_cache.c
··· 1417 1417 int rc; 1418 1418 struct cache_entry *ce; 1419 1419 struct dfs_info3_param ref = {0}; 1420 - char *mdata = NULL; 1420 + char *mdata = NULL, *devname = NULL; 1421 1421 struct TCP_Server_Info *server; 1422 1422 struct cifs_ses *ses; 1423 1423 struct smb3_fs_context ctx = {NULL}; ··· 1444 1444 1445 1445 up_read(&htable_rw_lock); 1446 1446 1447 - mdata = cifs_compose_mount_options(vi->mntdata, rpath, &ref); 1447 + mdata = cifs_compose_mount_options(vi->mntdata, rpath, &ref, 1448 + &devname); 1448 1449 free_dfs_info_param(&ref); 1449 1450 1450 1451 if (IS_ERR(mdata)) { ··· 1454 1453 goto out; 1455 1454 } 1456 1455 1457 - rc = cifs_setup_volume_info(&ctx); 1456 + rc = cifs_setup_volume_info(&ctx, NULL, devname); 1458 1457 1459 1458 if (rc) { 1460 1459 ses = ERR_PTR(rc); ··· 1473 1472 smb3_cleanup_fs_context_contents(&ctx); 1474 1473 kfree(mdata); 1475 1474 kfree(rpath); 1475 + kfree(devname); 1476 1476 1477 1477 return ses; 1478 1478 }
+37 -4
fs/cifs/fs_context.c
··· 175 175 fsparam_flag_no("exec", Opt_ignore), 176 176 fsparam_flag_no("dev", Opt_ignore), 177 177 fsparam_flag_no("mand", Opt_ignore), 178 + fsparam_flag_no("auto", Opt_ignore), 178 179 fsparam_string("cred", Opt_ignore), 179 180 fsparam_string("credentials", Opt_ignore), 181 + fsparam_string("prefixpath", Opt_ignore), 180 182 {} 181 183 }; 182 184 ··· 401 399 return 0; 402 400 } 403 401 402 + int smb3_parse_opt(const char *options, const char *key, char **val) 403 + { 404 + int rc = -ENOENT; 405 + char *opts, *orig, *p; 406 + 407 + orig = opts = kstrdup(options, GFP_KERNEL); 408 + if (!opts) 409 + return -ENOMEM; 410 + 411 + while ((p = strsep(&opts, ","))) { 412 + char *nval; 413 + 414 + if (!*p) 415 + continue; 416 + if (strncasecmp(p, key, strlen(key))) 417 + continue; 418 + nval = strchr(p, '='); 419 + if (nval) { 420 + if (nval == p) 421 + continue; 422 + *nval++ = 0; 423 + *val = kstrndup(nval, strlen(nval), GFP_KERNEL); 424 + rc = !*val ? -ENOMEM : 0; 425 + goto out; 426 + } 427 + } 428 + out: 429 + kfree(orig); 430 + return rc; 431 + } 432 + 404 433 /* 405 434 * Parse a devname into substrings and populate the ctx->UNC and ctx->prepath 406 435 * fields with the result. Returns 0 on success and an error otherwise ··· 564 531 565 532 if (ctx->rdma && ctx->vals->protocol_id < SMB30_PROT_ID) { 566 533 cifs_dbg(VFS, "SMB Direct requires Version >=3.0\n"); 567 - return -1; 534 + return -EOPNOTSUPP; 568 535 } 569 536 570 537 #ifndef CONFIG_KEYS ··· 587 554 /* make sure UNC has a share name */ 588 555 if (strlen(ctx->UNC) < 3 || !strchr(ctx->UNC + 3, '\\')) { 589 556 cifs_dbg(VFS, "Malformed UNC. Unable to find share name.\n"); 590 - return -1; 557 + return -ENOENT; 591 558 } 592 559 593 560 if (!ctx->got_ip) { ··· 601 568 if (!cifs_convert_address((struct sockaddr *)&ctx->dstaddr, 602 569 &ctx->UNC[2], len)) { 603 570 pr_err("Unable to determine destination address\n"); 604 - return -1; 571 + return -EHOSTUNREACH; 605 572 } 606 573 } 607 574 ··· 1296 1263 return 0; 1297 1264 1298 1265 cifs_parse_mount_err: 1299 - return 1; 1266 + return -EINVAL; 1300 1267 } 1301 1268 1302 1269 int smb3_init_fs_context(struct fs_context *fc)