Skip to content

Commit 969b301

Browse files
dhowellsSteve French
authored andcommitted
cifs: Only pick a channel once per read request
In cifs, only pick a channel when setting up a read request rather than doing so individually for every subrequest and instead use that channel for all. This mirrors what the code in v6.9 does. Signed-off-by: David Howells <dhowells@redhat.com> cc: Steve French <sfrench@samba.org> cc: Paulo Alcantara <pc@manguebit.com> cc: Jeff Layton <jlayton@kernel.org> cc: linux-cifs@vger.kernel.org cc: netfs@lists.linux.dev cc: linux-fsdevel@vger.kernel.org Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent ce5291e commit 969b301

File tree

2 files changed

+4
-11
lines changed

2 files changed

+4
-11
lines changed

fs/smb/client/cifsglob.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,7 @@ struct cifs_aio_ctx {
14941494
struct cifs_io_request {
14951495
struct netfs_io_request rreq;
14961496
struct cifsFileInfo *cfile;
1497+
struct TCP_Server_Info *server;
14971498
};
14981499

14991500
/* asynchronous read support */

fs/smb/client/file.c

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -134,17 +134,15 @@ static void cifs_issue_write(struct netfs_io_subrequest *subreq)
134134
static bool cifs_clamp_length(struct netfs_io_subrequest *subreq)
135135
{
136136
struct netfs_io_request *rreq = subreq->rreq;
137-
struct TCP_Server_Info *server;
138137
struct cifs_io_subrequest *rdata = container_of(subreq, struct cifs_io_subrequest, subreq);
139138
struct cifs_io_request *req = container_of(subreq->rreq, struct cifs_io_request, rreq);
139+
struct TCP_Server_Info *server = req->server;
140140
struct cifs_sb_info *cifs_sb = CIFS_SB(rreq->inode->i_sb);
141141
size_t rsize = 0;
142142
int rc;
143143

144144
rdata->xid = get_xid();
145145
rdata->have_xid = true;
146-
147-
server = cifs_pick_channel(tlink_tcon(req->cfile->tlink)->ses);
148146
rdata->server = server;
149147

150148
if (cifs_sb->ctx->rsize == 0)
@@ -203,14 +201,7 @@ static void cifs_req_issue_read(struct netfs_io_subrequest *subreq)
203201
__set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags);
204202
rdata->pid = pid;
205203

206-
rc = adjust_credits(rdata->server, &rdata->credits, rdata->subreq.len);
207-
if (!rc) {
208-
if (rdata->req->cfile->invalidHandle)
209-
rc = -EAGAIN;
210-
else
211-
rc = rdata->server->ops->async_readv(rdata);
212-
}
213-
204+
rc = rdata->server->ops->async_readv(rdata);
214205
out:
215206
if (rc)
216207
netfs_subreq_terminated(subreq, rc, false);
@@ -250,6 +241,7 @@ static int cifs_init_request(struct netfs_io_request *rreq, struct file *file)
250241
open_file = file->private_data;
251242
rreq->netfs_priv = file->private_data;
252243
req->cfile = cifsFileInfo_get(open_file);
244+
req->server = cifs_pick_channel(tlink_tcon(req->cfile->tlink)->ses);
253245
} else if (rreq->origin != NETFS_WRITEBACK) {
254246
WARN_ON_ONCE(1);
255247
return -EIO;

0 commit comments

Comments
 (0)