mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Coly Li <colyli@suse.de>
To: daihuaigang129@163.com
Cc: linux-bcache@vger.kernel.org, kent.overstreet@gmail.com,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH v1] bcache: fix AB-BA deadlock between cache register and cache_set_free
Date: Fri, 8 Apr 2022 00:30:47 +0800	[thread overview]
Message-ID: <b97d4326-3ce7-63d2-e4b6-8fbd27335fce@suse.de> (raw)
In-Reply-To: <1648523845-4681-1-git-send-email-daihuaigang129@163.com>

On 3/29/22 11:17 AM, daihuaigang129@163.com wrote:
> From: daihuaigang <daihuaigang129@163.com>
>
> bcache register add kobject_mutex then bch_register_mutex,
> cache_set_free add bch_register_mutex then kobject_mutex.
> fix AB-BA deadlock between cache register and cache_set_free.

Can you explain a bit more about,

- For "bcache register add kobject_mutex", which function referred by 
"bcache register add", and where is the kobject_mutex.

- Where is bch_regsiter_mutex.

It is not clear for me to understand how hte AB-BA deadlock generated yet.

Thanks.


Coly Li


>
> Signed-off-by: daihuaigang <daihuaigang129@163.com>
> ---
>   drivers/md/bcache/super.c | 4 ++--
>   1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/md/bcache/super.c b/drivers/md/bcache/super.c
> index bf3de14..f17953c 100644
> --- a/drivers/md/bcache/super.c
> +++ b/drivers/md/bcache/super.c
> @@ -1690,10 +1690,8 @@ static void cache_set_free(struct closure *cl)
>   	if (ca) {
>   		ca->set = NULL;
>   		c->cache = NULL;
> -		kobject_put(&ca->kobj);
>   	}
>   
> -
>   	if (c->moving_gc_wq)
>   		destroy_workqueue(c->moving_gc_wq);
>   	bioset_exit(&c->bio_split);
> @@ -1704,6 +1702,8 @@ static void cache_set_free(struct closure *cl)
>   
>   	list_del(&c->list);
>   	mutex_unlock(&bch_register_lock);
> +	if (ca)
> +		kobject_put(&ca->kobj);
>   
>   	pr_info("Cache set %pU unregistered\n", c->set_uuid);
>   	wake_up(&unregister_wait);



      reply	other threads:[~2022-04-07 16:30 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-03-29  3:17 daihuaigang129
2022-04-07 16:30 ` Coly Li [this message]

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=b97d4326-3ce7-63d2-e4b6-8fbd27335fce@suse.de \
    --to=colyli@suse.de \
    --cc=daihuaigang129@163.com \
    --cc=kent.overstreet@gmail.com \
    --cc=linux-bcache@vger.kernel.org \
    --cc=linux-kernel@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

all inboxes | Powered by JetHome®