netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH net-next] net/smc: return ETIMEDOUT when smc_connect_clc() timeout
@ 2022-02-15  8:24 D. Wythe
  2022-02-15 13:02 ` Karsten Graul
  0 siblings, 1 reply; 5+ messages in thread
From: D. Wythe @ 2022-02-15  8:24 UTC (permalink / raw)
  To: kgraul; +Cc: kuba, davem, netdev, linux-s390, linux-rdma

From: "D. Wythe" <alibuda@linux.alibaba.com>

When smc_connect_clc() times out, it will return -EAGAIN(tcp_recvmsg
retuns -EAGAIN while timeout), then this value will passed to the
application, which is quite confusing to the applications, makes
inconsistency with TCP.

From the manual of connect, ETIMEDOUT is more suitable, and this patch
try convert EAGAIN to ETIMEDOUT in that case.

Signed-off-by: D. Wythe <alibuda@linux.alibaba.com>
---
 net/smc/af_smc.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 246c874..38a4064 100644
--- a/net/smc/af_smc.c
+++ b/net/smc/af_smc.c
@@ -1372,8 +1372,14 @@ static int __smc_connect(struct smc_sock *smc)
 
 	/* perform CLC handshake */
 	rc = smc_connect_clc(smc, aclc2, ini);
-	if (rc)
+	if (rc) {
+		/* -EAGAIN on timeout, see tcp_recvmsg() */
+		if (rc == -EAGAIN) {
+			rc = -ETIMEDOUT;
+			smc->sk.sk_err = ETIMEDOUT;
+		}
 		goto vlan_cleanup;
+	}
 
 	/* check if smc modes and versions of CLC proposal and accept match */
 	rc = smc_connect_check_aclc(ini, aclc);
-- 
1.8.3.1


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net/smc: return ETIMEDOUT when smc_connect_clc() timeout
  2022-02-15  8:24 [PATCH net-next] net/smc: return ETIMEDOUT when smc_connect_clc() timeout D. Wythe
@ 2022-02-15 13:02 ` Karsten Graul
  2022-02-16  3:13   ` D. Wythe
  0 siblings, 1 reply; 5+ messages in thread
From: Karsten Graul @ 2022-02-15 13:02 UTC (permalink / raw)
  To: D. Wythe; +Cc: kuba, davem, netdev, linux-s390, linux-rdma

On 15/02/2022 09:24, D. Wythe wrote:
> From: "D. Wythe" <alibuda@linux.alibaba.com>
> 
> When smc_connect_clc() times out, it will return -EAGAIN(tcp_recvmsg
> retuns -EAGAIN while timeout), then this value will passed to the
> application, which is quite confusing to the applications, makes
> inconsistency with TCP.
> 
> From the manual of connect, ETIMEDOUT is more suitable, and this patch
> try convert EAGAIN to ETIMEDOUT in that case.

You say that the sock_recvmsg() in smc_clc_wait_msg() returns -EAGAIN?
Is there a reason why you translate it in __smc_connect() and not already in
smc_clc_wait_msg() after the call to sock_recvmsg()?

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net/smc: return ETIMEDOUT when smc_connect_clc() timeout
  2022-02-15 13:02 ` Karsten Graul
@ 2022-02-16  3:13   ` D. Wythe
  2022-02-16 10:23     ` Karsten Graul
  0 siblings, 1 reply; 5+ messages in thread
From: D. Wythe @ 2022-02-16  3:13 UTC (permalink / raw)
  To: Karsten Graul; +Cc: kuba, davem, netdev, linux-s390, linux-rdma

On Tue, Feb 15, 2022 at 02:02:37PM +0100, Karsten Graul wrote:
> On 15/02/2022 09:24, D. Wythe wrote:
> > From: "D. Wythe" <alibuda@linux.alibaba.com>
> > 
> > When smc_connect_clc() times out, it will return -EAGAIN(tcp_recvmsg
> > retuns -EAGAIN while timeout), then this value will passed to the
> > application, which is quite confusing to the applications, makes
> > inconsistency with TCP.
> > 
> > From the manual of connect, ETIMEDOUT is more suitable, and this patch
> > try convert EAGAIN to ETIMEDOUT in that case.
> 
> You say that the sock_recvmsg() in smc_clc_wait_msg() returns -EAGAIN?
> Is there a reason why you translate it in __smc_connect() and not already in
> smc_clc_wait_msg() after the call to sock_recvmsg()?


