Skip to content

Commit 84ebdb8

Browse files
committed
Merge tag '6.3-rc7-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull cifs fixes from Steve French: "Three small smb3 client fixes: - two important fixes for unbuffered read regression with the iov_iter changes (e.g. read soon after mount in some multichannel scenarios) - DFS prefix path fix (also for stable)" * tag '6.3-rc7-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: cifs: Reapply lost fix from commit 30b2b21 cifs: Fix unbuffered read cifs: avoid dup prefix path in dfs_get_automount_devname()
2 parents 8e41e0a + 023fc15 commit 84ebdb8

File tree

4 files changed

+24
-14
lines changed

4 files changed

+24
-14
lines changed

fs/cifs/cifs_dfs_ref.c

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -171,8 +171,6 @@ static struct vfsmount *cifs_dfs_do_automount(struct path *path)
171171
mnt = ERR_CAST(full_path);
172172
goto out;
173173
}
174-
175-
convert_delimiter(full_path, '/');
176174
cifs_dbg(FYI, "%s: full_path: %s\n", __func__, full_path);
177175

178176
tmp = *cur_ctx;

fs/cifs/dfs.h

Lines changed: 18 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,19 +34,33 @@ static inline int dfs_get_referral(struct cifs_mount_ctx *mnt_ctx, const char *p
3434
cifs_remap(cifs_sb), path, ref, tl);
3535
}
3636

37+
/* Return DFS full path out of a dentry set for automount */
3738
static inline char *dfs_get_automount_devname(struct dentry *dentry, void *page)
3839
{
3940
struct cifs_sb_info *cifs_sb = CIFS_SB(dentry->d_sb);
4041
struct cifs_tcon *tcon = cifs_sb_master_tcon(cifs_sb);
4142
struct TCP_Server_Info *server = tcon->ses->server;
43+
size_t len;
44+
char *s;
4245

4346
if (unlikely(!server->origin_fullpath))
4447
return ERR_PTR(-EREMOTE);
4548

46-
return __build_path_from_dentry_optional_prefix(dentry, page,
47-
server->origin_fullpath,
48-
strlen(server->origin_fullpath),
49-
true);
49+
s = dentry_path_raw(dentry, page, PATH_MAX);
50+
if (IS_ERR(s))
51+
return s;
52+
/* for root, we want "" */
53+
if (!s[1])
54+
s++;
55+
56+
len = strlen(server->origin_fullpath);
57+
if (s < (char *)page + len)
58+
return ERR_PTR(-ENAMETOOLONG);
59+
60+
s -= len;
61+
memcpy(s, server->origin_fullpath, len);
62+
convert_delimiter(s, '/');
63+
return s;
5064
}
5165

5266
static inline void dfs_put_root_smb_sessions(struct list_head *head)

fs/cifs/file.c

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4010,7 +4010,6 @@ static void
40104010
collect_uncached_read_data(struct cifs_aio_ctx *ctx)
40114011
{
40124012
struct cifs_readdata *rdata, *tmp;
4013-
struct iov_iter *to = &ctx->iter;
40144013
struct cifs_sb_info *cifs_sb;
40154014
int rc;
40164015

@@ -4076,9 +4075,6 @@ collect_uncached_read_data(struct cifs_aio_ctx *ctx)
40764075
kref_put(&rdata->refcount, cifs_readdata_release);
40774076
}
40784077

4079-
if (!ctx->direct_io)
4080-
ctx->total_len = ctx->len - iov_iter_count(to);
4081-
40824078
/* mask nodata case */
40834079
if (rc == -ENODATA)
40844080
rc = 0;

fs/cifs/smb2pdu.c

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4180,10 +4180,12 @@ smb2_readv_callback(struct mid_q_entry *mid)
41804180
struct smb2_hdr *shdr =
41814181
(struct smb2_hdr *)rdata->iov[0].iov_base;
41824182
struct cifs_credits credits = { .value = 0, .instance = 0 };
4183-
struct smb_rqst rqst = { .rq_iov = &rdata->iov[1],
4184-
.rq_nvec = 1,
4185-
.rq_iter = rdata->iter,
4186-
.rq_iter_size = iov_iter_count(&rdata->iter), };
4183+
struct smb_rqst rqst = { .rq_iov = &rdata->iov[1], .rq_nvec = 1 };
4184+
4185+
if (rdata->got_bytes) {
4186+
rqst.rq_iter = rdata->iter;
4187+
rqst.rq_iter_size = iov_iter_count(&rdata->iter);
4188+
};
41874189

41884190
WARN_ONCE(rdata->server != mid->server,
41894191
"rdata server %p != mid server %p",

0 commit comments

Comments
 (0)