Skip to content

Commit d14f278

Browse files
committed
Merge tag '6.10-rc4-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6
Pull smb client fixes from Steve French: "Five smb3 client fixes - three nets/fiolios cifs fixes - fix typo in module parameters description - fix incorrect swap warning" * tag '6.10-rc4-smb3-client-fixes' of git://git.samba.org/sfrench/cifs-2.6: cifs: Move the 'pid' from the subreq to the req cifs: Only pick a channel once per read request cifs: Defer read completion cifs: fix typo in module parameter enable_gcm_256 cifs: drop the incorrect assertion in cifs_swap_rw()
2 parents 0971e82 + 3f59138 commit d14f278

File tree

5 files changed

+27
-32
lines changed

5 files changed

+27
-32
lines changed

fs/smb/client/cifsfs.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,7 @@ module_param(enable_oplocks, bool, 0644);
134134
MODULE_PARM_DESC(enable_oplocks, "Enable or disable oplocks. Default: y/Y/1");
135135

136136
module_param(enable_gcm_256, bool, 0644);
137-
MODULE_PARM_DESC(enable_gcm_256, "Enable requesting strongest (256 bit) GCM encryption. Default: n/N/0");
137+
MODULE_PARM_DESC(enable_gcm_256, "Enable requesting strongest (256 bit) GCM encryption. Default: y/Y/0");
138138

139139
module_param(require_gcm_256, bool, 0644);
140140
MODULE_PARM_DESC(require_gcm_256, "Require strongest (256 bit) GCM encryption. Default: n/N/0");

fs/smb/client/cifsglob.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1494,6 +1494,8 @@ 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;
1498+
pid_t pid;
14971499
};
14981500

14991501
/* asynchronous read support */
@@ -1504,7 +1506,6 @@ struct cifs_io_subrequest {
15041506
struct cifs_io_request *req;
15051507
};
15061508
ssize_t got_bytes;
1507-
pid_t pid;
15081509
unsigned int xid;
15091510
int result;
15101511
bool have_xid;

fs/smb/client/cifssmb.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1345,8 +1345,8 @@ cifs_async_readv(struct cifs_io_subrequest *rdata)
13451345
if (rc)
13461346
return rc;
13471347

1348-
smb->hdr.Pid = cpu_to_le16((__u16)rdata->pid);
1349-
smb->hdr.PidHigh = cpu_to_le16((__u16)(rdata->pid >> 16));
1348+
smb->hdr.Pid = cpu_to_le16((__u16)rdata->req->pid);
1349+
smb->hdr.PidHigh = cpu_to_le16((__u16)(rdata->req->pid >> 16));
13501350

13511351
smb->AndXCommand = 0xFF; /* none */
13521352
smb->Fid = rdata->req->cfile->fid.netfid;
@@ -1689,8 +1689,8 @@ cifs_async_writev(struct cifs_io_subrequest *wdata)
16891689
if (rc)
16901690
goto async_writev_out;
16911691

1692-
smb->hdr.Pid = cpu_to_le16((__u16)wdata->pid);
1693-
smb->hdr.PidHigh = cpu_to_le16((__u16)(wdata->pid >> 16));
1692+
smb->hdr.Pid = cpu_to_le16((__u16)wdata->req->pid);
1693+
smb->hdr.PidHigh = cpu_to_le16((__u16)(wdata->req->pid >> 16));
16941694

16951695
smb->AndXCommand = 0xFF; /* none */
16961696
smb->Fid = wdata->req->cfile->fid.netfid;

fs/smb/client/file.c

Lines changed: 6 additions & 21 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)
@@ -179,15 +177,8 @@ static void cifs_req_issue_read(struct netfs_io_subrequest *subreq)
179177
struct netfs_io_request *rreq = subreq->rreq;
180178
struct cifs_io_subrequest *rdata = container_of(subreq, struct cifs_io_subrequest, subreq);
181179
struct cifs_io_request *req = container_of(subreq->rreq, struct cifs_io_request, rreq);
182-
struct cifs_sb_info *cifs_sb = CIFS_SB(rreq->inode->i_sb);
183-
pid_t pid;
184180
int rc = 0;
185181

