All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yijing Wang <wangyijing@huawei.com>
To: Tejun Heo <tj@kernel.org>
Cc: Weng Meiling <wengmeiling.weng@huawei.com>,
	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>
Subject: Re: Subject: [PATCH] kobject: fix the race between kobject_del and get_device_parent
Date: Wed, 5 Nov 2014 11:27:39 +0800	[thread overview]
Message-ID: <5459992B.1040700@huawei.com> (raw)
In-Reply-To: <20141105031345.GA29392@htj.dyndns.org>

On 2014/11/5 11:13, Tejun Heo wrote:
> Hello,
> 
> On Wed, Nov 05, 2014 at 10:01:39AM +0800, Yijing Wang wrote:
>>> So, yeah, this looks like a correct approach; however, do we even need
>>> to clear the glue directories? 
>>
>> Yes. In our platform, the glue directories
>> /sys/devices/virtual/block will be removed once the last child
>> device call device_del().
> 
> What I mean is why are we even trying to remove the parent directory?
> Can't we just keep them around once created?

We remove the parent directory because parent ref count is equal to children
device numebr, every child device will get/add parent's ref count when child
device be created.

Keep the parent directory looks good to me,  we could only add kobject_get(&parent)
after the parent dir be created.

....
		/* or create a new class-directory at the parent device */
		k = class_dir_create_and_add(dev->class, parent_kobj);
		/* do not emit an uevent for this simple "glue" directory */
		kobject_get(k);  <--------add parent ref count for first child device.
		mutex_unlock(&gdp_mutex);
		return k;
....

> 
> Thanks.
> 


-- 
Thanks!
Yijing


  reply	other threads:[~2014-11-05  3:28 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-10-15  6:42 Subject: [PATCH] kobject: fix the race between kobject_del and get_device_parent 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
2014-11-05  2:01             ` Yijing Wang
2014-11-05  3:13               ` Tejun Heo
2014-11-05  3:27                 ` Yijing Wang [this message]
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=5459992B.1040700@huawei.com \
    --to=wangyijing@huawei.com \
    --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=tj@kernel.org \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.