Skip to content

Commit 2c4fd3d

Browse files
dhowellsSteve French
authored andcommitted
cifs: Fix prepare_write to negotiate wsize if needed
Fix cifs_prepare_write() to negotiate the wsize if it is unset. Reviewed-by: Shyam Prasad N <[email protected]> Reviewed-by: Bharath SM <[email protected]> Signed-off-by: David Howells <[email protected]> cc: Paulo Alcantara <[email protected]> cc: [email protected] cc: [email protected] cc: [email protected] Signed-off-by: Steve French <[email protected]>
1 parent a379a8a commit 2c4fd3d

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fs/smb/client/file.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@ static void cifs_prepare_write(struct netfs_io_subrequest *subreq)
5252
struct netfs_io_stream *stream = &req->rreq.io_streams[subreq->stream_nr];
5353
struct TCP_Server_Info *server;
5454
struct cifsFileInfo *open_file = req->cfile;
55+
struct cifs_sb_info *cifs_sb = CIFS_SB(wdata->rreq->inode->i_sb);
5556
size_t wsize = req->rreq.wsize;
5657
int rc;
5758

@@ -63,6 +64,10 @@ static void cifs_prepare_write(struct netfs_io_subrequest *subreq)
6364
server = cifs_pick_channel(tlink_tcon(open_file->tlink)->ses);
6465
wdata->server = server;
6566

67+
if (cifs_sb->ctx->wsize == 0)
68+
cifs_negotiate_wsize(server, cifs_sb->ctx,
69+
tlink_tcon(req->cfile->tlink));
70+
6671
retry:
6772
if (open_file->invalidHandle) {
6873
rc = cifs_reopen_file(open_file, false);
@@ -160,10 +165,9 @@ static int cifs_prepare_read(struct netfs_io_subrequest *subreq)
160165
server = cifs_pick_channel(tlink_tcon(req->cfile->tlink)->ses);
161166
rdata->server = server;
162167

163-
if (cifs_sb->ctx->rsize == 0) {
168+
if (cifs_sb->ctx->rsize == 0)
164169
cifs_negotiate_rsize(server, cifs_sb->ctx,
165170
tlink_tcon(req->cfile->tlink));
166-
}
167171

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

0 commit comments

Comments
 (0)