186-
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
187-
pid = req->cfile->pid;
188-
else
189-
pid = current->tgid; // Ummm... This may be a workqueue
190-
191182
cifs_dbg(FYI, "%s: op=%08x[%x] mapping=%p len=%zu/%zu\n",
192183
__func__, rreq->debug_id, subreq->debug_index, rreq->mapping,
193184
subreq->transferred, subreq->len);
@@ -201,16 +192,8 @@ static void cifs_req_issue_read(struct netfs_io_subrequest *subreq)
201192
}
202193

203194
__set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags);
204-
rdata->pid = pid;
205-
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-
}
213195

196+
rc = rdata->server->ops->async_readv(rdata);
214197
out:
215198
if (rc)
216199
netfs_subreq_terminated(subreq, rc, false);
@@ -245,11 +228,15 @@ static int cifs_init_request(struct netfs_io_request *rreq, struct file *file)
245228

246229
rreq->rsize = cifs_sb->ctx->rsize;
247230
rreq->wsize = cifs_sb->ctx->wsize;
231+
req->pid = current->tgid; // Ummm... This may be a workqueue
248232

249233
if (file) {
250234
open_file = file->private_data;
251235
rreq->netfs_priv = file->private_data;
252236
req->cfile = cifsFileInfo_get(open_file);
237+
req->server = cifs_pick_channel(tlink_tcon(req->cfile->tlink)->ses);
238+
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
239+
req->pid = req->cfile->pid;
253240
} else if (rreq->origin != NETFS_WRITEBACK) {
254241
WARN_ON_ONCE(1);
255242
return -EIO;
@@ -3200,8 +3187,6 @@ static int cifs_swap_rw(struct kiocb *iocb, struct iov_iter *iter)
32003187
{
32013188
ssize_t ret;
32023189

3203-
WARN_ON_ONCE(iov_iter_count(iter) != PAGE_SIZE);
3204-
32053190
if (iov_iter_rw(iter) == READ)
32063191
ret = netfs_unbuffered_read_iter_locked(iocb, iter);
32073192
else

fs/smb/client/smb2pdu.c

Lines changed: 14 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4484,6 +4484,16 @@ smb2_new_read_req(void **buf, unsigned int *total_len,
44844484
return rc;
44854485
}
44864486

4487+
static void smb2_readv_worker(struct work_struct *work)
4488+
{
4489+
struct cifs_io_subrequest *rdata =
4490+
container_of(work, struct cifs_io_subrequest, subreq.work);
4491+
4492+
netfs_subreq_terminated(&rdata->subreq,
4493+
(rdata->result == 0 || rdata->result == -EAGAIN) ?
4494+
rdata->got_bytes : rdata->result, true);
4495+
}
4496+
44874497
static void
44884498
smb2_readv_callback(struct mid_q_entry *mid)
44894499
{
@@ -4578,9 +4588,8 @@ smb2_readv_callback(struct mid_q_entry *mid)
45784588
rdata->result = 0;
45794589
}
45804590
rdata->credits.value = 0;
4581-
netfs_subreq_terminated(&rdata->subreq,
4582-
(rdata->result == 0 || rdata->result == -EAGAIN) ?
4583-
rdata->got_bytes : rdata->result, true);
4591+
INIT_WORK(&rdata->subreq.work, smb2_readv_worker);
4592+
queue_work(cifsiod_wq, &rdata->subreq.work);
45844593
release_mid(mid);
45854594
add_credits(server, &credits, 0);
45864595
}
@@ -4612,7 +4621,7 @@ smb2_async_readv(struct cifs_io_subrequest *rdata)
46124621
io_parms.length = rdata->subreq.len;
46134622
io_parms.persistent_fid = rdata->req->cfile->fid.persistent_fid;
46144623
io_parms.volatile_fid = rdata->req->cfile->fid.volatile_fid;
4615-
io_parms.pid = rdata->pid;
4624+
io_parms.pid = rdata->req->pid;
46164625

46174626
rc = smb2_new_read_req(
46184627
(void **) &buf, &total_len, &io_parms, rdata, 0, 0);
@@ -4864,7 +4873,7 @@ smb2_async_writev(struct cifs_io_subrequest *wdata)
48644873
.length = wdata->subreq.len,
48654874
.persistent_fid = wdata->req->cfile->fid.persistent_fid,
48664875
.volatile_fid = wdata->req->cfile->fid.volatile_fid,
4867-
.pid = wdata->pid,
4876+
.pid = wdata->req->pid,
48684877
};
48694878
io_parms = &_io_parms;
48704879

0 commit comments

Comments
 (0)