Because other code that uses smc_clc_wait_msg() handles EAGAIN allready, 
and the only exception is smc_listen_work(), but it doesn't really matter for it. 

The most important thing is that this conversion needs to be determined according to 
the calling scene, convert in smc_clc_wait_msg() is not very suitable.

Thanks.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net/smc: return ETIMEDOUT when smc_connect_clc() timeout
  2022-02-16  3:13   ` D. Wythe
@ 2022-02-16 10:23     ` Karsten Graul
  2022-02-17  4:32       ` Jakub Kicinski
  0 siblings, 1 reply; 5+ messages in thread
From: Karsten Graul @ 2022-02-16 10:23 UTC (permalink / raw)
  To: D. Wythe; +Cc: kuba, davem, netdev, linux-s390, linux-rdma

On 16/02/2022 04:13, D. Wythe wrote:
> On Tue, Feb 15, 2022 at 02:02:37PM +0100, Karsten Graul wrote:
>> On 15/02/2022 09:24, D. Wythe wrote:
>>> From: "D. Wythe" <alibuda@linux.alibaba.com>
>>>
>>> When smc_connect_clc() times out, it will return -EAGAIN(tcp_recvmsg
>>> retuns -EAGAIN while timeout), then this value will passed to the
>>> application, which is quite confusing to the applications, makes
>>> inconsistency with TCP.
>>>
>>> From the manual of connect, ETIMEDOUT is more suitable, and this patch
>>> try convert EAGAIN to ETIMEDOUT in that case.
>>
>> You say that the sock_recvmsg() in smc_clc_wait_msg() returns -EAGAIN?
>> Is there a reason why you translate it in __smc_connect() and not already in
>> smc_clc_wait_msg() after the call to sock_recvmsg()?
> 
> 
> Because other code that uses smc_clc_wait_msg() handles EAGAIN allready, 
> and the only exception is smc_listen_work(), but it doesn't really matter for it. 
> 
> The most important thing is that this conversion needs to be determined according to 
> the calling scene, convert in smc_clc_wait_msg() is not very suitable.

Okay I understand, thank you.

Reviewed-by: Karsten Graul <kgraul@linux.ibm.com>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH net-next] net/smc: return ETIMEDOUT when smc_connect_clc() timeout
  2022-02-16 10:23     ` Karsten Graul
@ 2022-02-17  4:32       ` Jakub Kicinski
  0 siblings, 0 replies; 5+ messages in thread
From: Jakub Kicinski @ 2022-02-17  4:32 UTC (permalink / raw)
  To: Karsten Graul, D. Wythe; +Cc: davem, netdev, linux-s390, linux-rdma

On Wed, 16 Feb 2022 11:23:12 +0100 Karsten Graul wrote:
> On 16/02/2022 04:13, D. Wythe wrote:
> > Because other code that uses smc_clc_wait_msg() handles EAGAIN allready, 
> > and the only exception is smc_listen_work(), but it doesn't really matter for it. 
> > 
> > The most important thing is that this conversion needs to be determined according to 
> > the calling scene, convert in smc_clc_wait_msg() is not very suitable.  
> 
> Okay I understand, thank you.
> 
> Reviewed-by: Karsten Graul <kgraul@linux.ibm.com>

Applied, thanks!

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2022-02-17  4:32 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-02-15  8:24 [PATCH net-next] net/smc: return ETIMEDOUT when smc_connect_clc() timeout D. Wythe
2022-02-15 13:02 ` Karsten Graul
2022-02-16  3:13   ` D. Wythe
2022-02-16 10:23     ` Karsten Graul
2022-02-17  4:32       ` Jakub Kicinski

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).