From mboxrd@z Thu Jan 1 00:00:00 1970 From: Ursula Braun Subject: [PATCH net-next 10/10] net/smc: check for pending termination Date: Tue, 15 May 2018 17:05:03 +0200 Message-ID: <20180515150503.47265-11-ubraun@linux.ibm.com> References: <20180515150503.47265-1-ubraun@linux.ibm.com> Cc: netdev@vger.kernel.org, linux-s390@vger.kernel.org, schwidefsky@de.ibm.com, heiko.carstens@de.ibm.com, raspl@linux.ibm.com, ubraun@linux.ibm.com To: davem@davemloft.net Return-path: Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:41870 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752002AbeEOPF0 (ORCPT ); Tue, 15 May 2018 11:05:26 -0400 Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.22/8.16.0.22) with SMTP id w4FF04O2119284 for ; Tue, 15 May 2018 11:05:26 -0400 Received: from e06smtp15.uk.ibm.com (e06smtp15.uk.ibm.com [195.75.94.111]) by mx0b-001b2d01.pphosted.com with ESMTP id 2j006ge67b-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Tue, 15 May 2018 11:05:24 -0400 Received: from localhost by e06smtp15.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Tue, 15 May 2018 16:05:22 +0100 In-Reply-To: <20180515150503.47265-1-ubraun@linux.ibm.com> Sender: netdev-owner@vger.kernel.org List-ID: From: Karsten Graul Avoid to run the processing in smc_lgr_terminate() more than once, remember when the link group termination is triggered. Signed-off-by: Karsten Graul Signed-off-by: Ursula Braun --- net/smc/smc_clc.c | 2 +- net/smc/smc_core.c | 5 ++++- net/smc/smc_core.h | 3 ++- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/net/smc/smc_clc.c b/net/smc/smc_clc.c index 3a988c22f627..236cb3f12c71 100644 --- a/net/smc/smc_clc.c +++ b/net/smc/smc_clc.c @@ -316,7 +316,7 @@ int smc_clc_wait_msg(struct smc_sock *smc, void *buf, int buflen, if (clcm->type == SMC_CLC_DECLINE) { reason_code = SMC_CLC_DECL_REPLY; if (((struct smc_clc_msg_decline *)buf)->hdr.flag) { - smc->conn.lgr->sync_err = true; + smc->conn.lgr->sync_err = 1; smc_lgr_terminate(smc->conn.lgr); } } diff --git a/net/smc/smc_core.c b/net/smc/smc_core.c index a48ee00b65ff..08c05cd0bbae 100644 --- a/net/smc/smc_core.c +++ b/net/smc/smc_core.c @@ -172,7 +172,7 @@ static int smc_lgr_create(struct smc_sock *smc, goto out; } lgr->role = smc->listen_smc ? SMC_SERV : SMC_CLNT; - lgr->sync_err = false; + lgr->sync_err = 0; memcpy(lgr->peer_systemid, peer_systemid, SMC_SYSTEMID_LEN); lgr->vlan_id = vlan_id; rwlock_init(&lgr->sndbufs_lock); @@ -352,6 +352,9 @@ void smc_lgr_terminate(struct smc_link_group *lgr) struct smc_sock *smc; struct rb_node *node; + if (lgr->terminating) + return; /* lgr already terminating */ + lgr->terminating = 1; smc_lgr_forget(lgr); smc_llc_link_inactive(&lgr->lnk[SMC_SINGLE_LINK]); diff --git a/net/smc/smc_core.h b/net/smc/smc_core.h index d1753850684b..845dc073de13 100644 --- a/net/smc/smc_core.h +++ b/net/smc/smc_core.h @@ -166,7 +166,8 @@ struct smc_link_group { u8 id[SMC_LGR_ID_SIZE]; /* unique lgr id */ struct delayed_work free_work; /* delayed freeing of an lgr */ - bool sync_err; /* lgr no longer fits to peer */ + u8 sync_err : 1; /* lgr no longer fits to peer */ + u8 terminating : 1;/* lgr is terminating */ }; /* Find the connection associated with the given alert token in the link group. -- 2.16.3