public inbox for linux-bluetooth@vger.kernel.org
 help / color / mirror / Atom feed
From: Marcel Holtmann <marcel@holtmann.org>
To: Daryl Van Vorst <daryl@wideray.com>
Cc: "'BlueZ Mailing List'" <bluez-devel@lists.sourceforge.net>
Subject: RE: [Bluez-devel] Rfcomm Use Count
Date: Tue, 21 Sep 2004 01:33:03 +0200	[thread overview]
Message-ID: <1095723182.5731.76.camel@pegasus> (raw)
In-Reply-To: <003101c49f62$7e2f7fb0$1a01010a@baked>

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

Hi Daryl,

> > so this means when we disconnect we must ensure that we also 
> > remove this
> > connection from the accept queue if it is pending there.
> > 
> > What I know think is that calling the bt_accept_unlink() function only
> > from bt_accept_dequeue() is wrong. If bt_sk(sk)->parent is set and we
> > ran into a disconnect then we must unlink it by ourself. Does 
> > this make
> > sense?
> 
> This makes sense to me, but I'm not convinced that it's enough of a problem
> to warrant major changes. And I'm probably not the best person to ask. ;)

for the L2CAP part the attached patch may fixes the problem and let the
module reference count decrease after the disconnect. The patch is only
compile tested. May you wanna give it a chance and run your L2CAP tests
again.

> Do we know how the tcp stack handles this kind of thing? (I had a quick look
> at a text on sockets and it didn't specifically cover the case of
> connections getting closed which are in the queue. But it was clear that the
> precise behaviour of the queue varies for tcp-ip from unix to unix.)
> 
> Most servers (I think) would sit with accept() blocking and then spend a
> very brief time handing off the new connection before blocking on accept()
> again. So this wouldn't cause much trouble.
> 
> I suppose this could affect a very simple server which is single-threaded
> (and so could spend significant time between accept() calls). Or a very busy
> server. I'm not sure that this is really a major issue for bluetooth (the
> bandwith and number of real connections is quite limited compared to
> tcp-ip).

The queueing for the accept case is different and so you can't really
compare Bluetooth with TCP/IP. Maybe we made a design mistake in the
early days of BlueZ that will now hit us very badly.

Regards

Marcel


[-- Attachment #2: patch --]
[-- Type: text/plain, Size: 1437 bytes --]

===== include/net/bluetooth/bluetooth.h 1.18 vs edited =====
--- 1.18/include/net/bluetooth/bluetooth.h	2004-07-04 17:27:14 +02:00
+++ edited/include/net/bluetooth/bluetooth.h	2004-09-21 01:26:06 +02:00
@@ -133,6 +133,7 @@
 int  bt_sock_wait_state(struct sock *sk, int state, unsigned long timeo);
 
 void bt_accept_enqueue(struct sock *parent, struct sock *sk);
+void bt_accept_unlink(struct sock *sk);
 struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock);
 
 /* Skb helpers */
===== net/bluetooth/af_bluetooth.c 1.36 vs edited =====
--- 1.36/net/bluetooth/af_bluetooth.c	2004-07-13 15:39:15 +02:00
+++ edited/net/bluetooth/af_bluetooth.c	2004-09-21 01:26:17 +02:00
@@ -165,7 +165,7 @@
 }
 EXPORT_SYMBOL(bt_accept_enqueue);
 
-static void bt_accept_unlink(struct sock *sk)
+void bt_accept_unlink(struct sock *sk)
 {
 	BT_DBG("sk %p state %d", sk, sk->sk_state);
 
@@ -174,6 +174,7 @@
 	bt_sk(sk)->parent = NULL;
 	sock_put(sk);
 }
+EXPORT_SYMBOL(bt_accept_unlink);
 
 struct sock *bt_accept_dequeue(struct sock *parent, struct socket *newsock)
 {
===== net/bluetooth/l2cap.c 1.44 vs edited =====
--- 1.44/net/bluetooth/l2cap.c	2004-09-04 12:51:17 +02:00
+++ edited/net/bluetooth/l2cap.c	2004-09-21 01:23:41 +02:00
@@ -1005,9 +1005,10 @@
 	if (err)
 		sk->sk_err = err;
 
-	if (parent)
+	if (parent) {
+		bt_accept_unlink(sk);
 		parent->sk_data_ready(parent, 0);
-	else
+	} else
 		sk->sk_state_change(sk);
 }
 

  reply	other threads:[~2004-09-20 23:33 UTC|newest]

Thread overview: 41+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-09-17  0:10 [Bluez-devel] Rfcomm Use Count Daryl Van Vorst
2004-09-17  8:58 ` Marcel Holtmann
2004-09-20 17:58   ` Daryl Van Vorst
2004-09-20 18:32     ` Marcel Holtmann
2004-09-20 18:52       ` Daryl Van Vorst
2004-09-20 19:48         ` Marcel Holtmann
2004-09-20 20:52           ` Daryl Van Vorst
2004-09-20 18:37     ` Daryl Van Vorst
2004-09-20 19:50       ` Marcel Holtmann
2004-09-20 20:11         ` Daryl Van Vorst
2004-09-20 20:34           ` Marcel Holtmann
2004-09-20 21:03             ` Daryl Van Vorst
2004-09-20 21:28               ` Marcel Holtmann
2004-09-20 22:38                 ` Daryl Van Vorst
2004-09-20 23:33                   ` Marcel Holtmann [this message]
2004-09-21 20:14                     ` Daryl Van Vorst
2004-09-21 20:32                       ` Marcel Holtmann
2004-09-21 20:39                         ` Daryl Van Vorst
2004-09-21 21:26                           ` Daryl Van Vorst
2004-09-21 22:07                             ` Marcel Holtmann
2004-09-21 22:26                               ` Marcel Holtmann
2004-09-21 22:44                                 ` Daryl Van Vorst
2004-09-22 11:08                                   ` Marcel Holtmann
2004-09-22 13:53                                     ` Marcel Holtmann
2004-09-22 17:57                                       ` Daryl Van Vorst
2004-09-22 18:12                                         ` Marcel Holtmann
2004-09-22 19:05                                           ` Daryl Van Vorst
2004-09-22 19:33                                             ` Marcel Holtmann
2004-09-22 19:52                                               ` Daryl Van Vorst
2004-09-22 19:57                                                 ` Marcel Holtmann
2004-09-22 20:05                                                   ` Daryl Van Vorst
     [not found]                                       ` <1096471423.20392.444.camel@igno>
2004-10-02  9:26                                         ` Marcel Holtmann
  -- strict thread matches above, loose matches on Subject: below --
2004-09-13 19:06 [Bluez-devel] Rfcomm use count Daryl Van Vorst
2004-09-13 20:48 ` Daryl Van Vorst
2004-09-13 23:54   ` Daryl Van Vorst
2004-09-14  9:18     ` Marcel Holtmann
2004-09-14 21:58       ` Daryl Van Vorst
2004-08-31 22:09 Daryl Van Vorst
2004-09-08 22:48 ` Daryl Van Vorst
2004-09-08 23:10   ` Daryl Van Vorst
2004-09-12 14:15 ` Marcel Holtmann

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1095723182.5731.76.camel@pegasus \
    --to=marcel@holtmann.org \
    --cc=bluez-devel@lists.sourceforge.net \
    --cc=daryl@wideray.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox