Message ID | 1680248937-16617-1-git-send-email-quic_srichara@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp394946vqo; Fri, 31 Mar 2023 01:04:42 -0700 (PDT) X-Google-Smtp-Source: AKy350aT2zY/K76Jfplq/RufsDezBWdiTxOuNQ70iQfBM/umknAUe3Oh7v5y84q821wI3xWwH7RW X-Received: by 2002:a62:1d53:0:b0:5df:421d:1962 with SMTP id d80-20020a621d53000000b005df421d1962mr25244489pfd.2.1680249881981; Fri, 31 Mar 2023 01:04:41 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680249881; cv=none; d=google.com; s=arc-20160816; b=Ltt8SybK/SZRJxbEBlOunIToqxFhRpGhsCrwQeqkt3ZPR7KtkW54KUYWsvNNGHF1kV j6pXeMbBTl4Dz444IS/i85mEhfZEsgkQvxNSJkJwfwu3E8/w1gMbb0FDLKqEqJ2qS09s vIlomzyWQnryvly9m+OhsAs/B4c7JxAyyxELlkI5RIV5pGbbO3S3TUctuXUOTcApwbuH s+hEBJmAewZUm8xh4mGQiLKxxmqwwytagR6DObuii9afyD+sGOC4F/BNVD+dr8cF0Qfi ZaQpyGmv9mJyHZCQOBQ3WxaAFV+5RtBHTaMSva5wx4fVUUFUscI+kn2bWDTKyWa7YGC8 q7Fg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:message-id:date:subject:to:from :dkim-signature; bh=13eN19ykrC1NIz/k/gipi1BTZEQj9+AphjGs7LxAaK0=; b=c5E7b8B+piHSh5s7uL9RhTNbiU7aGdbSMrozxunkhj1U0PliUcMB059jicihhY4RJ9 gTmyPTkCm94uScnBTdAZt+NmwSi5r04nm/ShT2Jul/85pZFcm8z6IUoOn1vgzHsqAFZM LLtvfVd/gMjlqEX06Ep+mg//Z0DShShKLO/huCVPokDjJKy9Uxbug6W6vWkuQBgf3NC8 spekB5Wg3N1gpq2hyuYnuuqomEkAuO8Xst9085fzR4DdctX0uOdKVQGv4VSajlxovXdf 3P9asPBNu8AP4LAIroQle8Gv0DIMUBWVoo0rf52BaEr5xRE/3kRFRdzzs7q0FE+Lq+VZ Ar3Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=HAc8Hj7A; 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=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a63e005000000b00513ac21a77bsi1600007pgh.880.2023.03.31.01.04.27; Fri, 31 Mar 2023 01:04:41 -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; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=HAc8Hj7A; 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=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231375AbjCaHvc (ORCPT <rfc822;jimliu8233@gmail.com> + 99 others); Fri, 31 Mar 2023 03:51:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46794 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231209AbjCaHvE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Fri, 31 Mar 2023 03:51:04 -0400 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 75B161C1C2; Fri, 31 Mar 2023 00:49:58 -0700 (PDT) Received: from pps.filterd (m0279864.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 32V71JNS020803; Fri, 31 Mar 2023 07:49:44 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=from : to : subject : date : message-id : mime-version : content-type; s=qcppdkim1; bh=13eN19ykrC1NIz/k/gipi1BTZEQj9+AphjGs7LxAaK0=; b=HAc8Hj7AR1xgWhl31TTg9wY5vUBHmMPG8MC4uPOhyAIbjR+ydTbn6741xRuCefzTmlO1 HnmdI/k6KzvFcd/i8oNlofU0hqXWv31efWMMa5JmqKZ2M4fuSgiG6T4tn/bKNYTov096 pVwZuiZOw+f6Ub88unt9u3mGJxuLru1IiVSFd8/OzFpk1xMcNYoservp6PpL70Bxy6Io SHIIKaOvzpF4dvJVaoHcSrpA2OynX+xIKOojLVl+x4KfmNuZSUozO/j1LmBggQEkmQTV a5Cs39gr+xUUj6XawR77rrcm9WiE9jULmsfcEBIZhX+h0MjkqXTmpc4kdewKgkFcT8Mq hQ== Received: from nalasppmta05.qualcomm.com (Global_NAT1.qualcomm.com [129.46.96.20]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3pn9kgttcb-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Mar 2023 07:49:43 +0000 Received: from nalasex01c.na.qualcomm.com (nalasex01c.na.qualcomm.com [10.47.97.35]) by NALASPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 32V7ngBA028620 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 31 Mar 2023 07:49:43 GMT Received: from srichara-linux.qualcomm.com (10.80.80.8) by nalasex01c.na.qualcomm.com (10.47.97.35) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.42; Fri, 31 Mar 2023 00:49:08 -0700 From: Sricharan Ramabadhran <quic_srichara@quicinc.com> To: <mani@kernel.org>, <manivannan.sadhasivam@linaro.org>, <davem@davemloft.net>, <edumazet@google.com>, <kuba@kernel.org>, <pabeni@redhat.com>, <linux-arm-msm@vger.kernel.org>, <netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org> Subject: [PATCH V2] net: qrtr: Do not do DEL_SERVER broadcast after DEL_CLIENT Date: Fri, 31 Mar 2023 13:18:57 +0530 Message-ID: <1680248937-16617-1-git-send-email-quic_srichara@quicinc.com> X-Mailer: git-send-email 2.7.4 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01b.na.qualcomm.com (10.46.141.250) To nalasex01c.na.qualcomm.com (10.47.97.35) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-GUID: EWu-S4bW2rpNZjEA_VPm3ZwHLApJQrLk X-Proofpoint-ORIG-GUID: EWu-S4bW2rpNZjEA_VPm3ZwHLApJQrLk X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.254,Aquarius:18.0.942,Hydra:6.0.573,FMLib:17.11.170.22 definitions=2023-03-31_03,2023-03-30_04,2023-02-09_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 mlxscore=0 adultscore=0 malwarescore=0 suspectscore=0 bulkscore=0 spamscore=0 clxscore=1015 mlxlogscore=843 lowpriorityscore=0 impostorscore=0 phishscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2303200000 definitions=main-2303310063 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1761869699895139189?= X-GMAIL-MSGID: =?utf-8?q?1761869699895139189?= |
Series |
[V2] net: qrtr: Do not do DEL_SERVER broadcast after DEL_CLIENT
|
|
Commit Message
Sricharan Ramabadhran
March 31, 2023, 7:48 a.m. UTC
On the remote side, when QRTR socket is removed, af_qrtr will call qrtr_port_remove() which broadcasts the DEL_CLIENT packet to all neighbours including local NS. NS upon receiving the DEL_CLIENT packet, will remove the lookups associated with the node:port and broadcasts the DEL_SERVER packet. But on the host side, due to the arrival of the DEL_CLIENT packet, the NS would've already deleted the server belonging to that port. So when the remote's NS again broadcasts the DEL_SERVER for that port, it throws below error message on the host: "failed while handling packet from 2:-2" So fix this error by not broadcasting the DEL_SERVER packet when the DEL_CLIENT packet gets processed." Fixes: 0c2204a4ad71 ("net: qrtr: Migrate nameservice to kernel from userspace") Signed-off-by: Sricharan Ramabadhran <quic_srichara@quicinc.com> Signed-off-by: Ram Kumar Dharuman <quic_ramd@quicinc.com> --- [v2] Fixed comments from Manivannan and Jakub Kicinski Note: Functionally tested on 5.4 and compile tested on 6.3 TOT net/qrtr/ns.c | 15 +++++++++------ 1 file changed, 9 insertions(+), 6 deletions(-)
Comments
On Fri, Mar 31, 2023 at 01:18:57PM +0530, Sricharan Ramabadhran wrote: > On the remote side, when QRTR socket is removed, af_qrtr will call > qrtr_port_remove() which broadcasts the DEL_CLIENT packet to all neighbours > including local NS. NS upon receiving the DEL_CLIENT packet, will remove > the lookups associated with the node:port and broadcasts the DEL_SERVER > packet. > > But on the host side, due to the arrival of the DEL_CLIENT packet, the NS > would've already deleted the server belonging to that port. So when the > remote's NS again broadcasts the DEL_SERVER for that port, it throws below > error message on the host: > > "failed while handling packet from 2:-2" > > So fix this error by not broadcasting the DEL_SERVER packet when the > DEL_CLIENT packet gets processed." > > Fixes: 0c2204a4ad71 ("net: qrtr: Migrate nameservice to kernel from userspace") > Signed-off-by: Sricharan Ramabadhran <quic_srichara@quicinc.com> > Signed-off-by: Ram Kumar Dharuman <quic_ramd@quicinc.com> > --- > [v2] Fixed comments from Manivannan and Jakub Kicinski > Note: Functionally tested on 5.4 and compile tested on 6.3 TOT > > net/qrtr/ns.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c > index 722936f..0f25a38 100644 > --- a/net/qrtr/ns.c > +++ b/net/qrtr/ns.c > @@ -274,7 +274,7 @@ static struct qrtr_server *server_add(unsigned int service, > return NULL; > } > > -static int server_del(struct qrtr_node *node, unsigned int port) > +static int server_del(struct qrtr_node *node, unsigned int port, bool bcast) > { > struct qrtr_lookup *lookup; > struct qrtr_server *srv; > @@ -287,7 +287,7 @@ static int server_del(struct qrtr_node *node, unsigned int port) > radix_tree_delete(&node->servers, port); > > /* Broadcast the removal of local servers */ > - if (srv->node == qrtr_ns.local_node) > + if (srv->node == qrtr_ns.local_node && bcast) > service_announce_del(&qrtr_ns.bcast_sq, srv); > > /* Announce the service's disappearance to observers */ > @@ -373,7 +373,7 @@ static int ctrl_cmd_bye(struct sockaddr_qrtr *from) > } > slot = radix_tree_iter_resume(slot, &iter); > rcu_read_unlock(); > - server_del(node, srv->port); > + server_del(node, srv->port, true); > rcu_read_lock(); > } > rcu_read_unlock(); > @@ -459,10 +459,13 @@ static int ctrl_cmd_del_client(struct sockaddr_qrtr *from, > kfree(lookup); > } > > - /* Remove the server belonging to this port */ > + /* Remove the server belonging to this port but don't broadcast This is still not as per the multi line comment style perferred in kernel. Please read: https://www.kernel.org/doc/html/latest/process/coding-style.html#commenting - Mani > + * DEL_SERVER. Neighbours would've already removed the server belonging > + * to this port due to the DEL_CLIENT broadcast from qrtr_port_remove(). > + */ > node = node_get(node_id); > if (node) > - server_del(node, port); > + server_del(node, port, false); > > /* Advertise the removal of this client to all local servers */ > local_node = node_get(qrtr_ns.local_node); > @@ -567,7 +570,7 @@ static int ctrl_cmd_del_server(struct sockaddr_qrtr *from, > if (!node) > return -ENOENT; > > - return server_del(node, port); > + return server_del(node, port, true); > } > > static int ctrl_cmd_new_lookup(struct sockaddr_qrtr *from, > -- > 2.7.4 >
<..> >> >> -static int server_del(struct qrtr_node *node, unsigned int port) >> +static int server_del(struct qrtr_node *node, unsigned int port, bool bcast) >> { >> struct qrtr_lookup *lookup; >> struct qrtr_server *srv; >> @@ -287,7 +287,7 @@ static int server_del(struct qrtr_node *node, unsigned int port) >> radix_tree_delete(&node->servers, port); >> >> /* Broadcast the removal of local servers */ >> - if (srv->node == qrtr_ns.local_node) >> + if (srv->node == qrtr_ns.local_node && bcast) >> service_announce_del(&qrtr_ns.bcast_sq, srv); >> >> /* Announce the service's disappearance to observers */ >> @@ -373,7 +373,7 @@ static int ctrl_cmd_bye(struct sockaddr_qrtr *from) >> } >> slot = radix_tree_iter_resume(slot, &iter); >> rcu_read_unlock(); >> - server_del(node, srv->port); >> + server_del(node, srv->port, true); >> rcu_read_lock(); >> } >> rcu_read_unlock(); >> @@ -459,10 +459,13 @@ static int ctrl_cmd_del_client(struct sockaddr_qrtr *from, >> kfree(lookup); >> } >> >> - /* Remove the server belonging to this port */ >> + /* Remove the server belonging to this port but don't broadcast > > This is still not as per the multi line comment style perferred in kernel. > Please read: https://www.kernel.org/doc/html/latest/process/coding-style.html#commenting > Ho, i had it like first style and checkpatch cribbed. Then changed it as per the second style for net/ format. You mean we should stick to 1 st style ? Regards, Sricharan
On Fri, Mar 31, 2023 at 02:02:04PM +0530, Sricharan Ramabadhran wrote: > <..> > > > > -static int server_del(struct qrtr_node *node, unsigned int port) > > > +static int server_del(struct qrtr_node *node, unsigned int port, bool bcast) > > > { > > > struct qrtr_lookup *lookup; > > > struct qrtr_server *srv; > > > @@ -287,7 +287,7 @@ static int server_del(struct qrtr_node *node, unsigned int port) > > > radix_tree_delete(&node->servers, port); > > > /* Broadcast the removal of local servers */ > > > - if (srv->node == qrtr_ns.local_node) > > > + if (srv->node == qrtr_ns.local_node && bcast) > > > service_announce_del(&qrtr_ns.bcast_sq, srv); > > > /* Announce the service's disappearance to observers */ > > > @@ -373,7 +373,7 @@ static int ctrl_cmd_bye(struct sockaddr_qrtr *from) > > > } > > > slot = radix_tree_iter_resume(slot, &iter); > > > rcu_read_unlock(); > > > - server_del(node, srv->port); > > > + server_del(node, srv->port, true); > > > rcu_read_lock(); > > > } > > > rcu_read_unlock(); > > > @@ -459,10 +459,13 @@ static int ctrl_cmd_del_client(struct sockaddr_qrtr *from, > > > kfree(lookup); > > > } > > > - /* Remove the server belonging to this port */ > > > + /* Remove the server belonging to this port but don't broadcast > > > > This is still not as per the multi line comment style perferred in kernel. > > Please read: https://www.kernel.org/doc/html/latest/process/coding-style.html#commenting > > > > Ho, i had it like first style and checkpatch cribbed. Then changed it > as per the second style for net/ format. You mean we should stick to > 1 st style ? > Oops, sorry I forgot the fact that the networking code uses a different style. Ignore my above comment. - Mani > Regards, > Sricharan
On Fri, Mar 31, 2023 at 01:18:57PM +0530, Sricharan Ramabadhran wrote: > On the remote side, when QRTR socket is removed, af_qrtr will call > qrtr_port_remove() which broadcasts the DEL_CLIENT packet to all neighbours > including local NS. NS upon receiving the DEL_CLIENT packet, will remove > the lookups associated with the node:port and broadcasts the DEL_SERVER > packet. > > But on the host side, due to the arrival of the DEL_CLIENT packet, the NS > would've already deleted the server belonging to that port. So when the > remote's NS again broadcasts the DEL_SERVER for that port, it throws below > error message on the host: > > "failed while handling packet from 2:-2" > > So fix this error by not broadcasting the DEL_SERVER packet when the > DEL_CLIENT packet gets processed." > > Fixes: 0c2204a4ad71 ("net: qrtr: Migrate nameservice to kernel from userspace") > Signed-off-by: Sricharan Ramabadhran <quic_srichara@quicinc.com> > Signed-off-by: Ram Kumar Dharuman <quic_ramd@quicinc.com> Sender's Signed-off-by should come last. With that fixed, Reviewed-by: Manivannan Sadhasivam <mani@kernel.org> - Mani > --- > [v2] Fixed comments from Manivannan and Jakub Kicinski > Note: Functionally tested on 5.4 and compile tested on 6.3 TOT > > net/qrtr/ns.c | 15 +++++++++------ > 1 file changed, 9 insertions(+), 6 deletions(-) > > diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c > index 722936f..0f25a38 100644 > --- a/net/qrtr/ns.c > +++ b/net/qrtr/ns.c > @@ -274,7 +274,7 @@ static struct qrtr_server *server_add(unsigned int service, > return NULL; > } > > -static int server_del(struct qrtr_node *node, unsigned int port) > +static int server_del(struct qrtr_node *node, unsigned int port, bool bcast) > { > struct qrtr_lookup *lookup; > struct qrtr_server *srv; > @@ -287,7 +287,7 @@ static int server_del(struct qrtr_node *node, unsigned int port) > radix_tree_delete(&node->servers, port); > > /* Broadcast the removal of local servers */ > - if (srv->node == qrtr_ns.local_node) > + if (srv->node == qrtr_ns.local_node && bcast) > service_announce_del(&qrtr_ns.bcast_sq, srv); > > /* Announce the service's disappearance to observers */ > @@ -373,7 +373,7 @@ static int ctrl_cmd_bye(struct sockaddr_qrtr *from) > } > slot = radix_tree_iter_resume(slot, &iter); > rcu_read_unlock(); > - server_del(node, srv->port); > + server_del(node, srv->port, true); > rcu_read_lock(); > } > rcu_read_unlock(); > @@ -459,10 +459,13 @@ static int ctrl_cmd_del_client(struct sockaddr_qrtr *from, > kfree(lookup); > } > > - /* Remove the server belonging to this port */ > + /* Remove the server belonging to this port but don't broadcast > + * DEL_SERVER. Neighbours would've already removed the server belonging > + * to this port due to the DEL_CLIENT broadcast from qrtr_port_remove(). > + */ > node = node_get(node_id); > if (node) > - server_del(node, port); > + server_del(node, port, false); > > /* Advertise the removal of this client to all local servers */ > local_node = node_get(qrtr_ns.local_node); > @@ -567,7 +570,7 @@ static int ctrl_cmd_del_server(struct sockaddr_qrtr *from, > if (!node) > return -ENOENT; > > - return server_del(node, port); > + return server_del(node, port, true); > } > > static int ctrl_cmd_new_lookup(struct sockaddr_qrtr *from, > -- > 2.7.4 >
On Fri, Mar 31, 2023 at 02:02:04PM +0530, Sricharan Ramabadhran wrote: > <..> > > > > -static int server_del(struct qrtr_node *node, unsigned int port) > > > +static int server_del(struct qrtr_node *node, unsigned int port, bool bcast) > > > { > > > struct qrtr_lookup *lookup; > > > struct qrtr_server *srv; > > > @@ -287,7 +287,7 @@ static int server_del(struct qrtr_node *node, unsigned int port) > > > radix_tree_delete(&node->servers, port); > > > /* Broadcast the removal of local servers */ > > > - if (srv->node == qrtr_ns.local_node) > > > + if (srv->node == qrtr_ns.local_node && bcast) > > > service_announce_del(&qrtr_ns.bcast_sq, srv); > > > /* Announce the service's disappearance to observers */ > > > @@ -373,7 +373,7 @@ static int ctrl_cmd_bye(struct sockaddr_qrtr *from) > > > } > > > slot = radix_tree_iter_resume(slot, &iter); > > > rcu_read_unlock(); > > > - server_del(node, srv->port); > > > + server_del(node, srv->port, true); > > > rcu_read_lock(); > > > } > > > rcu_read_unlock(); > > > @@ -459,10 +459,13 @@ static int ctrl_cmd_del_client(struct sockaddr_qrtr *from, > > > kfree(lookup); > > > } > > > - /* Remove the server belonging to this port */ > > > + /* Remove the server belonging to this port but don't broadcast > > > > This is still not as per the multi line comment style perferred in kernel. > > Please read: https://www.kernel.org/doc/html/latest/process/coding-style.html#commenting > > > > Ho, i had it like first style and checkpatch cribbed. Then changed it > as per the second style for net/ format. You mean we should stick to > 1 st style ? I think that what you have matches the preferred style for net/ code, and thus is correct for this patch. https://www.kernel.org/doc/html/latest/process/maintainer-netdev.html#multi-line-comments
diff --git a/net/qrtr/ns.c b/net/qrtr/ns.c index 722936f..0f25a38 100644 --- a/net/qrtr/ns.c +++ b/net/qrtr/ns.c @@ -274,7 +274,7 @@ static struct qrtr_server *server_add(unsigned int service, return NULL; } -static int server_del(struct qrtr_node *node, unsigned int port) +static int server_del(struct qrtr_node *node, unsigned int port, bool bcast) { struct qrtr_lookup *lookup; struct qrtr_server *srv; @@ -287,7 +287,7 @@ static int server_del(struct qrtr_node *node, unsigned int port) radix_tree_delete(&node->servers, port); /* Broadcast the removal of local servers */ - if (srv->node == qrtr_ns.local_node) + if (srv->node == qrtr_ns.local_node && bcast) service_announce_del(&qrtr_ns.bcast_sq, srv); /* Announce the service's disappearance to observers */ @@ -373,7 +373,7 @@ static int ctrl_cmd_bye(struct sockaddr_qrtr *from) } slot = radix_tree_iter_resume(slot, &iter); rcu_read_unlock(); - server_del(node, srv->port); + server_del(node, srv->port, true); rcu_read_lock(); } rcu_read_unlock(); @@ -459,10 +459,13 @@ static int ctrl_cmd_del_client(struct sockaddr_qrtr *from, kfree(lookup); } - /* Remove the server belonging to this port */ + /* Remove the server belonging to this port but don't broadcast + * DEL_SERVER. Neighbours would've already removed the server belonging + * to this port due to the DEL_CLIENT broadcast from qrtr_port_remove(). + */ node = node_get(node_id); if (node) - server_del(node, port); + server_del(node, port, false); /* Advertise the removal of this client to all local servers */ local_node = node_get(qrtr_ns.local_node); @@ -567,7 +570,7 @@ static int ctrl_cmd_del_server(struct sockaddr_qrtr *from, if (!node) return -ENOENT; - return server_del(node, port); + return server_del(node, port, true); } static int ctrl_cmd_new_lookup(struct sockaddr_qrtr *from,