netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jens Axboe <jens.axboe@oracle.com>
To: Dave Young <hidave.darkstar@gmail.com>
Cc: marcel@holtmann.org, davem@davemloft.net,
	linux-kernel@vger.kernel.org, bluez-devel@lists.sf.net,
	netdev@vger.kernel.org
Subject: Re: [PATCH retry] bluetooth : add conn add/del workqueues to avoid  connection fail
Date: Thu, 31 Jan 2008 14:09:30 +0100	[thread overview]
Message-ID: <20080131130930.GW15220@kernel.dk> (raw)
In-Reply-To: <20080130022354.GA3132@darkstar.te-china.tietoenator.com>

On Wed, Jan 30 2008, Dave Young wrote:
> 
> The bluetooth hci_conn sysfs add/del executed in the default workqueue.
> If the del_conn is executed after the new add_conn with same target,
> add_conn will failed with warning of "same kobject name".
> 
> Here add btaddconn & btdelconn workqueues,
> flush the btdelconn workqueue in the add_conn function to avoid the issue.
> 
> Signed-off-by: Dave Young <hidave.darkstar@gmail.com> 
> 
> ---
> diff -upr a/net/bluetooth/hci_sysfs.c b/net/bluetooth/hci_sysfs.c
> --- a/net/bluetooth/hci_sysfs.c	2008-01-30 10:14:27.000000000 +0800
> +++ b/net/bluetooth/hci_sysfs.c	2008-01-30 10:14:14.000000000 +0800
> @@ -12,6 +12,8 @@
>  #undef  BT_DBG
>  #define BT_DBG(D...)
>  #endif
> +static struct workqueue_struct *btaddconn;
> +static struct workqueue_struct *btdelconn;
>  
>  static inline char *typetostr(int type)
>  {
> @@ -279,6 +281,7 @@ static void add_conn(struct work_struct 
>  	struct hci_conn *conn = container_of(work, struct hci_conn, work);
>  	int i;
>  
> +	flush_workqueue(btdelconn);
>  	if (device_add(&conn->dev) < 0) {
>  		BT_ERR("Failed to register connection device");
>  		return;
> @@ -313,6 +316,7 @@ void hci_conn_add_sysfs(struct hci_conn 
>  
>  	INIT_WORK(&conn->work, add_conn);
>  
> +	queue_work(btaddconn, &conn->work);
>  	schedule_work(&conn->work);
>  }

So you queue &conn->work on both btaddconn and keventd_wq?

-- 
Jens Axboe


  parent reply	other threads:[~2008-01-31 13:09 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-01-30  2:23 [PATCH retry] bluetooth : add conn add/del workqueues to avoid connection fail Dave Young
2008-01-30  5:14 ` David Miller
2008-01-30 10:21   ` Marcel Holtmann
2008-01-31  1:29     ` Dave Young
2008-01-31 13:09 ` Jens Axboe [this message]
2008-02-01  1:24   ` Dave Young
2008-02-01  2:33     ` David Miller
2008-02-01  2:57       ` Dave Young

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=20080131130930.GW15220@kernel.dk \
    --to=jens.axboe@oracle.com \
    --cc=bluez-devel@lists.sf.net \
    --cc=davem@davemloft.net \
    --cc=hidave.darkstar@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=marcel@holtmann.org \
    --cc=netdev@vger.kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).