Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp5255593imm; Tue, 18 Sep 2018 06:48:29 -0700 (PDT) X-Google-Smtp-Source: ANB0VdaoMqAnA0S1k0W2dT0433XOgQeLTTGXgZbTQY0+DqLr+FOrBP1DqHabPfC2lEvz3o1GNGOS X-Received: by 2002:a62:3545:: with SMTP id c66-v6mr30730405pfa.63.1537278509369; Tue, 18 Sep 2018 06:48:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537278509; cv=none; d=google.com; s=arc-20160816; b=JLQ4ue7OFnNaWEzzPy+iCwc0dZu7ZFd58nyIRIxfDx8BE85vnlbK+n6NmQMcD6fnpg GYEol/VcIx4Fc0k9jWrMZt8J6aja6qs8FnjXPSF1HpFqyVQCBx2qNRJpYTlkLWq+qa89 u7p+GGUSB7Gnu2aS95CX3ZeafqBQ9mbWn8LMmYuD1hHZpWF32/B2pn+XpKFH2Vd9ctCh att94nSYakZZyq2GJ2hEjjQQryYF6tyjMj10U2AAMX+fKpYPWSTx3L56X6RsESZFRKcI W59lgtRdyp2JJclkJHHuFsdft1zq9SozDx8tbRoIkEg+mIBsYLbaiLZ0OE3j9bGpjmBW KqZQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:references:in-reply-to:date :subject:cc:to:from; bh=7UhJpwGFaCKoi6C8L3LzIzUtdo8kAT/KwA1X5MaCtJs=; b=kHbzeRBZdup+xc8xTOiOTk12XAcrFMhXMTpfV8u/nt+hKKy4DTx4einEkQVgmwaw7N RfJ1qxb7uVjjw5Typ41ySplbP8xPP1XHY9AcH6GcnMoqKslGT2pkb/f1Fkzcn3H1f2NQ nYXUZt4m8efiptk8gaFLnA/vuZY9LITMMwO3lt9piajmRv2f//izu+lMJZYC/WuWmxTl PDf2zp9r+dQ2pXja/p431C0CLpxYRRL81ohMXYKjA2JJpdTE5mWTqIXCpjbpnhPxOFPg FB2O67PJE+LWky+v1dgIfj2BLY7B5gNn8Sciep66hX6IcImfhe/hMRRPTLpz8arc+1Kf 0Mqw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id o81-v6si20059509pfj.350.2018.09.18.06.48.14; Tue, 18 Sep 2018 06:48:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=ibm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729993AbeIRTTb (ORCPT + 99 others); Tue, 18 Sep 2018 15:19:31 -0400 Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:49015 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729674AbeIRTTa (ORCPT ); Tue, 18 Sep 2018 15:19:30 -0400 Received: from pps.filterd (m0098409.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w8IDd67G106080 for ; Tue, 18 Sep 2018 09:46:49 -0400 Received: from e06smtp03.uk.ibm.com (e06smtp03.uk.ibm.com [195.75.94.99]) by mx0a-001b2d01.pphosted.com with ESMTP id 2mk14gvbpe-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 18 Sep 2018 09:46:48 -0400 Received: from localhost by e06smtp03.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 18 Sep 2018 14:46:46 +0100 Received: from b06cxnps4074.portsmouth.uk.ibm.com (9.149.109.196) by e06smtp03.uk.ibm.com (192.168.101.133) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Tue, 18 Sep 2018 14:46:43 +0100 Received: from d06av25.portsmouth.uk.ibm.com (d06av25.portsmouth.uk.ibm.com [9.149.105.61]) by b06cxnps4074.portsmouth.uk.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id w8IDkggP55902234 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Tue, 18 Sep 2018 13:46:42 GMT Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 6BEC311C054; Tue, 18 Sep 2018 16:46:27 +0100 (BST) Received: from d06av25.portsmouth.uk.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 2585911C05B; Tue, 18 Sep 2018 16:46:27 +0100 (BST) Received: from tuxmaker.boeblingen.de.ibm.com (unknown [9.152.85.9]) by d06av25.portsmouth.uk.ibm.com (Postfix) with ESMTPS; Tue, 18 Sep 2018 16:46:27 +0100 (BST) From: Ursula Braun To: davem@davemloft.net Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, raspl@linux.ibm.com, linux-kernel@vger.kernel.org Subject: [PATCH net 1/5] net/smc: fix non-blocking connect problem Date: Tue, 18 Sep 2018 15:46:34 +0200 X-Mailer: git-send-email 2.16.4 In-Reply-To: <20180918134638.90271-1-ubraun@linux.ibm.com> References: <20180918134638.90271-1-ubraun@linux.ibm.com> X-TM-AS-GCONF: 00 x-cbid: 18091813-0012-0000-0000-000002AA53C5 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 18091813-0013-0000-0000-000020DEAD25 Message-Id: <20180918134638.90271-2-ubraun@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:,, definitions=2018-09-18_05:,, signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=1 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1807170000 definitions=main-1809180139 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org In state SMC_INIT smc_poll() delegates polling to the internal CLC socket. This means, once the connect worker has finished its kernel_connect() step, the poll wake-up may occur. This is not intended. The wake-up should occur from the wake up call in smc_connect_work() after __smc_connect() has finished. Thus in state SMC_INIT this patch now calls sock_poll_wait() on the main SMC socket. Signed-off-by: Ursula Braun --- net/smc/af_smc.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 2d8a1e15e4f9..9c3976bcde46 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -742,7 +742,10 @@ static void smc_connect_work(struct work_struct *work) smc->sk.sk_err = -rc; out: - smc->sk.sk_state_change(&smc->sk); + if (smc->sk.sk_err) + smc->sk.sk_state_change(&smc->sk); + else + smc->sk.sk_write_space(&smc->sk); kfree(smc->connect_info); smc->connect_info = NULL; release_sock(&smc->sk); @@ -1529,7 +1532,7 @@ static __poll_t smc_poll(struct file *file, struct socket *sock, return EPOLLNVAL; smc = smc_sk(sock->sk); - if ((sk->sk_state == SMC_INIT) || smc->use_fallback) { + if (smc->use_fallback) { /* delegate to CLC child sock */ mask = smc->clcsock->ops->poll(file, smc->clcsock, wait); sk->sk_err = smc->clcsock->sk->sk_err; -- 2.16.4