Skip to content

Commit 3f59138

Browse files
dhowellsSteve French
authored andcommitted
cifs: Move the 'pid' from the subreq to the req
Move the reference pid from the cifs_io_subrequest struct to the cifs_io_request struct as it's the same for all subreqs of a particular request. Signed-off-by: David Howells <dhowells@redhat.com> 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 969b301 commit 3f59138

File tree

4 files changed

+10
-15
lines changed

4 files changed

+10
-15
lines changed

fs/smb/client/cifsglob.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1495,6 +1495,7 @@ struct cifs_io_request {
14951495
struct netfs_io_request rreq;
14961496
struct cifsFileInfo *cfile;
14971497
struct TCP_Server_Info *server;
1498+
pid_t pid;
14981499
};
14991500

15001501
/* asynchronous read support */
@@ -1505,7 +1506,6 @@ struct cifs_io_subrequest {
15051506
struct cifs_io_request *req;
15061507
};
15071508
ssize_t got_bytes;
1508-
pid_t pid;
15091509
unsigned int xid;
15101510
int result;
15111511
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: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -177,15 +177,8 @@ static void cifs_req_issue_read(struct netfs_io_subrequest *subreq)
177177
struct netfs_io_request *rreq = subreq->rreq;
178178
struct cifs_io_subrequest *rdata = container_of(subreq, struct cifs_io_subrequest, subreq);
179179
struct cifs_io_request *req = container_of(subreq->rreq, struct cifs_io_request, rreq);
180-
struct cifs_sb_info *cifs_sb = CIFS_SB(rreq->inode->i_sb);
181-
pid_t pid;
182180
int rc = 0;
183181

184-
if (cifs_sb->mnt_cifs_flags & CIFS_MOUNT_RWPIDFORWARD)
185-
pid = req->cfile->pid;
186-
else
187-
pid = current->tgid; // Ummm... This may be a workqueue
188-
189182
cifs_dbg(FYI, "%s: op=%08x[%x] mapping=%p len=%zu/%zu\n",
190183
__func__, rreq->debug_id, subreq->debug_index, rreq->mapping,
191184
subreq->transferred, subreq->len);
@@ -199,7 +192,6 @@ static void cifs_req_issue_read(struct netfs_io_subrequest *subreq)
199192
}
200193

201194
__set_bit(NETFS_SREQ_CLEAR_TAIL, &subreq->flags);
202-
rdata->pid = pid;
203195

204196
rc = rdata->server->ops->async_readv(rdata);
205197
out:
@@ -236,12 +228,15 @@ static int cifs_init_request(struct netfs_io_request *rreq, struct file *file)
236228

237229
rreq->rsize = cifs_sb->ctx->rsize;
238230
rreq->wsize = cifs_sb->ctx->wsize;
231+
req->pid = current->tgid; // Ummm... This may be a workqueue
239232

240233
if (file) {
241234
open_file = file->private_data;
242235
rreq->netfs_priv = file->private_data;
243236
req->cfile = cifsFileInfo_get(open_file);
244237
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;
245240
} else if (rreq->origin != NETFS_WRITEBACK) {
246241
WARN_ON_ONCE(1);
247242
return -EIO;

fs/smb/client/smb2pdu.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4621,7 +4621,7 @@ smb2_async_readv(struct cifs_io_subrequest *rdata)
46214621
io_parms.length = rdata->subreq.len;
46224622
io_parms.persistent_fid = rdata->req->cfile->fid.persistent_fid;
46234623
io_parms.volatile_fid = rdata->req->cfile->fid.volatile_fid;
4624-
io_parms.pid = rdata->pid;
4624+
io_parms.pid = rdata->req->pid;
46254625

46264626
rc = smb2_new_read_req(
46274627
(void **) &buf, &total_len, &io_parms, rdata, 0, 0);
@@ -4873,7 +4873,7 @@ smb2_async_writev(struct cifs_io_subrequest *wdata)
48734873
.length = wdata->subreq.len,
48744874
.persistent_fid = wdata->req->cfile->fid.persistent_fid,
48754875
.volatile_fid = wdata->req->cfile->fid.volatile_fid,
4876-
.pid = wdata->pid,
4876+
.pid = wdata->req->pid,
48774877
};
48784878
io_parms = &_io_parms;
48794879

0 commit comments

Comments
 (0)