Lightly updated to fix checkpatch warnings about line length and to add Paulo's acked-by. See attached. And tentatively merged to cifs-2.6.git for-next pending testing On Mon, Mar 7, 2022 at 12:59 PM Paulo Alcantara <pc@xxxxxx> wrote: > > Rohith Surabattula <rohiths.msft@xxxxxxxxx> writes: > > > Hi All, > > > > 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. > > > > Attaching 2 patches, one for releases before 5.17 and other for latest. > > Please take a look. > > LGTM. Thanks Rohith! > > Acked-by: Paulo Alcantara (SUSE) <pc@xxxxxx> -- Thanks, Steve
From fb983a0f2df5bf1dd2a4a9bad4bbec1a9f9339c0 Mon Sep 17 00:00:00 2001 From: Rohith Surabattula <rohiths@xxxxxxxxxxxxx> Date: Mon, 7 Mar 2022 18:37:22 +0000 Subject: [PATCH] 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. Note that stable requires a different version of this patch which will be sent to the stable mailing list. Signed-off-by: Rohith Surabattula <rohiths@xxxxxxxxxxxxx> Acked-by: Paulo Alcantara (SUSE) <pc@xxxxxx> Signed-off-by: Steve French <stfrench@xxxxxxxxxxxxx> --- fs/cifs/cifsfs.c | 3 +++ fs/cifs/file.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c index a61bb5d683c6..677c02aa8731 100644 --- a/fs/cifs/cifsfs.c +++ b/fs/cifs/cifsfs.c @@ -210,6 +210,9 @@ cifs_read_super(struct super_block *sb) if (rc) goto out_no_root; /* tune readahead according to rsize if readahead size not set on mount */ + if (cifs_sb->ctx->rsize == 0) + cifs_sb->ctx->rsize = + tcon->ses->server->ops->negotiate_rsize(tcon, cifs_sb->ctx); if (cifs_sb->ctx->rasize) sb->s_bdi->ra_pages = cifs_sb->ctx->rasize / PAGE_SIZE; else diff --git a/fs/cifs/file.c b/fs/cifs/file.c index e7af802dcfa6..a2723f7cb5e9 100644 --- a/fs/cifs/file.c +++ b/fs/cifs/file.c @@ -3740,6 +3740,11 @@ cifs_send_async_read(loff_t offset, size_t len, struct cifsFileInfo *open_file, break; } + if (cifs_sb->ctx->rsize == 0) + cifs_sb->ctx->rsize = + server->ops->negotiate_rsize(tlink_tcon(open_file->tlink), + cifs_sb->ctx); + rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize, &rsize, credits); if (rc) @@ -4474,6 +4479,11 @@ static void cifs_readahead(struct readahead_control *ractl) } } + if (cifs_sb->ctx->rsize == 0) + cifs_sb->ctx->rsize = + server->ops->negotiate_rsize(tlink_tcon(open_file->tlink), + cifs_sb->ctx); + rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize, &rsize, credits); if (rc) -- 2.32.0