Skip to content

Commit 3965c23

Browse files
Paulo AlcantaraSteve French
authored andcommitted
smb: client: fix zero rsize error messages
cifs_prepare_read() might be called with a disconnected channel, where TCP_Server_Info::max_read is set to zero due to reconnect, so calling ->negotiate_rize() will set @rsize to default min IO size (64KiB) and then logging CIFS: VFS: SMB: Zero rsize calculated, using minimum value 65536 If the reconnect happens in cifsd thread, cifs_renegotiate_iosize() will end up being called and then @rsize set to the expected value. Since we can't rely on the value of @server->max_read by the time we call cifs_prepare_read(), try to ->negotiate_rize() only if @cifs_sb->ctx->rsize is zero. Reported-by: Steve French <stfrench@microsoft.com> Fixes: c59f7c9 ("smb: client: ensure aligned IO sizes") Signed-off-by: Paulo Alcantara (Red Hat) <pc@manguebit.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent 1fe4a44 commit 3965c23

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

fs/smb/client/file.c

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,10 @@ static int cifs_prepare_read(struct netfs_io_subrequest *subreq)
160160
server = cifs_pick_channel(tlink_tcon(req->cfile->tlink)->ses);
161161
rdata->server = server;
162162

163-
cifs_negotiate_rsize(server, cifs_sb->ctx,
164-
tlink_tcon(req->cfile->tlink));
163+
if (cifs_sb->ctx->rsize == 0) {
164+
cifs_negotiate_rsize(server, cifs_sb->ctx,
165+
tlink_tcon(req->cfile->tlink));
166+
}
165167

166168
rc = server->ops->wait_mtu_credits(server, cifs_sb->ctx->rsize,
167169
&size, &rdata->credits);

0 commit comments

Comments
 (0)