From: Luis Chamberlain <mcgrof@kernel.org> Date: 2021-09-01 21:02:21
The full set of changes can be found on my branch titled
20210901-for-axboe-add-disk-error-handling [0] which is
now based on axboe/master.
[0] https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/log/?h=20210901-for-axboe-add-disk-error-handling
Luis Chamberlain (10):
mtip32xx: add error handling support for add_disk()
pktcdvd: add error handling support for add_disk()
ps3disk: add error handling support for add_disk()
ps3vram: add error handling support for add_disk()
rnbd: add error handling support for add_disk()
block/rsxx: add error handling support for add_disk()
block/sunvdc: add error handling support for add_disk()
block/sx8: add error handling support for add_disk()
pf: add error handling support for add_disk()
mtd/ubi/block: add error handling support for add_disk()
drivers/block/mtip32xx/mtip32xx.c | 4 +++-
drivers/block/paride/pf.c | 4 +++-
drivers/block/pktcdvd.c | 4 +++-
drivers/block/ps3disk.c | 8 ++++++--
drivers/block/ps3vram.c | 7 ++++++-
drivers/block/rnbd/rnbd-clt.c | 13 +++++++++----
drivers/block/rsxx/core.c | 4 +++-
drivers/block/rsxx/dev.c | 12 +++++++++---
drivers/block/sunvdc.c | 14 +++++++++++---
drivers/block/sx8.c | 13 +++++++++----
drivers/mtd/ubi/block.c | 8 +++++++-
11 files changed, 69 insertions(+), 22 deletions(-)
--
2.30.2
From: Luis Chamberlain <mcgrof@kernel.org> Date: 2021-09-01 21:01:46
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 <mcgrof@kernel.org>
---
drivers/mtd/ubi/block.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
@@ -447,12 +447,18 @@ int ubiblock_create(struct ubi_volume_info *vi)list_add_tail(&dev->list,&ubiblock_devices);/* Must be the last step: anyone can call file ops from now on */-add_disk(dev->gd);+ret=add_disk(dev->gd);+if(ret)+gotoout_destroy_wq;+dev_info(disk_to_dev(dev->gd),"created from ubi%d:%d(%s)",dev->ubi_num,dev->vol_id,vi->name);mutex_unlock(&devices_mutex);return0;+out_destroy_wq:+list_del(&dev->list);+destroy_workqueue(dev->wq);out_remove_minor:idr_remove(&ubiblock_minor_idr,gd->first_minor);out_cleanup_disk:
From: Luis Chamberlain <mcgrof@kernel.org> Date: 2021-09-01 21:01:54
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 <mcgrof@kernel.org>
---
drivers/block/ps3disk.c | 8 ++++++--
1 file changed, 6 insertions(+), 2 deletions(-)
From: Luis Chamberlain <mcgrof@kernel.org> Date: 2021-09-01 21:01:57
We never checked for errors on add_disk() as this function
returned void. Now that this is fixed, use the shiny new
error handling.
A completion is used to notify the initial probe what is
happening and so we must defer error handling on completion.
Do this by remembering the error and using the shared cleanup
function.
The tags are shared and so are hanlded later for the
driver already.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
drivers/block/sx8.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
From: Luis Chamberlain <mcgrof@kernel.org> Date: 2021-09-01 21:01:59
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 <mcgrof@kernel.org>
---
drivers/block/rnbd/rnbd-clt.c | 13 +++++++++----
1 file changed, 9 insertions(+), 4 deletions(-)
From: Luis Chamberlain <mcgrof@kernel.org> Date: 2021-09-01 21:02:02
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 <mcgrof@kernel.org>
---
drivers/block/rsxx/core.c | 4 +++-
drivers/block/rsxx/dev.c | 12 +++++++++---
2 files changed, 12 insertions(+), 4 deletions(-)
@@ -192,6 +192,8 @@ static bool rsxx_discard_supported(struct rsxx_cardinfo *card)intrsxx_attach_dev(structrsxx_cardinfo*card){+interr=0;+mutex_lock(&card->dev_lock);/* The block device requires the stripe size from the config. */
@@ -200,13 +202,17 @@ int rsxx_attach_dev(struct rsxx_cardinfo *card)set_capacity(card->gendisk,card->size8>>9);elseset_capacity(card->gendisk,0);-device_add_disk(CARD_TO_DEV(card),card->gendisk,NULL);-card->bdev_attached=1;+err=device_add_disk(CARD_TO_DEV(card),card->gendisk,NULL);+if(err==0)+card->bdev_attached=1;}mutex_unlock(&card->dev_lock);-return0;+if(err)+blk_cleanup_disk(card->gendisk);++returnerr;}voidrsxx_detach_dev(structrsxx_cardinfo*card)
From: Luis Chamberlain <mcgrof@kernel.org> Date: 2021-09-01 21:02:06
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 out_mem2 error label already does what we need so
re-use that.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
drivers/block/pktcdvd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
From: Luis Chamberlain <mcgrof@kernel.org> Date: 2021-09-01 21:02:08
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 <mcgrof@kernel.org>
---
drivers/block/ps3vram.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
@@ -755,9 +755,14 @@ static int ps3vram_probe(struct ps3_system_bus_device *dev)dev_info(&dev->core,"%s: Using %llu MiB of GPU memory\n",gendisk->disk_name,get_capacity(gendisk)>>11);-device_add_disk(&dev->core,gendisk,NULL);+error=device_add_disk(&dev->core,gendisk,NULL);+if(error)+gotoout_cleanup_disk;+return0;+out_cleanup_disk:+blk_cleanup_disk(gendisk);out_cache_cleanup:remove_proc_entry(DEVICE_NAME,NULL);ps3vram_cache_cleanup(dev);
From: Luis Chamberlain <mcgrof@kernel.org> Date: 2021-09-01 21:02:14
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 re-use the same free tag call, so we also add a label for
that as well.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
drivers/block/sunvdc.c | 14 +++++++++++---
1 file changed, 11 insertions(+), 3 deletions(-)
@@ -826,8 +826,8 @@ static int probe_disk(struct vdc_port *port)if(IS_ERR(g)){printk(KERN_ERRPFX"%s: Could not allocate gendisk.\n",port->vio.name);-blk_mq_free_tag_set(&port->tag_set);-returnPTR_ERR(g);+err=PTR_ERR(g);+gotoout_free_tag;}port->disk=g;
@@ -879,9 +879,17 @@ static int probe_disk(struct vdc_port *port)port->vdisk_size,(port->vdisk_size>>(20-9)),port->vio.ver.major,port->vio.ver.minor);-device_add_disk(&port->vio.vdev->dev,g,NULL);+err=device_add_disk(&port->vio.vdev->dev,g,NULL);+if(err)+gotoout_cleanup_disk;return0;++out_cleanup_disk:+blk_cleanup_disk(g);+out_free_tag:+blk_mq_free_tag_set(&port->tag_set);+returnerr;}staticstructldc_channel_configvdc_ldc_cfg={
From: Luis Chamberlain <mcgrof@kernel.org> Date: 2021-09-01 21:02:15
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 read_capacity_error error label already does what we need,
so just re-use that.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
drivers/block/mtip32xx/mtip32xx.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
@@ -3633,7 +3633,9 @@ static int mtip_block_initialize(struct driver_data *dd)set_capacity(dd->disk,capacity);/* Enable the block device and add it to /dev */-device_add_disk(&dd->pdev->dev,dd->disk,mtip_disk_attr_groups);+rv=device_add_disk(&dd->pdev->dev,dd->disk,mtip_disk_attr_groups);+if(rv)+gotoread_capacity_error;if(dd->mtip_svc_handler){set_bit(MTIP_DDF_INIT_DONE_BIT,&dd->dd_flag);
From: Luis Chamberlain <mcgrof@kernel.org> Date: 2021-09-01 21:02:18
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 <mcgrof@kernel.org>
---
drivers/block/paride/pf.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
From: Jinpu Wang <jinpu.wang@ionos.com> Date: 2021-09-02 05:32:59
On Wed, Sep 1, 2021 at 11:01 PM Luis Chamberlain [off-list ref] wrote:
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 <mcgrof@kernel.org>
looks good to me.
Acked-by: Jack Wang <jinpu.wang@ionos.com>