From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mx0a-001b2d01.pphosted.com ([148.163.156.1]:52720 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754397AbeCGNAR (ORCPT ); Wed, 7 Mar 2018 08:00:17 -0500 Received: from pps.filterd (m0098404.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w27D053m067967 for ; Wed, 7 Mar 2018 08:00:17 -0500 Received: from e06smtp12.uk.ibm.com (e06smtp12.uk.ibm.com [195.75.94.108]) by mx0a-001b2d01.pphosted.com with ESMTP id 2gjec95dh4-1 (version=TLSv1.2 cipher=AES256-SHA256 bits=256 verify=NOT) for ; Wed, 07 Mar 2018 08:00:12 -0500 Received: from localhost by e06smtp12.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 7 Mar 2018 12:59:40 -0000 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.vnet.ibm.com, ubraun@linux.vnet.ibm.com Subject: [PATCH net 1/1] net/smc: wakeup closing listen socket Date: Wed, 7 Mar 2018 13:59:31 +0100 In-Reply-To: <20180307125931.42248-1-ubraun@linux.vnet.ibm.com> References: <20180307125931.42248-1-ubraun@linux.vnet.ibm.com> Message-Id: <20180307125931.42248-2-ubraun@linux.vnet.ibm.com> Sender: netdev-owner@vger.kernel.org List-ID: Closing of a listen socket wakes up kernel_accept() of smc_tcp_listen_worker(), and then has to wait till smc_tcp_listen_worker() gives up the internal clcsock. This wait is non-interruptible, and does not fit to the interruptible wakeup in smc_tcp_listen_worker(). Thus wakeup fails, and waiting for the closed internal clcsock never ends before the wait timeout is reached. This patch introduces the matching non-interruptible wakeup. Fixes: 127f49705823 ("net/smc: release clcsock from tcp_listen_worker") Reported-by: Hans Wippel Signed-off-by: Ursula Braun --- net/smc/af_smc.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/net/smc/af_smc.c b/net/smc/af_smc.c index 8cc97834d4f6..ad4c43eb7e7f 100644 --- a/net/smc/af_smc.c +++ b/net/smc/af_smc.c @@ -946,6 +946,20 @@ static void smc_listen_work(struct work_struct *work) goto enqueue; /* queue new sock with sk_err set */ } +/* a non-interruptible variant of sock_def_wakeup() for wakeup of + * smc_close_wait_listen_clcsock() + */ +static void smc_sock_wakeup(struct sock *sk) +{ + struct socket_wq *wq; + + rcu_read_lock(); + wq = rcu_dereference(sk->sk_wq); + if (skwq_has_sleeper(wq)) + wake_up_all(&wq->wait); + rcu_read_unlock(); +} + static void smc_tcp_listen_work(struct work_struct *work) { struct smc_sock *lsmc = container_of(work, struct smc_sock, @@ -981,7 +995,7 @@ static void smc_tcp_listen_work(struct work_struct *work) /* no more listening, wake up smc_close_wait_listen_clcsock and * accept */ - lsk->sk_state_change(lsk); + smc_sock_wakeup(lsk); sock_put(&lsmc->sk); /* sock_hold in smc_listen */ } -- 2.13.5