mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Tejun Heo <tj@kernel.org>
To: Weng Meiling <wengmeiling.weng@huawei.com>
Cc: Greg KH <gregkh@linuxfoundation.org>,
	Frans Klaver <fransklaver@gmail.com>,
	Jens Axboe <axboe@kernel.dk>,
	akpm@linux-foundation.org, adilger.kernel@dilger.ca,
	Jan Kara <jack@suse.cz>,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>,
	Xiang Rui <rui.xiang@huawei.com>, Li Zefan <lizefan@huawei.com>,
	Huang Qiang <h.huangqiang@huawei.com>,
	Zhao Hongjiang <zhaohongjiang@huawei.com>,
	Wangyijing <wangyijing@huawei.com>
Subject: Re: Subject: [PATCH] kobject: fix the race between kobject_del and get_device_parent
Date: Tue, 4 Nov 2014 14:15:35 -0500	[thread overview]
Message-ID: <20141104191535.GI14459@htj.dyndns.org> (raw)
In-Reply-To: <544765D0.70302@huawei.com>

Hello,

Sorry about the delay.

On Wed, Oct 22, 2014 at 04:07:44PM +0800, Weng Meiling wrote:
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index 28b808c..645eacf 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -724,12 +724,12 @@ class_dir_create_and_add(struct class *class, struct kobject *parent_kobj)
>  	return &dir->kobj;
>  }
> 
> +static DEFINE_MUTEX(gdp_mutex);
> 
>  static struct kobject *get_device_parent(struct device *dev,
>  					 struct device *parent)
>  {
>  	if (dev->class) {
> -		static DEFINE_MUTEX(gdp_mutex);
>  		struct kobject *kobj = NULL;
>  		struct kobject *parent_kobj;
>  		struct kobject *k;
> @@ -793,7 +793,9 @@ static void cleanup_glue_dir(struct device *dev, struct kobject *glue_dir)
>  	    glue_dir->kset != &dev->class->p->glue_dirs)
>  		return;
> 
> +	mutex_lock(&gdp_mutex);
>  	kobject_put(glue_dir);
> +	mutex_unlock(&gdp_mutex);

So, yeah, this looks like a correct approach; however, do we even need
to clear the glue directories?  What's the downside of just keeping
them around once created?

Thanks.

-- 
tejun

  reply	other threads:[~2014-11-04 19:15 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-15  6:42 Weng Meiling
2014-10-16  1:56 ` Weng Meiling
2014-10-16  7:07   ` Frans Klaver
2014-10-16  7:23     ` Weng Meiling
2014-10-16  9:13       ` Greg KH
2014-10-22  8:07         ` Weng Meiling
2014-11-04 19:15           ` Tejun Heo [this message]
2014-11-05  2:01             ` Yijing Wang
2014-11-05  3:13               ` Tejun Heo
2014-11-05  3:27                 ` Yijing Wang
2014-11-05  3:29                   ` Tejun Heo
2014-11-05  3:52                     ` Greg KH
2014-11-05  5:14                       ` Yijing Wang

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=20141104191535.GI14459@htj.dyndns.org \
    --to=tj@kernel.org \
    --cc=adilger.kernel@dilger.ca \
    --cc=akpm@linux-foundation.org \
    --cc=axboe@kernel.dk \
    --cc=fransklaver@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=h.huangqiang@huawei.com \
    --cc=jack@suse.cz \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lizefan@huawei.com \
    --cc=rui.xiang@huawei.com \
    --cc=wangyijing@huawei.com \
    --cc=wengmeiling.weng@huawei.com \
    --cc=zhaohongjiang@huawei.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

all inboxes | Powered by JetHome®