search for: device_add_disk

Displaying 20 results from an estimated 38 matches for "device_add_disk".

2016 Aug 17
20
[PATCH 00/15] Fix issue with KOBJ_ADD uevent versus disk attributes
...pt to fix the issue that some disks' sysfs attributes are not ready at the time its KOBJ_ADD event is sent. The symptom is during device hotplug, udev may fail to find certain attributes, such as serial or wwn, of the disk. As a result the /dev/disk/by-id entries are not created. The cause is device_add_disk emits the uevent before returning, and the callers have to create sysfs entries after that. The fix here is to pass attr_groups from callers to device_add_disk, so it can be added before KOBJ_ADD. Also add basic error handling around device_add_disk code, (or add FIXME comment where work is left)...
2016 Aug 17
20
[PATCH 00/15] Fix issue with KOBJ_ADD uevent versus disk attributes
...pt to fix the issue that some disks' sysfs attributes are not ready at the time its KOBJ_ADD event is sent. The symptom is during device hotplug, udev may fail to find certain attributes, such as serial or wwn, of the disk. As a result the /dev/disk/by-id entries are not created. The cause is device_add_disk emits the uevent before returning, and the callers have to create sysfs entries after that. The fix here is to pass attr_groups from callers to device_add_disk, so it can be added before KOBJ_ADD. Also add basic error handling around device_add_disk code, (or add FIXME comment where work is left)...
2016 Aug 17
0
[PATCH 15/15] block: Add FIXME comment to handle device_add_disk error
Done with coccinelle: @@ expression e1, e2, e3; identifier rc; @@ ( rc = device_add_disk(e1, e2, e3); | + /* FIXME: handle error. */ device_add_disk(e1, e2, e3); ) Signed-off-by: Fam Zheng <famz at redhat.com> --- arch/m68k/emu/nfblock.c | 1 + arch/um/drivers/ubd_kern.c | 1 + arch/xtensa/platforms/iss/simdisk.c | 1 + drivers/block/DAC960.c...
2016 Aug 17
2
[PATCH 06/15] genhd: Add return code to device_add_disk
On Wed, 17 Aug 2016 15:15:06 +0800 Fam Zheng <famz at redhat.com> wrote: > @@ -613,10 +614,8 @@ void device_add_disk(struct device *parent, struct gendisk *disk) > disk->flags |= GENHD_FL_UP; > > retval = blk_alloc_devt(&disk->part0, &devt); > - if (retval) { > - WARN_ON(1); > - return; > - } > + if (retval) > + goto fail; > disk_to_dev(disk)->devt = devt;...
2016 Aug 17
2
[PATCH 06/15] genhd: Add return code to device_add_disk
On Wed, 17 Aug 2016 15:15:06 +0800 Fam Zheng <famz at redhat.com> wrote: > @@ -613,10 +614,8 @@ void device_add_disk(struct device *parent, struct gendisk *disk) > disk->flags |= GENHD_FL_UP; > > retval = blk_alloc_devt(&disk->part0, &devt); > - if (retval) { > - WARN_ON(1); > - return; > - } > + if (retval) > + goto fail; > disk_to_dev(disk)->devt = devt;...
2016 Aug 17
2
[PATCH 06/15] genhd: Add return code to device_add_disk
On Wed, 17 Aug 2016 16:48:23 +0800 Fam Zheng <famz at redhat.com> wrote: > On Wed, 08/17 10:49, Cornelia Huck wrote: > > On Wed, 17 Aug 2016 15:15:06 +0800 > > Fam Zheng <famz at redhat.com> wrote: > > > > > @@ -613,10 +614,8 @@ void device_add_disk(struct device *parent, struct gendisk *disk) > > > disk->flags |= GENHD_FL_UP; > > > > > > retval = blk_alloc_devt(&disk->part0, &devt); > > > - if (retval) { > > > - WARN_ON(1); > > > - return; > > > - } > >...
2016 Aug 17
2
[PATCH 06/15] genhd: Add return code to device_add_disk
On Wed, 17 Aug 2016 16:48:23 +0800 Fam Zheng <famz at redhat.com> wrote: > On Wed, 08/17 10:49, Cornelia Huck wrote: > > On Wed, 17 Aug 2016 15:15:06 +0800 > > Fam Zheng <famz at redhat.com> wrote: > > > > > @@ -613,10 +614,8 @@ void device_add_disk(struct device *parent, struct gendisk *disk) > > > disk->flags |= GENHD_FL_UP; > > > > > > retval = blk_alloc_devt(&disk->part0, &devt); > > > - if (retval) { > > > - WARN_ON(1); > > > - return; > > > - } > >...
2016 Aug 17
0
[PATCH 06/15] genhd: Add return code to device_add_disk
There are a number of places in device_add_disk that can fail, and even more to come as we extend it. Switch the return type of the function, and return the error code when error happens. The WARN_ON is kept because callers are not updated to check the error yet. Signed-off-by: Fam Zheng <famz at redhat.com> --- block/genhd.c |...
2016 Aug 17
0
[PATCH 06/15] genhd: Add return code to device_add_disk
...g 2016 16:48:23 +0800 > Fam Zheng <famz at redhat.com> wrote: > > > On Wed, 08/17 10:49, Cornelia Huck wrote: > > > On Wed, 17 Aug 2016 15:15:06 +0800 > > > Fam Zheng <famz at redhat.com> wrote: > > > > > > > @@ -613,10 +614,8 @@ void device_add_disk(struct device *parent, struct gendisk *disk) > > > > disk->flags |= GENHD_FL_UP; > > > > > > > > retval = blk_alloc_devt(&disk->part0, &devt); > > > > - if (retval) { > > > > - WARN_ON(1); > > > > - return;...
2016 Aug 17
0
[PATCH 06/15] genhd: Add return code to device_add_disk
On Wed, 08/17 10:49, Cornelia Huck wrote: > On Wed, 17 Aug 2016 15:15:06 +0800 > Fam Zheng <famz at redhat.com> wrote: > > > @@ -613,10 +614,8 @@ void device_add_disk(struct device *parent, struct gendisk *disk) > > disk->flags |= GENHD_FL_UP; > > > > retval = blk_alloc_devt(&disk->part0, &devt); > > - if (retval) { > > - WARN_ON(1); > > - return; > > - } > > + if (retval) > > + goto fai...
2016 Aug 17
0
[PATCH 09/15] virtio-blk: Pass attribute group to device_add_disk
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries conditionally. device_add_disk can handle...
2016 Aug 17
0
[PATCH 08/15] nvme: Pass attribute group to device_add_disk
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries conditionally. device_add_disk can handle...
2016 Aug 17
0
[PATCH 11/15] zram: Pass attribute group to device_add_disk
Previously after device_add_disk returns, the KOBJ_ADD uevent is already emitted. Adding attributes after that is a poor usage of kobject, and in practice may result in race conditions with userspace, for example udev checks availability of certain attributes and initializes /dev entries conditionally. device_add_disk can handle...
2016 Aug 18
1
[PATCH 11/15] zram: Pass attribute group to device_add_disk
...644 > --- a/drivers/block/zram/zram_drv.c > +++ b/drivers/block/zram/zram_drv.c > @@ -1298,13 +1298,10 @@ static int zram_add(void) > zram->disk->queue->limits.discard_zeroes_data = 0; > queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, zram->disk->queue); > > - device_add_disk(NULL, zram->disk, NULL); > + ret = device_add_disk(NULL, zram->disk, &zram_disk_attr_group); > > - ret = sysfs_create_group(&disk_to_dev(zram->disk)->kobj, > - &zram_disk_attr_group); > if (ret < 0) { > - pr_err("Error creating sysfs group f...
2016 Aug 18
1
[PATCH 11/15] zram: Pass attribute group to device_add_disk
...644 > --- a/drivers/block/zram/zram_drv.c > +++ b/drivers/block/zram/zram_drv.c > @@ -1298,13 +1298,10 @@ static int zram_add(void) > zram->disk->queue->limits.discard_zeroes_data = 0; > queue_flag_set_unlocked(QUEUE_FLAG_DISCARD, zram->disk->queue); > > - device_add_disk(NULL, zram->disk, NULL); > + ret = device_add_disk(NULL, zram->disk, &zram_disk_attr_group); > > - ret = sysfs_create_group(&disk_to_dev(zram->disk)->kobj, > - &zram_disk_attr_group); > if (ret < 0) { > - pr_err("Error creating sysfs group f...
2016 Jul 01
1
[PATCH v2 00/12] gendisk: Generate uevent after attribute available
On Wed, 06/29 23:38, Christoph Hellwig wrote: > On Thu, Jun 30, 2016 at 02:35:54PM +0800, Fam Zheng wrote: > > also more code and less flexible IMO. For example, we need at least two > > variants, for attribute_group and device_attribute separately, right? > > Yes, or maybe just a calling convention that just passes both. OK, I can look into that, but I'm not sure about
2016 Jul 01
1
[PATCH v2 00/12] gendisk: Generate uevent after attribute available
On Wed, 06/29 23:38, Christoph Hellwig wrote: > On Thu, Jun 30, 2016 at 02:35:54PM +0800, Fam Zheng wrote: > > also more code and less flexible IMO. For example, we need at least two > > variants, for attribute_group and device_attribute separately, right? > > Yes, or maybe just a calling convention that just passes both. OK, I can look into that, but I'm not sure about
2020 Jul 15
3
[PATCH] virtio-blk: check host supplied logical block size
..._func__, blk_size); + err = -EINVAL; + goto out_cleanup_queue; + } blk_queue_logical_block_size(q, blk_size); - else + } else blk_size = queue_logical_block_size(q); /* Use topology information if available */ @@ -872,6 +885,9 @@ static int virtblk_probe(struct virtio_device *vdev) device_add_disk(&vdev->dev, vblk->disk, virtblk_attr_groups); return 0; +out_cleanup_queue: + blk_cleanup_queue(vblk->disk->queue); + vblk->disk->queue = NULL; out_free_tags: blk_mq_free_tag_set(&vblk->tag_set); out_put_disk: -- 2.26.2
2020 Jul 15
3
[PATCH] virtio-blk: check host supplied logical block size
..._func__, blk_size); + err = -EINVAL; + goto out_cleanup_queue; + } blk_queue_logical_block_size(q, blk_size); - else + } else blk_size = queue_logical_block_size(q); /* Use topology information if available */ @@ -872,6 +885,9 @@ static int virtblk_probe(struct virtio_device *vdev) device_add_disk(&vdev->dev, vblk->disk, virtblk_attr_groups); return 0; +out_cleanup_queue: + blk_cleanup_queue(vblk->disk->queue); + vblk->disk->queue = NULL; out_free_tags: blk_mq_free_tag_set(&vblk->tag_set); out_put_disk: -- 2.26.2
2020 Jul 15
2
[PATCH] virtio-blk: check host supplied logical block size
...gt; > > > /* Use topology information if available */ > > OK so if we are doing this pls add {} around blk_size = > queue_logical_block_size(q); > too. Will do. > > > @@ -872,6 +885,9 @@ static int virtblk_probe(struct virtio_device > > *vdev) > > device_add_disk(&vdev->dev, vblk->disk, virtblk_attr_groups); > > return 0; > > > > +out_cleanup_queue: > > + blk_cleanup_queue(vblk->disk->queue); > > + vblk->disk->queue = NULL; > > out_free_tags: > > blk_mq_free_tag_set(&vblk->tag_set...