Commit 2c4fd3d1 authored by David Howells's avatar David Howells Committed by Steve French
Browse files

cifs: Fix prepare_write to negotiate wsize if needed



Fix cifs_prepare_write() to negotiate the wsize if it is unset.

Reviewed-by: default avatarShyam Prasad N <nspmangalore@gmail.com>
Reviewed-by: default avatarBharath SM <bharathsm@microsoft.com>
Signed-off-by: default avatarDavid Howells <dhowells@redhat.com>
cc: Paulo Alcantara <pc@manguebit.org>
cc: netfs@lists.linux.dev
cc: linux-fsdevel@vger.kernel.org
cc: linux-cifs@vger.kernel.org
Signed-off-by: default avatarSteve French <stfrench@microsoft.com>
parent a379a8a2
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -52,6 +52,7 @@ static void cifs_prepare_write(struct netfs_io_subrequest *subreq)
	struct netfs_io_stream *stream = &req->rreq.io_streams[subreq->stream_nr];
	struct TCP_Server_Info *server;
	struct cifsFileInfo *open_file = req->cfile;
	struct cifs_sb_info *cifs_sb = CIFS_SB(wdata->rreq->inode->i_sb);
	size_t wsize = req->rreq.wsize;
	int rc;

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

	if (cifs_sb->ctx->wsize == 0)
		cifs_negotiate_wsize(server, cifs_sb->ctx,
				     tlink_tcon(req->cfile->tlink));

retry:
	if (open_file->invalidHandle) {
		rc = cifs_reopen_file(open_file, false);
@@ -160,10 +165,9 @@ static int cifs_prepare_read(struct netfs_io_subrequest *subreq)
	server = cifs_pick_channel(tlink_tcon(req->cfile->tlink)->ses);
	rdata->server = server;

	if (cifs_sb->ctx->rsize == 0) {
	if (cifs_sb->ctx->rsize == 0)
		cifs_negotiate_rsize(server, cifs_sb->ctx,
				     tlink_tcon(req->cfile->tlink));
	}

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