On Wed, Aug 21, 2019 at 08:41:32AM -0700, Bart Van Assche wrote:
> On 8/20/19 8:00 PM, Ming Lei wrote:
> > On Tue, Aug 20, 2019 at 02:21:10PM -0700, Bart Van Assche wrote:
> > > - /*
> > > - * Remove the sysfs attributes before unregistering the queue data
> > > - * structures that can be modified through sysfs.
> > > - */
> > > if (queue_is_mq(q))
> > > - blk_mq_unregister_dev(disk_to_dev(disk), q);
> > > - mutex_unlock(&q->sysfs_lock);
> > > -
> > > + kobject_uevent(q->mq_kobj, KOBJ_REMOVE);
> >
> > Could you explain why you move the above line here?
>
> I'm not sure whether kobject_del() deletes any objects attached to the
> deleted kobj. This change ensures that kobject_uevent() is called before the
> parent object of q->mq_kobj is deleted.
>From comment of kernfs_remove(), all subdirectories and files will be
removed.
kobject_del
sysfs_remove_dir
kernfs_remove
/**
* kernfs_remove - remove a kernfs_node recursively
* @kn: the kernfs_node to remove
*
* Remove @kn along with all its subdirectories and files.
*/
void kernfs_remove(struct kernfs_node *kn)
Thanks,
Ming