summaryrefslogtreecommitdiff
path: root/net/smc
diff options
context:
space:
mode:
authorD. Wythe <alibuda@linux.alibaba.com>2022-02-15 16:24:50 +0800
committerJakub Kicinski <kuba@kernel.org>2022-02-16 20:31:39 -0800
commit1ce22047067490c3a465808556a99b2ab95bf046 (patch)
treee3261bca70a662a658106e6bc15557ba27628b87 /net/smc
parent8aa69d348261e0d7747beac8b70a2d272da53888 (diff)
net/smc: return ETIMEDOUT when smc_connect_clc() timeout
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> Reviewed-by: Karsten Graul <kgraul@linux.ibm.com> Link: https://lore.kernel.org/r/1644913490-21594-1-git-send-email-alibuda@linux.alibaba.com Signed-off-by: Jakub Kicinski <kuba@kernel.org>
Diffstat (limited to 'net/smc')
-rw-r--r--net/smc/af_smc.c8
1 files changed, 7 insertions, 1 deletions
diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c
index 246c874de629..38a406447cd0 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);