On Tue, 2019-04-02 at 21:14 +0800, Weiping Zhang wrote:
> [ ... ]
> -static struct attribute *default_attrs[] = {
> +static struct attribute *queue_attrs[] = {
>       &queue_requests_entry.attr,
>       &queue_ra_entry.attr,
>       &queue_max_hw_sectors_entry.attr,
> @@ -770,6 +770,25 @@ static struct attribute *default_attrs[] = {
>       NULL,
>  };
> 
> [ ... ]
>
>  static ssize_t
> @@ -890,7 +909,6 @@ static const struct sysfs_ops queue_sysfs_ops = {
>  
>  struct kobj_type blk_queue_ktype = {
>       .sysfs_ops      = &queue_sysfs_ops,
> -     .default_attrs  = default_attrs,
>       .release        = blk_release_queue,
>  };
>  
> @@ -939,6 +957,14 @@ int blk_register_queue(struct gendisk *disk)
>               goto unlock;
>       }
>  
> +     ret = sysfs_create_group(&q->kobj, &queue_attr_group);
> +     if (ret) {
> +             blk_trace_remove_sysfs(dev);
> +             kobject_del(&q->kobj);
> +             kobject_put(&dev->kobj);
> +             goto unlock;
> +     }
> +
>       if (queue_is_mq(q)) {
>               __blk_mq_register_dev(dev, q);
>               blk_mq_debugfs_register(q);

This kind of change introduces an unacceptable race against udev. I think we
should wait with making this change until the patch series "kobject: Add
default group support to kobj_type and replace subsystem uses" is upstream.

Bart.

Reply via email to