Skip to content

Commit 06a4665

Browse files
rohiths-msftsmfrench
authored andcommitted
Adjust cifssb maximum read size
When session gets reconnected during mount then read size in super block fs context gets set to zero and after negotiate, rsize is not modified which results in incorrect read with requested bytes as zero. Fixes intermittent failure of xfstest generic/240 Note that stable requires a different version of this patch which will be sent to the stable mailing list. Signed-off-by: Rohith Surabattula <[email protected]> Acked-by: Paulo Alcantara (SUSE) <[email protected]> Signed-off-by: Steve French <[email protected]>
1 parent 84330d4 commit 06a4665

File tree

2 files changed

+13
-0
lines changed

2 files changed

+13
-0
lines changed

fs/cifs/cifsfs.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,9 @@ cifs_read_super(struct super_block *sb)
210210
if (rc)
211211
goto out_no_root;
212212
/* tune readahead according to rsize if readahead size not set on mount */
213+
if (cifs_sb->ctx->rsize == 0)
214+
cifs_sb->ctx->rsize =
215+
tcon->ses->server->ops->negotiate_rsize(tcon, cifs_sb->ctx);
213216
if (cifs_sb->ctx->rasize)
214217
sb->s_bdi->ra_pages = cifs_sb->ctx->rasize / PAGE_SIZE;
215218
else

fs/cifs/file.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3740,6 +3740,11 @@ cifs_send_async_read(loff_t offset, size_t len, struct cifsFileInfo *open_file,
37403740
break;
37413741
}
37423742

3743+
if (cifs_sb->ctx->rsize == 0)
3744+
cifs_sb->ctx->rsize =
3745+
server->ops->negotiate_rsize(tlink_tcon(open_file->tlink),
3746+
cifs_sb->ctx);
3747+
37433748
rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize,
37443749
&rsize, credits);
37453750
if (rc)
@@ -4474,6 +4479,11 @@ static void cifs_readahead(struct readahead_control *ractl)
44744479
}
44754480
}
44764481

4482+
if (cifs_sb->ctx->rsize == 0)
4483+
cifs_sb->ctx->rsize =
4484+
server->ops->negotiate_rsize(tlink_tcon(open_file->tlink),
4485+
cifs_sb->ctx);
4486+
44774487
rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize,
44784488
&rsize, credits);
44794489
if (rc)

0 commit comments

Comments
 (0)