Skip to contentSkip to conversation

net/smc: return ETIMEDOUT when smc_connect_clc() timeout

PATCH Applied D. Wythe 3 participants 5 messages Feb 15, 2022 – Feb 17, 2022

Subsystems (5)
lore
Share & tools
lore

D. Wythe

author maintainer
#0 lore raw

PATCH 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
index 246c874..38a4064 100644
@@ -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
#1 lore raw
Quoted 9 lines · D. Wythe

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.

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()?

author maintainer
#2 lore raw
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 -EAGAIN while 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() 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.

Reviewed-by
#3 lore raw
Quoted 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 -EAGAIN while 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() 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()?

Quoted 5 lines

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.

maintainer Applied
#4 lore raw
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 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.

Applied, thanks!