diff mbox series

[v2,2/2] cifs: Move the in_send statistic to __smb_send_rqst()

Message ID 20221116031136.3967579-3-zhangxiaoxu5@huawei.com (mailing list archive)
State New, archived
Headers show
Series Fix some bug in cifs | expand

Commit Message

Zhang Xiaoxu Nov. 16, 2022, 3:11 a.m. UTC
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: 7ee1af765dfa ("[CIFS]")
Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
---
 fs/cifs/transport.c | 21 +++++++++------------
 1 file changed, 9 insertions(+), 12 deletions(-)

Comments

Paulo Alcantara Sept. 1, 2023, 3:25 p.m. UTC | #1
Hi Steve,

Zhang Xiaoxu <zhangxiaoxu5@huawei.com> writes:

> 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: 7ee1af765dfa ("[CIFS]")
> Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
> ---
>  fs/cifs/transport.c | 21 +++++++++------------
>  1 file changed, 9 insertions(+), 12 deletions(-)

Could you please pick this up?

Thanks.
Steve French Sept. 1, 2023, 4:25 p.m. UTC | #2
That patch was already been merged last year

commit d0dc41119905f740e8d5594adce277f7c0de8c92
Author: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
Date:   Wed Nov 16 11:11:36 2022 +0800

    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: 7ee1af765dfa ("[CIFS]")
    Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
    Signed-off-by: Steve French <stfrench@microsoft.com>

On Fri, Sep 1, 2023 at 10:25 AM Paulo Alcantara <pc@manguebit.com> wrote:
>
> Hi Steve,
>
> Zhang Xiaoxu <zhangxiaoxu5@huawei.com> writes:
>
> > 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: 7ee1af765dfa ("[CIFS]")
> > Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
> > ---
> >  fs/cifs/transport.c | 21 +++++++++------------
> >  1 file changed, 9 insertions(+), 12 deletions(-)
>
> Could you please pick this up?
>
> Thanks.
Paulo Alcantara Sept. 1, 2023, 4:49 p.m. UTC | #3
Whopps - I replied to wrong email, sorry.

I meant patch 1/2 [1].

[1] https://lore.kernel.org/linux-cifs/20221116031136.3967579-2-zhangxiaoxu5@huawei.com/

On 1 September 2023 13:25:10 GMT-03:00, Steve French <smfrench@gmail.com> wrote:
>That patch was already been merged last year
>
>commit d0dc41119905f740e8d5594adce277f7c0de8c92
>Author: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
>Date:   Wed Nov 16 11:11:36 2022 +0800
>
>    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: 7ee1af765dfa ("[CIFS]")
>    Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
>    Signed-off-by: Steve French <stfrench@microsoft.com>
>
>On Fri, Sep 1, 2023 at 10:25 AM Paulo Alcantara <pc@manguebit.com> wrote:
>>
>> Hi Steve,
>>
>> Zhang Xiaoxu <zhangxiaoxu5@huawei.com> writes:
>>
>> > 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: 7ee1af765dfa ("[CIFS]")
>> > Signed-off-by: Zhang Xiaoxu <zhangxiaoxu5@huawei.com>
>> > ---
>> >  fs/cifs/transport.c | 21 +++++++++------------
>> >  1 file changed, 9 insertions(+), 12 deletions(-)
>>
>> Could you please pick this up?
>>
>> Thanks.
>
>
>
diff mbox series

Patch

diff --git a/fs/cifs/transport.c b/fs/cifs/transport.c
index bc551738dabb..2ce7206446a9 100644
--- a/fs/cifs/transport.c
+++ b/fs/cifs/transport.c
@@ -300,7 +300,7 @@  static int
 __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
 		struct smb_rqst *rqst)
 {
-	int rc = 0;
+	int rc;
 	struct kvec *iov;
 	int n_vec;
 	unsigned int send_length = 0;
@@ -311,6 +311,7 @@  __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
 	struct msghdr smb_msg = {};
 	__be32 rfc1002_marker;
 
+	cifs_in_send_inc(server);
 	if (cifs_rdma_enabled(server)) {
 		/* return -EAGAIN when connecting or reconnecting */
 		rc = -EAGAIN;
@@ -319,14 +320,17 @@  __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
 		goto smbd_done;
 	}
 
+	rc = -EAGAIN;
 	if (ssocket == NULL)
-		return -EAGAIN;
+		goto out;
 
+	rc = -ERESTARTSYS;
 	if (fatal_signal_pending(current)) {
 		cifs_dbg(FYI, "signal pending before send request\n");
-		return -ERESTARTSYS;
+		goto out;
 	}
 
+	rc = 0;
 	/* cork the socket */
 	tcp_sock_set_cork(ssocket->sk, true);
 
@@ -437,7 +441,8 @@  __smb_send_rqst(struct TCP_Server_Info *server, int num_rqst,
 			 rc);
 	else if (rc > 0)
 		rc = 0;
-
+out:
+	cifs_in_send_dec(server);
 	return rc;
 }
 
@@ -857,9 +862,7 @@  cifs_call_async(struct TCP_Server_Info *server, struct smb_rqst *rqst,
 	 * I/O response may come back and free the mid entry on another thread.
 	 */
 	cifs_save_when_sent(mid);
-	cifs_in_send_inc(server);
 	rc = smb_send_rqst(server, 1, rqst, flags);
-	cifs_in_send_dec(server);
 
 	if (rc < 0) {
 		revert_current_mid(server, mid->credits);
@@ -1153,9 +1156,7 @@  compound_send_recv(const unsigned int xid, struct cifs_ses *ses,
 		else
 			midQ[i]->callback = cifs_compound_last_callback;
 	}
-	cifs_in_send_inc(server);
 	rc = smb_send_rqst(server, num_rqst, rqst, flags);
-	cifs_in_send_dec(server);
 
 	for (i = 0; i < num_rqst; i++)
 		cifs_save_when_sent(midQ[i]);
@@ -1406,9 +1407,7 @@  SendReceive(const unsigned int xid, struct cifs_ses *ses,
 
 	midQ->mid_state = MID_REQUEST_SUBMITTED;
 
-	cifs_in_send_inc(server);
 	rc = smb_send(server, in_buf, len);
-	cifs_in_send_dec(server);
 	cifs_save_when_sent(midQ);
 
 	if (rc < 0)
@@ -1550,9 +1549,7 @@  SendReceiveBlockingLock(const unsigned int xid, struct cifs_tcon *tcon,
 	}
 
 	midQ->mid_state = MID_REQUEST_SUBMITTED;
-	cifs_in_send_inc(server);
 	rc = smb_send(server, in_buf, len);
-	cifs_in_send_dec(server);
 	cifs_save_when_sent(midQ);
 
 	if (rc < 0)