net/smc: return ETIMEDOUT when smc_connect_clc() timeout
Subsystems (5)
D. Wythe
maintainerPATCH 1/1 net/smc: return ETIMEDOUT when smc_connect_clc() timeout
From: "D. Wythe" <[email protected]>
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.
--- net/smc/af_smc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-)
net/smc/af_smc.c +7 -1
@@ -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);
Signature · 1 line
1.8.3.1
Quoted 9 lines · D. Wythe
From: "D. Wythe" <[email protected]>
When
smc_connect_clc()times out, it will return -EAGAIN(tcp_recvmsg retuns-EAGAINwhile 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()?
D. Wythe
maintainerQuoted 8 lines · Karsten Graul
Quoted 7 lines · D. Wythe
From: "D. Wythe" <[email protected]>
When
smc_connect_clc()times out, it will return -EAGAIN(tcp_recvmsg retuns-EAGAINwhile timeout), then this value will passed to the application, which is quite confusing to the applications, makes inconsistency with TCP.
Quoted 6 lines
Quoted 2 lines
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()insmc_clc_wait_msg()returns-EAGAIN? Is there a reason why you translate it in__smc_connect()and not already insmc_clc_wait_msg()after the call tosock_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.
Karsten Graul
Reviewed-byQuoted 17 lines · D. Wythe
Quoted 8 lines · Karsten Graul
Quoted 7 lines · D. Wythe
From: "D. Wythe" <[email protected]>
When
smc_connect_clc()times out, it will return -EAGAIN(tcp_recvmsg retuns-EAGAINwhile timeout), then this value will passed to the application, which is quite confusing to the applications, makes inconsistency with TCP.Quoted 6 lines
Quoted 2 lines
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()insmc_clc_wait_msg()returns-EAGAIN? Is there a reason why you translate it in__smc_connect()and not already insmc_clc_wait_msg()after the call tosock_recvmsg()?
Quoted 5 lines
Because other code that uses
smc_clc_wait_msg()handles EAGAIN allready, and the only exception issmc_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.
Quoted 10 lines · On Wed, 16 Feb 2022 11:23:12 +0100 Karsten Graul wrote:
Quoted 5 lines · D. Wythe
Because other code that uses
smc_clc_wait_msg()handles EAGAIN allready, and the only exception issmc_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 <[email protected]>
Applied, thanks!