Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp559970iob; Fri, 13 May 2022 07:38:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJynAekmCqr9uzj04kaVAJKEHdR0cT3fbEQw188E/tiqKFYF2K3P8syMLdR5tXpeHvLJMJnX X-Received: by 2002:a05:6402:50d2:b0:427:f49e:71a0 with SMTP id h18-20020a05640250d200b00427f49e71a0mr40692428edb.211.1652452704444; Fri, 13 May 2022 07:38:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652452704; cv=none; d=google.com; s=arc-20160816; b=PUr2BmtC37wIG+2Z3qcTddTtzQ3WJB7uU11h2c0f54nJbQZ4H4NREUjlEFZCyBADxc 00fHwJOmoGP3WLzWge2ofsBUuxEuZuwP+qIoQJy3XasqAb3M1+7E1Ho6LH7l+wzZf/jc w0hyUUhJDstkKJc85XQ2pJUv+ROWwT9j44vjcZCdLLGTa33+eIi5YDmd22Qzfv6gSy3t LYY80l6cfNpSNm/MGfoRqeuQ6F39iosQfICVTYzSwwgWkye89caT73zApVzwHkkOtcwu /KsaoelvKOOgq63wR3JmLsjpQE+6V2DJqjJSqleOvEQfcfKoZhHVJzqFLs/w7xt6asbT eleg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=qbjb9OYWcSj4F4eOIUDWfZ0KySYzbW/sqF9qa93SpC4=; b=zFDAI4NxMRy71akrR2/GV8q6rQVZb+KMFSlZAaHvTzOfVvpEqaTgrBFFKZbhFS/xiT RJwE1PQnRNlLz7nax8HugDJHlYyATftxV02x2scKJjJg5pc0FAaPdi5nW0PnWW3C1ZS8 FVxTbNxb4euXr3SENkjK+VjO2DPJDJM1UjBZBOqY6Fgk7+30sbyGIE3wDIWzcbzj5H2H t5v6bYgMiyNBTMstZHXaizcQBfVwtwNYI3mz+1DVM8VQkI+r5NbUqCc3xbePPoFVOyCZ aA5+kf6zsIXYWAa960z6tbIn6KD4UQcH1+fKuS2Xbs+UCClzsn27XnmcFqvssCGISrAQ lLjw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id sd26-20020a1709076e1a00b006efe4351406si2426965ejc.135.2022.05.13.07.37.57; Fri, 13 May 2022 07:38:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244757AbiELDIw (ORCPT + 99 others); Wed, 11 May 2022 23:08:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49442 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229940AbiELDIu (ORCPT ); Wed, 11 May 2022 23:08:50 -0400 Received: from out30-57.freemail.mail.aliyun.com (out30-57.freemail.mail.aliyun.com [115.124.30.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4215138797; Wed, 11 May 2022 20:08:45 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=alimailimapcm10staff010182156082;MF=guangguan.wang@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VCyeGqh_1652324911; Received: from localhost.localdomain(mailfrom:guangguan.wang@linux.alibaba.com fp:SMTPD_---0VCyeGqh_1652324911) by smtp.aliyun-inc.com(127.0.0.1); Thu, 12 May 2022 11:08:32 +0800 From: Guangguan Wang To: kgraul@linux.ibm.com, davem@davemloft.net, kuba@kernel.org, tonylu@linux.alibaba.com Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net v2] net/smc: non blocking recvmsg() return -EAGAIN when no data and signal_pending Date: Thu, 12 May 2022 11:08:20 +0800 Message-Id: <20220512030820.73848-1-guangguan.wang@linux.alibaba.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Non blocking sendmsg will return -EAGAIN when any signal pending and no send space left, while non blocking recvmsg return -EINTR when signal pending and no data received. This may makes confused. As TCP returns -EAGAIN in the conditions described above. Align the behavior of smc with TCP. Fixes: 846e344eb722 ("net/smc: add receive timeout check") Signed-off-by: Guangguan Wang Reviewed-by: Tony Lu --- net/smc/smc_rx.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/net/smc/smc_rx.c b/net/smc/smc_rx.c index 51e8eb2933ff..338b9ef806e8 100644 --- a/net/smc/smc_rx.c +++ b/net/smc/smc_rx.c @@ -355,12 +355,12 @@ int smc_rx_recvmsg(struct smc_sock *smc, struct msghdr *msg, } break; } + if (!timeo) + return -EAGAIN; if (signal_pending(current)) { read_done = sock_intr_errno(timeo); break; } - if (!timeo) - return -EAGAIN; } if (!smc_rx_data_available(conn)) { -- 2.24.3 (Apple Git-128)