* [PATCH][SMB3]Adjust cifssb maximum read size
@ 2022-03-07 18:46 Rohith Surabattula
2022-03-07 18:58 ` Paulo Alcantara
2022-03-07 19:01 ` Steve French
0 siblings, 2 replies; 4+ messages in thread
From: Rohith Surabattula @ 2022-03-07 18:46 UTC (permalink / raw)
To: linux-cifs, Steve French, Shyam Prasad N, ronnie sahlberg,
Paulo Alcantara
[-- Attachment #1: Type: text/plain, Size: 325 bytes --]
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.
Regards,
Rohith
[-- Attachment #2: SMB3-After-5.17-Adjust-cifssb-maximum-read-size.patch --]
[-- Type: application/octet-stream, Size: 1935 bytes --]
From 9405927193198cc03a6ceeae1a19fa9dae25a6cc Mon Sep 17 00:00:00 2001
From: Rohith Surabattula <rohiths@microsoft.com>
Date: Mon, 7 Mar 2022 18:37:22 +0000
Subject: [PATCH] [SMB3][After 5.17]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.
Signed-off-by: Rohith Surabattula <rohiths@microsoft.com>
---
fs/cifs/cifsfs.c | 2 ++
fs/cifs/file.c | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 082c21478686..dfcef71278a1 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -210,6 +210,8 @@ 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..c9f4fa41f1c3 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3740,6 +3740,9 @@ 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 +4477,9 @@ 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
[-- Attachment #3: SMB3-Before-5.17-Adjust-cifssb-maximum-read-size.patch --]
[-- Type: application/octet-stream, Size: 1958 bytes --]
From aa12841d59dc4b52d4035676e95ce9d051fe30d1 Mon Sep 17 00:00:00 2001
From: Rohith Surabattula <rohiths@microsoft.com>
Date: Mon, 7 Mar 2022 17:30:26 +0000
Subject: [PATCH] [SMB3][Before 5.17]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.
Signed-off-by: Rohith Surabattula <rohiths@microsoft.com>
---
fs/cifs/cifsfs.c | 2 ++
fs/cifs/file.c | 6 ++++++
2 files changed, 8 insertions(+)
diff --git a/fs/cifs/cifsfs.c b/fs/cifs/cifsfs.c
index 2ffcb29d5c8f..29f4f419d5fa 100644
--- a/fs/cifs/cifsfs.c
+++ b/fs/cifs/cifsfs.c
@@ -219,6 +219,8 @@ 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 0cc05bf81189..00ba0f46c5db 100644
--- a/fs/cifs/file.c
+++ b/fs/cifs/file.c
@@ -3720,6 +3720,9 @@ 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)
@@ -4491,6 +4494,9 @@ static int cifs_readpages(struct file *file, struct address_space *mapping,
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)
--
2.32.0
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH][SMB3]Adjust cifssb maximum read size
2022-03-07 18:46 [PATCH][SMB3]Adjust cifssb maximum read size Rohith Surabattula
@ 2022-03-07 18:58 ` Paulo Alcantara
2022-03-07 19:33 ` Steve French
2022-03-07 19:01 ` Steve French
1 sibling, 1 reply; 4+ messages in thread
From: Paulo Alcantara @ 2022-03-07 18:58 UTC (permalink / raw)
To: Rohith Surabattula, linux-cifs, Steve French, Shyam Prasad N,
ronnie sahlberg
Rohith Surabattula <rohiths.msft@gmail.com> 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@cjr.nz>
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][SMB3]Adjust cifssb maximum read size
2022-03-07 18:46 [PATCH][SMB3]Adjust cifssb maximum read size Rohith Surabattula
2022-03-07 18:58 ` Paulo Alcantara
@ 2022-03-07 19:01 ` Steve French
1 sibling, 0 replies; 4+ messages in thread
From: Steve French @ 2022-03-07 19:01 UTC (permalink / raw)
To: Rohith Surabattula
Cc: linux-cifs, Shyam Prasad N, ronnie sahlberg, Paulo Alcantara
Could this be related to any of the intermittent xfstest failures?
On Mon, Mar 7, 2022 at 12:46 PM Rohith Surabattula
<rohiths.msft@gmail.com> wrote:
>
> 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.
>
> Regards,
> Rohith
--
Thanks,
Steve
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH][SMB3]Adjust cifssb maximum read size
2022-03-07 18:58 ` Paulo Alcantara
@ 2022-03-07 19:33 ` Steve French
0 siblings, 0 replies; 4+ messages in thread
From: Steve French @ 2022-03-07 19:33 UTC (permalink / raw)
To: Paulo Alcantara
Cc: Rohith Surabattula, linux-cifs, Shyam Prasad N, ronnie sahlberg
[-- Attachment #1: Type: text/plain, Size: 730 bytes --]
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@cjr.nz> wrote:
>
> Rohith Surabattula <rohiths.msft@gmail.com> 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@cjr.nz>
--
Thanks,
Steve
[-- Attachment #2: 0001-Adjust-cifssb-maximum-read-size.patch --]
[-- Type: text/x-patch, Size: 2173 bytes --]
From fb983a0f2df5bf1dd2a4a9bad4bbec1a9f9339c0 Mon Sep 17 00:00:00 2001
From: Rohith Surabattula <rohiths@microsoft.com>
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@microsoft.com>
Acked-by: Paulo Alcantara (SUSE) <pc@cjr.nz>
Signed-off-by: Steve French <stfrench@microsoft.com>
---
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
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2022-03-07 19:33 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-03-07 18:46 [PATCH][SMB3]Adjust cifssb maximum read size Rohith Surabattula
2022-03-07 18:58 ` Paulo Alcantara
2022-03-07 19:33 ` Steve French
2022-03-07 19:01 ` Steve French
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.