linux-bluetooth.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH BlueZ] mesh: Only deregister io for the last network detached
@ 2020-11-06 22:48 Michael N. Moran
  2020-11-06 23:24 ` [BlueZ] " bluez.test.bot
  2020-11-10 18:26 ` [PATCH BlueZ] " Gix, Brian
  0 siblings, 2 replies; 3+ messages in thread
From: Michael N. Moran @ 2020-11-06 22:48 UTC (permalink / raw)
  To: linux-bluetooth; +Cc: brian.gix, inga.stotland, Michael N. Moran

When multiple mesh networks are active and one is detached
using Leave(), the I/O to all networks is halted.

This patch prevents that by only deregistering the I/O
if all networks have been detached.

---
 mesh/net.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/mesh/net.c b/mesh/net.c
index 01a475d74..9e0ea860f 100644
--- a/mesh/net.c
+++ b/mesh/net.c
@@ -2899,8 +2899,12 @@ struct mesh_io *mesh_net_detach(struct mesh_net *net)
 	io = net->io;
 
 	mesh_io_send_cancel(net->io, &type, 1);
-	mesh_io_deregister_recv_cb(io, snb, sizeof(snb));
-	mesh_io_deregister_recv_cb(io, pkt, sizeof(pkt));
+
+	/* Only deregister io if this is the last network detached.*/
+	if (l_queue_length(nets) < 2) {
+		mesh_io_deregister_recv_cb(io, snb, sizeof(snb));
+		mesh_io_deregister_recv_cb(io, pkt, sizeof(pkt));
+	}
 
 	net->io = NULL;
 	l_queue_remove(nets, net);
-- 
2.26.2


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [BlueZ] mesh: Only deregister io for the last network detached
  2020-11-06 22:48 [PATCH BlueZ] mesh: Only deregister io for the last network detached Michael N. Moran
@ 2020-11-06 23:24 ` bluez.test.bot
  2020-11-10 18:26 ` [PATCH BlueZ] " Gix, Brian
  1 sibling, 0 replies; 3+ messages in thread
From: bluez.test.bot @ 2020-11-06 23:24 UTC (permalink / raw)
  To: linux-bluetooth, mike

[-- Attachment #1: Type: text/plain, Size: 557 bytes --]

This is automated email and please do not reply to this email!

Dear submitter,

Thank you for submitting the patches to the linux bluetooth mailing list.
This is a CI test results with your patch series:
PW Link:https://patchwork.kernel.org/project/bluetooth/list/?series=379379

---Test result---

##############################
Test: CheckPatch - PASS

##############################
Test: CheckGitLint - PASS

##############################
Test: CheckBuild - PASS

##############################
Test: MakeCheck - PASS



---
Regards,
Linux Bluetooth


^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH BlueZ] mesh: Only deregister io for the last network detached
  2020-11-06 22:48 [PATCH BlueZ] mesh: Only deregister io for the last network detached Michael N. Moran
  2020-11-06 23:24 ` [BlueZ] " bluez.test.bot
@ 2020-11-10 18:26 ` Gix, Brian
  1 sibling, 0 replies; 3+ messages in thread
From: Gix, Brian @ 2020-11-10 18:26 UTC (permalink / raw)
  To: mike@mnmoran.org, linux-bluetooth@vger.kernel.org; +Cc: Stotland, Inga

Applied

On Fri, 2020-11-06 at 17:48 -0500, Michael N. Moran wrote:
> When multiple mesh networks are active and one is detached
> using Leave(), the I/O to all networks is halted.
> 
> This patch prevents that by only deregistering the I/O
> if all networks have been detached.
> 
> ---
>  mesh/net.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/mesh/net.c b/mesh/net.c
> index 01a475d74..9e0ea860f 100644
> --- a/mesh/net.c
> +++ b/mesh/net.c
> @@ -2899,8 +2899,12 @@ struct mesh_io *mesh_net_detach(struct mesh_net *net)
>  	io = net->io;
>  
>  	mesh_io_send_cancel(net->io, &type, 1);
> -	mesh_io_deregister_recv_cb(io, snb, sizeof(snb));
> -	mesh_io_deregister_recv_cb(io, pkt, sizeof(pkt));
> +
> +	/* Only deregister io if this is the last network detached.*/
> +	if (l_queue_length(nets) < 2) {
> +		mesh_io_deregister_recv_cb(io, snb, sizeof(snb));
> +		mesh_io_deregister_recv_cb(io, pkt, sizeof(pkt));
> +	}
>  
>  	net->io = NULL;
>  	l_queue_remove(nets, net);

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2020-11-10 18:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-11-06 22:48 [PATCH BlueZ] mesh: Only deregister io for the last network detached Michael N. Moran
2020-11-06 23:24 ` [BlueZ] " bluez.test.bot
2020-11-10 18:26 ` [PATCH BlueZ] " Gix, Brian

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).