Skip to content

Commit d0dc411

Browse files
z00467499smfrench
authored andcommitted
cifs: Move the in_send statistic to __smb_send_rqst()
When send SMB_COM_NT_CANCEL and RFC1002_SESSION_REQUEST, the in_send statistic was lost. Let's move the in_send statistic to the send function to avoid this scenario. Fixes: 7ee1af7 ("[CIFS]") Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com> Signed-off-by: Steve French <stfrench@microsoft.com>
1 parent fe15c26 commit d0dc411

File tree

1 file changed

+9
-12
lines changed

1 file changed

+9
-12
lines changed

fs/cifs/transport.c

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ static int
278278
__smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
279279
struct smb_rqst *rqst)
280280
{
281-
int rc = 0;
281+
int rc;
282282
struct kvec *iov;
283283
int n_vec;
284284
unsigned int send_length = 0;
@@ -289,6 +289,7 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
289289
struct msghdr smb_msg = {};
290290
__be32 rfc1002_marker;
291291

292+
cifs_in_send_inc(server);
292293
if (cifs_rdma_enabled(server)) {
293294
/* return -EAGAIN when connecting or reconnecting */
294295
rc = -EAGAIN;
@@ -297,14 +298,17 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
297298
goto smbd_done;
298299
}
299300

301+
rc = -EAGAIN;
300302
if (ssocket == NULL)
301-
return -EAGAIN;
303+
goto out;
302304

305+
rc = -ERESTARTSYS;
303306
if (fatal_signal_pending(current)) {
304307
cifs_dbg(FYI, "signal pending before send request\n");
305-
return -ERESTARTSYS;
308+
goto out;
306309
}
307310

311+
rc = 0;
308312
/* cork the socket */
309313
tcp_sock_set_cork(ssocket->sk, true);
310314

@@ -407,7 +411,8 @@ __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
407411
rc);
408412
else if (rc > 0)
409413
rc = 0;
410-
414+
out:
415+
cifs_in_send_dec(server);
411416
return rc;
412417
}
413418

@@ -826,9 +831,7 @@ cifs_call_async(struct TCP_Server_Info *server, struct smb_rqst *rqst,
826831
* I/O response may come back and free the mid entry on another thread.
827832
*/
828833
cifs_save_when_sent(mid);
829-
cifs_in_send_inc(server);
830834
rc = smb_send_rqst(server, 1, rqst, flags);
831-
cifs_in_send_dec(server);
832835

833836
if (rc < 0) {
834837
revert_current_mid(server, mid->credits);
@@ -1144,9 +1147,7 @@ compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
11441147
else
11451148
midQ[i]->callback = cifs_compound_last_callback;
11461149
}
1147-
cifs_in_send_inc(server);
11481150
rc = smb_send_rqst(server, num_rqst, rqst, flags);
1149-
cifs_in_send_dec(server);
11501151

11511152
for (i = 0; i < num_rqst; i++)
11521153
cifs_save_when_sent(midQ[i]);
@@ -1396,9 +1397,7 @@ SendReceive(const unsigned int xid, struct cifs_ses *ses,
13961397

13971398
midQ->mid_state = MID_REQUEST_SUBMITTED;
13981399

1399-
cifs_in_send_inc(server);
14001400
rc = smb_send(server, in_buf, len);
1401-
cifs_in_send_dec(server);
14021401
cifs_save_when_sent(midQ);
14031402

14041403
if (rc < 0)
@@ -1539,9 +1538,7 @@ SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
15391538
}
15401539

15411540
midQ->mid_state = MID_REQUEST_SUBMITTED;
1542-
cifs_in_send_inc(server);
15431541
rc = smb_send(server, in_buf, len);
1544-
cifs_in_send_dec(server);
15451542
cifs_save_when_sent(midQ);
15461543

15471544
if (rc < 0)

0 commit comments

Comments
 (0)