Received: by 2002:a6b:500f:0:0:0:0:0 with SMTP id e15csp1044521iob; Fri, 13 May 2022 20:53:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzQLvoLmkMVND0nX819CO3PYoUQnRjw8soG9EuYezAFQcsKYq4YjGpTtGlGJJQrDWDiCJ2U X-Received: by 2002:adf:ce84:0:b0:20a:e076:30ff with SMTP id r4-20020adfce84000000b0020ae07630ffmr6135607wrn.361.1652500382076; Fri, 13 May 2022 20:53:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1652500382; cv=none; d=google.com; s=arc-20160816; b=D0bwxpuXVV89+cDiA7qRyXjzQ4dRgnHSalPznZhNBeKq3yi0SZlm1TfMpYf9pki+uQ qYzksvAOgiVqht5pvczzTHRbh4QNCx2GF2vwNA2K9FCZxsLB1jBo/vau5lE8FIhOjqdT 4c1uZHTvojTkocm6iK6RD1iwCCtcflYv+UAqBq9IWtdW67U5ca/GUAcep/4haQgV6HKW OFBZy8LqrJebEzumZa9MZVs2KpJby6tLbMFae4UuyQmRsfrDtrljd043cXBTZrrq89QU S3OyOEFq5rirx4KzB3s5QnaIkkdtmt3GorLZHBlZ+1rEcvLmaJQr/HR1iqnUKPrd/kS4 OCFQ== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=qbjb9OYWcSj4F4eOIUDWfZ0KySYzbW/sqF9qa93SpC4=; b=GDDeEOnadlPNuh2+7tufEi8U8JmPBB3o78QfzSR/J31+KyR6IRcRYxkf7lRIgx2SCU 7cI5W2jer836dBATNdeuoV86a8Rz07aTT7AjAala1FvpN197g6dE5B12J+egYbUb4G0/ yiq4WKJDeNyYlcTqTSrls0vEUuALAmrCemw9bJKFeOO7L+8ALMpptCOS657d5R6xYmJH Mgw1nn/+F54CTtaEap75iwMSV+2/8ehoikfIT7BG2Qk5kDMfuUaCFeVpf3I2+WYCrmS1 5Vf8r09HsI7hShW2Rejde+1asDs/R2Vbpl1SXawYHah1DmqGQ1DjxyxVYfE6vegBbJm6 DhCg== 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:18 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 lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id g14-20020a5d540e000000b0020a91f04a83si3387419wrv.927.2022.05.13.20.53.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 13 May 2022 20:53:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id E6244481141; Fri, 13 May 2022 17:25:22 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232035AbiELDMT (ORCPT + 99 others); Wed, 11 May 2022 23:12:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34306 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S244914AbiELDMJ (ORCPT ); Wed, 11 May 2022 23:12:09 -0400 Received: from out30-130.freemail.mail.aliyun.com (out30-130.freemail.mail.aliyun.com [115.124.30.130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 94E1A66AEF; Wed, 11 May 2022 20:12:08 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R991e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=e01e04423;MF=guangguan.wang@linux.alibaba.com;NM=1;PH=DS;RN=8;SR=0;TI=SMTPD_---0VCysWBv_1652325125; Received: from localhost.localdomain(mailfrom:guangguan.wang@linux.alibaba.com fp:SMTPD_---0VCysWBv_1652325125) by smtp.aliyun-inc.com(127.0.0.1); Thu, 12 May 2022 11:12:05 +0800 From: Guangguan Wang To: kgraul@linux.ibm.com, davem@davemloft.net, kuba@kernel.org, pabeni@redhat.com, tonylu@linux.alibaba.com Cc: linux-s390@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH net-next v2 1/2] net/smc: non blocking recvmsg() return -EAGAIN when no data and signal_pending Date: Thu, 12 May 2022 11:11:55 +0800 Message-Id: <20220512031156.74054-2-guangguan.wang@linux.alibaba.com> X-Mailer: git-send-email 2.24.3 (Apple Git-128) In-Reply-To: <20220512031156.74054-1-guangguan.wang@linux.alibaba.com> References: <20220512031156.74054-1-guangguan.wang@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,RDNS_NONE, SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY autolearn=no 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)