block: first batch of add_disk() error handling conversions
Subsystems (7)
PATCH 7/10 md: add error handling support for add_disk()
In reply to Luis ChamberlainWe never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling.
We just do the unwinding of what was not done before, and are sure to unlock prior to bailing.
--- drivers/md/md.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-)
drivers/md/md.c +6 -1
@@ -5704,7 +5704,11 @@ static int md_alloc(dev_t dev, char *name)* through to md_open, so make sure it doesn't get too far */ mutex_lock (&mddev->open_mutex); -add_disk (disk); + error =add_disk (disk); +if (error) { +blk_cleanup_disk (disk); + goto abort_unlock; + } error =kobject_add (&mddev->kobj, &disk_to_dev (disk)->kobj,"%s" ,"md" );if (error) {
@@ -5718,6 +5722,7 @@ static int md_alloc(dev_t dev, char *name)if (mddev->kobj.sd &&sysfs_create_group (&mddev->kobj, &md_bitmap_group))pr_debug ("pointless warning\n" ); + abort_unlock:mutex_unlock (&mddev->open_mutex); abort:mutex_unlock (&disks_mutex);
Signature · 7 lines
2.30.2 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
PATCH 4/10 scsi/sr: add error handling support for add_disk()
In reply to Luis ChamberlainWe never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling.
--- drivers/scsi/sr.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/scsi/sr.c +4 -1
@@ -779,7 +779,10 @@ static int sr_probe(struct device *dev)dev_set_drvdata (dev, cd); disk->flags |=GENHD_FL_REMOVABLE ;sr_revalidate_disk (cd); -device_add_disk (&sdev->sdev_gendev, disk,NULL ); + + error =device_add_disk (&sdev->sdev_gendev, disk,NULL ); +if (error) + goto fail_minor;sdev_printk (KERN_DEBUG , sdev,"Attached scsi CD-ROM %s\n" , cd->cdi.name);
Signature · 7 lines
2.30.2 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
PATCH 6/10 mmc/core/block: add error handling support for add_disk()
In reply to Luis ChamberlainWe never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling.
The caller cleanups the disk already so all we need to do is just pass along the return value.
--- drivers/mmc/core/block.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/mmc/core/block.c +3 -1
@@ -2432,7 +2432,9 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,/* used in ->open, must be set before add_disk: */ if (area_type ==MMC_BLK_DATA_AREA_MAIN )dev_set_drvdata (&card->dev, md); -device_add_disk (md->parent, md->disk, mmc_disk_attr_groups); + ret =device_add_disk (md->parent, md->disk, mmc_disk_attr_groups); +if (ret) + goto out;return md; err_kfree:
Signature · 7 lines
2.30.2 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
PATCH 2/10 scsi/sd: add error handling support for add_disk()
In reply to Luis ChamberlainWe never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling.
--- drivers/scsi/sd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/sd.c +5 -1
@@ -3487,7 +3487,11 @@ static int sd_probe(struct device *dev)pm_runtime_set_autosuspend_delay (dev, sdp->host->hostt->rpm_autosuspend_delay); } -device_add_disk (dev, gd,NULL ); + + error =device_add_disk (dev, gd,NULL ); +if (error) + goto out_free_index; +if (sdkp->capacity)sd_dif_config_host (sdkp);
Signature · 7 lines
2.30.2 _______________________________________________ Linux-nvme mailing list [email protected] http://lists.infradead.org/mailman/listinfo/linux-nvme
PATCH 9/10 loop: add error handling support for add_disk()
In reply to Luis ChamberlainWe never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling.
--- drivers/block/loop.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/block/loop.c +8 -1
@@ -2393,10 +2393,17 @@ static int loop_add(int i) disk->events =DISK_EVENT_MEDIA_CHANGE ; disk->event_flags =DISK_EVENT_FLAG_UEVENT ;sprintf (disk->disk_name,"loop%d" , i); -add_disk (disk); + + err =add_disk (disk); +if (err) + goto out_cleanup_disk; +mutex_unlock (&loop_ctl_mutex); +return i; +out_cleanup_disk: +blk_cleanup_disk (disk); out_cleanup_tags:blk_mq_free_tag_set (&lo->tag_set); out_free_idr:
Signature · 1 line
2.30.2
cover block: first batch of add_disk() error handling conversions
There's a total of 70 pending patches in my queue which transform drivers over to use the new add_disk() error handling. Now that Jens has merged the core components what is left are all the other driver conversions. A bit of these changes are helpers to make that easier to do.
I'm going to split the driver conversions into batches, and this first batch are drivers which should be of high priority to consider.
Should this get merged, I'll chug on with the next batch, and so on with batches of 10 each, until we tackle last the wonderful world of floppy drivers.
I've put together a git tree based on Jen's for-5.15/block branch which holds all of my pending changes, in case anyone wants to take a peak.
Luis Chamberlain (10):
scsi/sd: use blk_cleanup_queue() insted of put_disk() scsi/sd: add error handling support for add_disk() scsi/sr: use blk_cleanup_disk() instead of put_disk() scsi/sr: add error handling support for add_disk()
nvme: add error handling support for add_disk() mmc/core/block: add error handling support for add_disk()
md: add error handling support for add_disk()
dm: add add_disk() error handling
loop: add error handling support for add_disk()
nbd: add error handling support for add_disk()
drivers/block/loop.c | 9 ++++++++- drivers/block/nbd.c | 6 +++++- drivers/md/dm.c | 16 +++++++++++----- drivers/md/md.c | 7 ++++++- drivers/mmc/core/block.c | 4 +++- drivers/nvme/host/core.c | 10 +++++++++- drivers/scsi/sd.c | 8 ++++++-- drivers/scsi/sr.c | 7 +++++-- 8 files changed, 53 insertions(+), 14 deletions(-)
Signature · 1 line
2.30.2
PATCH 1/10 scsi/sd: use blk_cleanup_queue() insted of put_disk()
The single put_disk() is useful if you know you're not doing a cleanup after add_disk(), but since we want to add support for that, just use the normal form of blk_cleanup_disk() to cleanup the queue and put the disk.
--- drivers/scsi/sd.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sd.c +1 -1
@@ -3508,7 +3508,7 @@ static int sd_probe(struct device *dev) out_free_index:ida_free (&sd_index_ida, index); out_put: -put_disk (gd); +blk_cleanup_disk (gd); out_free:sd_zbc_release_disk (sdkp);kfree (sdkp);
Signature · 1 line
2.30.2
PATCH 3/10 scsi/sr: use blk_cleanup_disk() instead of put_disk()
In reply to Luis ChamberlainThe single put_disk() is useful if you know you're not doing a cleanup after add_disk(), but since we want to add support for that, just use the normal form of blk_cleanup_disk() to cleanup the queue and put the disk.
--- drivers/scsi/sr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/scsi/sr.c +1 -1
@@ -792,7 +792,7 @@ static int sr_probe(struct device *dev)clear_bit (minor, sr_index_bits);spin_unlock (&sr_index_lock); fail_put: -put_disk (disk); +blk_cleanup_disk (disk);mutex_destroy (&cd->lock); fail_free:kfree (cd);
Signature · 1 line
2.30.2
PATCH 5/10 nvme: add error handling support for add_disk()
In reply to Luis ChamberlainWe never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling.
--- drivers/nvme/host/core.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-)
drivers/nvme/host/core.c +9 -1
@@ -3720,6 +3720,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,struct gendisk *disk;struct nvme_id_ns *id;int node = ctrl->numa_node; +int rc;if (nvme_identify_ns (ctrl, nsid, ids, &id))return ;
@@ -3775,7 +3776,10 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,nvme_get_ctrl (ctrl); -device_add_disk (ctrl->device, ns->disk, nvme_ns_id_attr_groups); + rc =device_add_disk (ctrl->device, ns->disk, nvme_ns_id_attr_groups); +if (rc) + goto out_cleanup_ns_from_list; +if (!nvme_ns_head_multipath (ns->head))nvme_add_ns_cdev (ns);
@@ -3785,6 +3789,10 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,return ; + out_cleanup_ns_from_list: +down_write (&ctrl->namespaces_rwsem); +list_del_init (&ns->list); +up_write (&ctrl->namespaces_rwsem); out_unlink_ns:mutex_lock (&ctrl->subsys->lock);list_del_rcu (&ns->siblings);
Signature · 1 line
2.30.2
PATCH 8/10 dm: add add_disk() error handling
In reply to Luis ChamberlainWe never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling.
--- drivers/md/dm.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-)
drivers/md/dm.c +11 -5
@@ -2077,15 +2077,21 @@ int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t)if (r)return r; -add_disk (md->disk); + r =add_disk (md->disk); +if (r) + goto out_cleanup_disk; r =dm_sysfs_init (md); -if (r) { -del_gendisk (md->disk); -return r; - } +if (r) + goto out_del_gendisk; md->type = type;return 0 ; + +out_cleanup_disk: +blk_cleanup_disk (md->disk); +out_del_gendisk: +del_gendisk (md->disk); +return r; }struct mapped_device *dm_get_md (dev_t dev)
Signature · 1 line
2.30.2
PATCH 10/10 nbd: add error handling support for add_disk()
In reply to Luis ChamberlainWe never checked for errors on add_disk() as this function returned void. Now that this is fixed, use the shiny new error handling.
--- drivers/block/nbd.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/block/nbd.c +5 -1
@@ -1730,10 +1730,14 @@ static int nbd_dev_add(int index) disk->fops = &nbd_fops; disk->private_data = nbd;sprintf (disk->disk_name,"nbd%d" , index); -add_disk (disk); + err =add_disk (disk); +if (err) + goto out_err_disk; nbd_total_devices++;return index; +out_err_disk: +blk_cleanup_disk (disk); out_free_idr:idr_remove (&nbd_index_idr, index); out_free_tags:
Signature · 1 line
2.30.2
Re: [PATCH 01/10] scsi/sd: use blk_cleanup_queue() insted of put_disk()
In reply to Luis ChamberlainQuoted 4 lines · Luis Chamberlain
The single
put_disk()is useful if you know you're not doing a cleanup afteradd_disk(), but since we want to add support for that, just use the normal form ofblk_cleanup_disk()to cleanup the queue and put the disk.
Hmm, I don't think this is correct. The request_queue is owned by the core SCSI code.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 02/10] scsi/sd: add error handling support for add_disk()
In reply to Luis ChamberlainQuoted 5 lines · Luis Chamberlain
We never checked for errors on
add_disk()as this function returned void. Now that this is fixed, use the shiny new error handling.Signed-off-by Luis Chamberlain <[email protected]>
Looks good,
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 03/10] scsi/sr: use blk_cleanup_disk() instead of put_disk()
In reply to Luis ChamberlainQuoted 6 lines · Luis Chamberlain
The single
put_disk()is useful if you know you're not doing a cleanup afteradd_disk(), but since we want to add support for that, just use the normal form ofblk_cleanup_disk()to cleanup the queue and put the disk.Signed-off-by Luis Chamberlain <[email protected]>
.. not needed as the cleanup is done by the core scsi code.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 04/10] scsi/sr: add error handling support for add_disk()
In reply to Luis ChamberlainQuoted 5 lines · Luis Chamberlain
We never checked for errors on
add_disk()as this function returned void. Now that this is fixed, use the shiny new error handling.Signed-off-by Luis Chamberlain <[email protected]>
Looks good,
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 05/10] nvme: add error handling support for add_disk()
In reply to Luis Chamberlaindrivers/nvme/host/core.c static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid, · line 3782
Quoted 4 lines · Luis Chamberlain
drivers/nvme/host/core.c +4
-0+ rc =device_add_disk (ctrl->device, ns->disk, nvme_ns_id_attr_groups); +if (rc) + goto out_cleanup_ns_from_list; +
Nit: no real need for the rc variable here as we never use the actual value.
drivers/nvme/host/core.c static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid, · line 3795
Quoted 11 lines
drivers/nvme/host/core.c +4
-0if (!nvme_ns_head_multipath (ns->head))nvme_add_ns_cdev (ns);@@ -3785,6 +3789,10 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,return ; + out_cleanup_ns_from_list: +down_write (&ctrl->namespaces_rwsem); +list_del_init (&ns->list); +up_write (&ctrl->namespaces_rwsem);
This also needs to do a nvme_put_ctrl.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 06/10] mmc/core/block: add error handling support for add_disk()
In reply to Luis ChamberlainQuoted 17 lines · Luis Chamberlain
We never checked for errors on
add_disk()as this function returned void. Now that this is fixed, use the shiny new error handling.The caller cleanups the disk already so all we need to do is just pass along the return value.
Signed-off-by Luis Chamberlain <[email protected]>--- drivers/mmc/core/block.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)drivers/mmc/core/block.c +0
-0
drivers/mmc/core/block.c static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, · line 2437
Quoted 7 lines
drivers/mmc/core/block.c +3
-1@@ -2432,7 +2432,9 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,/* used in ->open, must be set before add_disk: */ if (area_type ==MMC_BLK_DATA_AREA_MAIN )dev_set_drvdata (&card->dev, md); -device_add_disk (md->parent, md->disk, mmc_disk_attr_groups); + ret =device_add_disk (md->parent, md->disk, mmc_disk_attr_groups); +if (ret) + goto out;
This needs to do a blk_cleanup_queue and also te kfree of md.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 07/10] md: add error handling support for add_disk()
In reply to Luis ChamberlainQuoted 8 lines · Luis Chamberlain
We never checked for errors on
add_disk()as this function returned void. Now that this is fixed, use the shiny new error handling.We just do the unwinding of what was not done before, and are sure to unlock prior to bailing.
Signed-off-by Luis Chamberlain <[email protected]>
Looks good,
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 08/10] dm: add add_disk() error handling
In reply to Luis ChamberlainQuoted 10 lines · Luis Chamberlain
drivers/md/dm.c +3
-5-add_disk (md->disk); + r =add_disk (md->disk); +if (r) + goto out_cleanup_disk; r =dm_sysfs_init (md); -if (r) { -del_gendisk (md->disk); -return r; - }
drivers/md/dm.c int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t) · line 2094
Quoted 10 lines
drivers/md/dm.c +8
-0+if (r) + goto out_del_gendisk; md->type = type;return 0 ; + +out_cleanup_disk: +blk_cleanup_disk (md->disk); +out_del_gendisk: +del_gendisk (md->disk); +return r;
I think the add_disk should just return r. If you look at the callers they eventualy end up in dm_table_destroy, which does this cleanup.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 09/10] loop: add error handling support for add_disk()
In reply to Luis ChamberlainQuoted 6 lines · Luis Chamberlain
We never checked for errors on
add_disk()as this function returned void. Now that this is fixed, use the shiny new error handling.Signed-off-by Luis Chamberlain <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>
Looks good:
and I think you can drop my signoff. I added this when I planned to send out with the original conversion, but dropped it for simpler examples.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 10/10] nbd: add error handling support for add_disk()
In reply to Luis ChamberlainQuoted 6 lines · Luis Chamberlain
We never checked for errors on
add_disk()as this function returned void. Now that this is fixed, use the shiny new error handling.Signed-off-by Luis Chamberlain <[email protected]>Signed-off-by Christoph Hellwig <[email protected]>
Looks good:
Same comment on the signoff as for the previous one.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 01/10] scsi/sd: use blk_cleanup_queue() insted of put_disk()
In reply to Christoph HellwigQuoted 8 lines · Christoph Hellwig
Quoted 4 lines · Luis Chamberlain
The single
put_disk()is useful if you know you're not doing a cleanup afteradd_disk(), but since we want to add support for that, just use the normal form ofblk_cleanup_disk()to cleanup the queue and put the disk.Hmm, I don't think this is correct. The
request_queueis owned by the core SCSI code.
Alright, I'll drop this one. For the life of me I can't find the respective probe call on the scsi layer.
Luis
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 03/10] scsi/sr: use blk_cleanup_disk() instead of put_disk()
In reply to Christoph HellwigQuoted 9 lines · Christoph Hellwig
Quoted 6 lines · Luis Chamberlain
The single
put_disk()is useful if you know you're not doing a cleanup afteradd_disk(), but since we want to add support for that, just use the normal form ofblk_cleanup_disk()to cleanup the queue and put the disk.Signed-off-by Luis Chamberlain <[email protected]>.. not needed as the cleanup is done by the core scsi code.
Dropped.
Luis
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 05/10] nvme: add error handling support for add_disk()
In reply to Christoph HellwigQuoted 8 lines · Christoph Hellwig
drivers/nvme/host/core.c static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid, · line 3782
Quoted 4 lines · Luis Chamberlain
drivers/nvme/host/core.c +4
-0+ rc =device_add_disk (ctrl->device, ns->disk, nvme_ns_id_attr_groups); +if (rc) + goto out_cleanup_ns_from_list; +Nit: no real need for the rc variable here as we never use the actual value.
Alrighty.
Quoted 5 lines
Quoted 5 lines
drivers/nvme/host/core.c +0
-0if (!nvme_ns_head_multipath (ns->head))nvme_add_ns_cdev (ns);@@ -3785,6 +3789,10 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid,
Quoted 8 lines
drivers/nvme/host/core.c static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid, · line 3795
Quoted 6 lines
drivers/nvme/host/core.c +4
-0return ; + out_cleanup_ns_from_list: +down_write (&ctrl->namespaces_rwsem); +list_del_init (&ns->list); +up_write (&ctrl->namespaces_rwsem);This also needs to do a
nvme_put_ctrl.
Fixed.
Luis
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 06/10] mmc/core/block: add error handling support for add_disk()
In reply to Christoph HellwigQuoted 13 lines · Christoph Hellwig
Quoted 12 lines · Luis Chamberlain
We never checked for errors on
add_disk()as this function returned void. Now that this is fixed, use the shiny new error handling.The caller cleanups the disk already so all we need to do is just pass along the return value.
Signed-off-by Luis Chamberlain <[email protected]>--- drivers/mmc/core/block.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
Quoted 14 lines
drivers/mmc/core/block.c static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, · line 2437
Quoted 12 lines
drivers/mmc/core/block.c +3
-1@@ -2432,7 +2432,9 @@ static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card,/* used in ->open, must be set before add_disk: */ if (area_type ==MMC_BLK_DATA_AREA_MAIN )dev_set_drvdata (&card->dev, md); -device_add_disk (md->parent, md->disk, mmc_disk_attr_groups); + ret =device_add_disk (md->parent, md->disk, mmc_disk_attr_groups); +if (ret) + goto out;This needs to do a
blk_cleanup_queueand also te kfree of md.
If mmc_blk_alloc_parts() fails mmc_blk_remove_req() is called which does both for us?
Luis
Re: [PATCH 08/10] dm: add add_disk() error handling
In reply to Christoph HellwigQuoted 17 lines · Christoph Hellwig
Quoted 16 lines · Luis Chamberlain
drivers/md/dm.c +7
-5-add_disk (md->disk); + r =add_disk (md->disk); +if (r) + goto out_cleanup_disk; r =dm_sysfs_init (md); -if (r) { -del_gendisk (md->disk); -return r; - } +if (r) + goto out_del_gendisk; md->type = type;return 0 ; + +out_cleanup_disk:
Quoted 8 lines
drivers/md/dm.c int dm_setup_md_queue(struct mapped_device *md, struct dm_table *t) · line 2094
Quoted 4 lines
drivers/md/dm.c +4
-0+blk_cleanup_disk (md->disk); +out_del_gendisk: +del_gendisk (md->disk); +return r;I think the
add_diskshould just return r. If you look at the callers they eventualy end up indm_table_destroy, which does this cleanup.
I don't see it. What part of dm_table_destroy() does this?
Luis
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 01/10] scsi/sd: use blk_cleanup_queue() insted of put_disk()
In reply to Luis ChamberlainQuoted 7 lines · Luis Chamberlain
Quoted 6 lines · Christoph Hellwig
Quoted 4 lines · Luis Chamberlain
The single
put_disk()is useful if you know you're not doing a cleanup afteradd_disk(), but since we want to add support for that, just use the normal form ofblk_cleanup_disk()to cleanup the queue and put the disk.
Quoted 5 lines
Quoted 2 lines
Hmm, I don't think this is correct. The
request_queueis owned by the core SCSI code.Alright, I'll drop this one. For the life of me I can't find the respective probe call on the scsi layer.
What probe call? SCSI allocates the request_queue using the normal blk_mq_init_queue function in scsi_alloc_sdev. It it then used to send SCSI passthrough commands for probing before eventually binding an upper level driver using the driver model (or something not binding one at all if there is none for the device type).
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 06/10] mmc/core/block: add error handling support for add_disk()
In reply to Luis ChamberlainQuoted 11 lines · Luis Chamberlain
Quoted 8 lines
drivers/mmc/core/block.c static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, · line 2437
Quoted 6 lines
drivers/mmc/core/block.c +3
-1if (area_type ==MMC_BLK_DATA_AREA_MAIN )dev_set_drvdata (&card->dev, md); -device_add_disk (md->parent, md->disk, mmc_disk_attr_groups); + ret =device_add_disk (md->parent, md->disk, mmc_disk_attr_groups); +if (ret) + goto out;This needs to do a
blk_cleanup_queueand also te kfree of md.If
mmc_blk_alloc_parts()failsmmc_blk_remove_req()is called which does both for us?
Yes, but only for the main gendisk, and those parts already added to the list which happens after device_add_disk succeeded.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 08/10] dm: add add_disk() error handling
In reply to Luis ChamberlainQuoted 5 lines · Luis Chamberlain
Quoted 3 lines
I think the
add_diskshould just return r. If you look at the callers they eventualy end up indm_table_destroy, which does this cleanup.I don't see it. What part of
dm_table_destroy()does this?
Sorry, dm_destroy, not dm_table_destroy. For dm_early_create it's trivial as that calls both dm_table_destroy and dm_destroy in the error path. The normal table_load case is a separate ioctl, but if that fails userspace needs to call the DM_DEV_REMOVE_CMD to cleanup the state - similar to any other failure.
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 06/10] mmc/core/block: add error handling support for add_disk()
In reply to Christoph HellwigQuoted 10 lines · Christoph Hellwig
Quoted 9 lines · Luis Chamberlain
Quoted 8 lines
drivers/mmc/core/block.c static struct mmc_blk_data *mmc_blk_alloc_req(struct mmc_card *card, · line 2437
Quoted 6 lines
drivers/mmc/core/block.c +3
-1if (area_type ==MMC_BLK_DATA_AREA_MAIN )dev_set_drvdata (&card->dev, md); -device_add_disk (md->parent, md->disk, mmc_disk_attr_groups); + ret =device_add_disk (md->parent, md->disk, mmc_disk_attr_groups); +if (ret) + goto out;This needs to do a
blk_cleanup_queueand also te kfree of md.
Quoted 5 lines
Quoted 2 lines
If
mmc_blk_alloc_parts()failsmmc_blk_remove_req()is called which does both for us?Yes, but only for the main gendisk, and those parts already added to the list which happens after
device_add_disksucceeded.
Ah yes I see that now. Will fix up. The tag also needs to be cleaned up.
Luis
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme
Re: [PATCH 08/10] dm: add add_disk() error handling
In reply to Christoph HellwigQuoted 5 lines · Christoph Hellwig
Quoted 4 lines · Luis Chamberlain
Quoted 3 lines
I think the
add_diskshould just return r. If you look at the callers they eventualy end up indm_table_destroy, which does this cleanup.
Quoted 7 lines
Quoted 1 line
I don't see it. What part of
dm_table_destroy()does this?Sorry,
dm_destroy, notdm_table_destroy. Fordm_early_createit's trivial as that calls bothdm_table_destroyanddm_destroyin the error path. The normaltable_loadcase is a separate ioctl, but if that fails userspace needs to call theDM_DEV_REMOVE_CMDto cleanup the state - similar to any other failure.
I see, ok sure I'll document this on the commit log as its not so obvious.
Luis
_______________________________________________
Linux-nvme mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-nvme