* [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions
@ 2021-09-27 22:02 Luis Chamberlain
2021-09-27 22:02 ` [PATCH v2 1/6] cdrom/gdrom: add error handling support for add_disk() Luis Chamberlain
` (6 more replies)
0 siblings, 7 replies; 10+ messages in thread
From: Luis Chamberlain @ 2021-09-27 22:02 UTC (permalink / raw)
To: axboe, gregkh, chaitanya.kulkarni, atulgopinathan, hare,
maximlevitsky, oakad, ulf.hansson, colin.king, shubhankarvk,
baijiaju1990, trix, dongsheng.yang, ceph-devel, miquel.raynal,
richard, vigneshr, sth, hoeppner, hca, gor, borntraeger, oberpar,
tj
Cc: linux-s390, linux-mtd, linux-mmc, linux-block, linux-kernel,
Luis Chamberlain
This is the 5th series of driver conversions for add_disk() error
handling. This set along with the entire 7th set of patches can be
found on my 20210927-for-axboe-add-disk-error-handling branch [0].
On this v2 series the following changes have been made
since the first iteration of this patchset:
- rebased onto linux-next tag 20210927
- ms_block: dropped this patch as its already merged on linux-next
- mspro_block: dropped this patch as its already merged on linux-next
- dropped the s390/block/xpram patch as that driver is now removed
- s390/block/dcssblk: dropped my patch in favor of Gerald Schaefer's
- added respective reviewed-by/acked-by tags
[0] https://git.kernel.org/pub/scm/linux/kernel/git/mcgrof/linux-next.git/log/?h=20210927-for-axboe-add-disk-error-handling
Gerald Schaefer (1):
s390/block/dcssblk: add error handling support for add_disk()
Luis Chamberlain (5):
cdrom/gdrom: add error handling support for add_disk()
rbd: add add_disk() error handling
mtd: add add_disk() error handling
s390/block/dasd_genhd: add error handling support for add_disk()
s390/block/scm_blk: add error handling support for add_disk()
drivers/block/rbd.c | 6 +++++-
drivers/cdrom/gdrom.c | 7 ++++++-
drivers/mtd/mtd_blkdevs.c | 6 +++++-
drivers/s390/block/dasd_genhd.c | 10 ++++++++--
drivers/s390/block/dcssblk.c | 8 +++++++-
drivers/s390/block/scm_blk.c | 7 ++++++-
6 files changed, 37 insertions(+), 7 deletions(-)
--
2.30.2
^ permalink raw reply [flat|nested] 10+ messages in thread
* [PATCH v2 1/6] cdrom/gdrom: add error handling support for add_disk()
2021-09-27 22:02 [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions Luis Chamberlain
@ 2021-09-27 22:02 ` Luis Chamberlain
2021-09-27 22:02 ` [PATCH v2 2/6] rbd: add add_disk() error handling Luis Chamberlain
` (5 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Luis Chamberlain @ 2021-09-27 22:02 UTC (permalink / raw)
To: axboe, gregkh, chaitanya.kulkarni, atulgopinathan, hare,
maximlevitsky, oakad, ulf.hansson, colin.king, shubhankarvk,
baijiaju1990, trix, dongsheng.yang, ceph-devel, miquel.raynal,
richard, vigneshr, sth, hoeppner, hca, gor, borntraeger, oberpar,
tj
Cc: linux-s390, linux-mtd, linux-mmc, linux-block, linux-kernel,
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 <mcgrof@kernel.org>
---
drivers/cdrom/gdrom.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/cdrom/gdrom.c b/drivers/cdrom/gdrom.c
index 8e1fe75af93f..d50cc1fd34d5 100644
--- a/drivers/cdrom/gdrom.c
+++ b/drivers/cdrom/gdrom.c
@@ -805,9 +805,14 @@ static int probe_gdrom(struct platform_device *devptr)
err = -ENOMEM;
goto probe_fail_free_irqs;
}
- add_disk(gd.disk);
+ err = add_disk(gd.disk);
+ if (err)
+ goto probe_fail_add_disk;
+
return 0;
+probe_fail_add_disk:
+ kfree(gd.toc);
probe_fail_free_irqs:
free_irq(HW_EVENT_GDROM_DMA, &gd);
free_irq(HW_EVENT_GDROM_CMD, &gd);
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 2/6] rbd: add add_disk() error handling
2021-09-27 22:02 [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions Luis Chamberlain
2021-09-27 22:02 ` [PATCH v2 1/6] cdrom/gdrom: add error handling support for add_disk() Luis Chamberlain
@ 2021-09-27 22:02 ` Luis Chamberlain
2021-09-27 22:02 ` [PATCH v2 3/6] mtd: " Luis Chamberlain
` (4 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Luis Chamberlain @ 2021-09-27 22:02 UTC (permalink / raw)
To: axboe, gregkh, chaitanya.kulkarni, atulgopinathan, hare,
maximlevitsky, oakad, ulf.hansson, colin.king, shubhankarvk,
baijiaju1990, trix, dongsheng.yang, ceph-devel, miquel.raynal,
richard, vigneshr, sth, hoeppner, hca, gor, borntraeger, oberpar,
tj
Cc: linux-s390, linux-mtd, linux-mmc, linux-block, linux-kernel,
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 <mcgrof@kernel.org>
---
drivers/block/rbd.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/block/rbd.c b/drivers/block/rbd.c
index e65c9d706f6f..341e5da6d029 100644
--- a/drivers/block/rbd.c
+++ b/drivers/block/rbd.c
@@ -7054,7 +7054,9 @@ static ssize_t do_rbd_add(struct bus_type *bus,
if (rc)
goto err_out_image_lock;
- device_add_disk(&rbd_dev->dev, rbd_dev->disk, NULL);
+ rc = device_add_disk(&rbd_dev->dev, rbd_dev->disk, NULL);
+ if (rc)
+ goto err_out_cleanup_disk;
spin_lock(&rbd_dev_list_lock);
list_add_tail(&rbd_dev->node, &rbd_dev_list);
@@ -7068,6 +7070,8 @@ static ssize_t do_rbd_add(struct bus_type *bus,
module_put(THIS_MODULE);
return rc;
+err_out_cleanup_disk:
+ rbd_free_disk(rbd_dev);
err_out_image_lock:
rbd_dev_image_unlock(rbd_dev);
rbd_dev_device_release(rbd_dev);
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 3/6] mtd: add add_disk() error handling
2021-09-27 22:02 [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions Luis Chamberlain
2021-09-27 22:02 ` [PATCH v2 1/6] cdrom/gdrom: add error handling support for add_disk() Luis Chamberlain
2021-09-27 22:02 ` [PATCH v2 2/6] rbd: add add_disk() error handling Luis Chamberlain
@ 2021-09-27 22:02 ` Luis Chamberlain
2021-09-27 22:02 ` [PATCH v2 4/6] s390/block/dasd_genhd: add error handling support for add_disk() Luis Chamberlain
` (3 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Luis Chamberlain @ 2021-09-27 22:02 UTC (permalink / raw)
To: axboe, gregkh, chaitanya.kulkarni, atulgopinathan, hare,
maximlevitsky, oakad, ulf.hansson, colin.king, shubhankarvk,
baijiaju1990, trix, dongsheng.yang, ceph-devel, miquel.raynal,
richard, vigneshr, sth, hoeppner, hca, gor, borntraeger, oberpar,
tj
Cc: linux-s390, linux-mtd, linux-mmc, linux-block, linux-kernel,
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.
Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
drivers/mtd/mtd_blkdevs.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/mtd/mtd_blkdevs.c b/drivers/mtd/mtd_blkdevs.c
index b8ae1ec14e17..4eaba6f4ec68 100644
--- a/drivers/mtd/mtd_blkdevs.c
+++ b/drivers/mtd/mtd_blkdevs.c
@@ -384,7 +384,9 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
if (new->readonly)
set_disk_ro(gd, 1);
- device_add_disk(&new->mtd->dev, gd, NULL);
+ ret = device_add_disk(&new->mtd->dev, gd, NULL);
+ if (ret)
+ goto out_cleanup_disk;
if (new->disk_attributes) {
ret = sysfs_create_group(&disk_to_dev(gd)->kobj,
@@ -393,6 +395,8 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
}
return 0;
+out_cleanup_disk:
+ blk_cleanup_disk(new->disk);
out_free_tag_set:
blk_mq_free_tag_set(new->tag_set);
out_kfree_tag_set:
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 4/6] s390/block/dasd_genhd: add error handling support for add_disk()
2021-09-27 22:02 [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions Luis Chamberlain
` (2 preceding siblings ...)
2021-09-27 22:02 ` [PATCH v2 3/6] mtd: " Luis Chamberlain
@ 2021-09-27 22:02 ` Luis Chamberlain
2021-09-27 22:02 ` [PATCH v2 5/6] s390/block/dcssblk: " Luis Chamberlain
` (2 subsequent siblings)
6 siblings, 0 replies; 10+ messages in thread
From: Luis Chamberlain @ 2021-09-27 22:02 UTC (permalink / raw)
To: axboe, gregkh, chaitanya.kulkarni, atulgopinathan, hare,
maximlevitsky, oakad, ulf.hansson, colin.king, shubhankarvk,
baijiaju1990, trix, dongsheng.yang, ceph-devel, miquel.raynal,
richard, vigneshr, sth, hoeppner, hca, gor, borntraeger, oberpar,
tj
Cc: linux-s390, linux-mtd, linux-mmc, linux-block, linux-kernel,
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.
Be sure to call dasd_gendisk_free() on error.
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
drivers/s390/block/dasd_genhd.c | 10 ++++++++--
1 file changed, 8 insertions(+), 2 deletions(-)
diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c
index fa966e0db6ca..80673dbfb1f9 100644
--- a/drivers/s390/block/dasd_genhd.c
+++ b/drivers/s390/block/dasd_genhd.c
@@ -33,7 +33,7 @@ int dasd_gendisk_alloc(struct dasd_block *block)
{
struct gendisk *gdp;
struct dasd_device *base;
- int len;
+ int len, rc;
/* Make sure the minor for this device exists. */
base = block->base;
@@ -79,7 +79,13 @@ int dasd_gendisk_alloc(struct dasd_block *block)
dasd_add_link_to_gendisk(gdp, base);
block->gdp = gdp;
set_capacity(block->gdp, 0);
- device_add_disk(&base->cdev->dev, block->gdp, NULL);
+
+ rc = device_add_disk(&base->cdev->dev, block->gdp, NULL);
+ if (rc) {
+ dasd_gendisk_free(block);
+ return rc;
+ }
+
return 0;
}
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 5/6] s390/block/dcssblk: add error handling support for add_disk()
2021-09-27 22:02 [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions Luis Chamberlain
` (3 preceding siblings ...)
2021-09-27 22:02 ` [PATCH v2 4/6] s390/block/dasd_genhd: add error handling support for add_disk() Luis Chamberlain
@ 2021-09-27 22:02 ` Luis Chamberlain
2021-09-27 22:02 ` [PATCH v2 6/6] s390/block/scm_blk: " Luis Chamberlain
2021-09-27 22:32 ` [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions Jens Axboe
6 siblings, 0 replies; 10+ messages in thread
From: Luis Chamberlain @ 2021-09-27 22:02 UTC (permalink / raw)
To: axboe, gregkh, chaitanya.kulkarni, atulgopinathan, hare,
maximlevitsky, oakad, ulf.hansson, colin.king, shubhankarvk,
baijiaju1990, trix, dongsheng.yang, ceph-devel, miquel.raynal,
richard, vigneshr, sth, hoeppner, hca, gor, borntraeger, oberpar,
tj
Cc: linux-s390, linux-mtd, linux-mmc, linux-block, linux-kernel,
Gerald Schaefer, Luis Chamberlain
From: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
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>
Signed-off-by: Gerald Schaefer <gerald.schaefer@linux.ibm.com>
---
drivers/s390/block/dcssblk.c | 8 +++++++-
1 file changed, 7 insertions(+), 1 deletion(-)
diff --git a/drivers/s390/block/dcssblk.c b/drivers/s390/block/dcssblk.c
index 5be3d1c39a78..0741a9321712 100644
--- a/drivers/s390/block/dcssblk.c
+++ b/drivers/s390/block/dcssblk.c
@@ -696,7 +696,9 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
}
get_device(&dev_info->dev);
- device_add_disk(&dev_info->dev, dev_info->gd, NULL);
+ rc = device_add_disk(&dev_info->dev, dev_info->gd, NULL);
+ if (rc)
+ goto out_dax;
switch (dev_info->segment_type) {
case SEG_TYPE_SR:
@@ -712,6 +714,10 @@ dcssblk_add_store(struct device *dev, struct device_attribute *attr, const char
rc = count;
goto out;
+out_dax:
+ put_device(&dev_info->dev);
+ kill_dax(dev_info->dax_dev);
+ put_dax(dev_info->dax_dev);
put_dev:
list_del(&dev_info->lh);
blk_cleanup_disk(dev_info->gd);
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* [PATCH v2 6/6] s390/block/scm_blk: add error handling support for add_disk()
2021-09-27 22:02 [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions Luis Chamberlain
` (4 preceding siblings ...)
2021-09-27 22:02 ` [PATCH v2 5/6] s390/block/dcssblk: " Luis Chamberlain
@ 2021-09-27 22:02 ` Luis Chamberlain
2021-09-27 22:32 ` [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions Jens Axboe
6 siblings, 0 replies; 10+ messages in thread
From: Luis Chamberlain @ 2021-09-27 22:02 UTC (permalink / raw)
To: axboe, gregkh, chaitanya.kulkarni, atulgopinathan, hare,
maximlevitsky, oakad, ulf.hansson, colin.king, shubhankarvk,
baijiaju1990, trix, dongsheng.yang, ceph-devel, miquel.raynal,
richard, vigneshr, sth, hoeppner, hca, gor, borntraeger, oberpar,
tj
Cc: linux-s390, linux-mtd, linux-mmc, linux-block, linux-kernel,
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.
Acked-by: Heiko Carstens <hca@linux.ibm.com>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
---
drivers/s390/block/scm_blk.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/drivers/s390/block/scm_blk.c b/drivers/s390/block/scm_blk.c
index 88cba6212ee2..61ecdcb2cc6a 100644
--- a/drivers/s390/block/scm_blk.c
+++ b/drivers/s390/block/scm_blk.c
@@ -495,9 +495,14 @@ int scm_blk_dev_setup(struct scm_blk_dev *bdev, struct scm_device *scmdev)
/* 512 byte sectors */
set_capacity(bdev->gendisk, scmdev->size >> 9);
- device_add_disk(&scmdev->dev, bdev->gendisk, NULL);
+ ret = device_add_disk(&scmdev->dev, bdev->gendisk, NULL);
+ if (ret)
+ goto out_cleanup_disk;
+
return 0;
+out_cleanup_disk:
+ blk_cleanup_disk(bdev->gendisk);
out_tag:
blk_mq_free_tag_set(&bdev->tag_set);
out:
--
2.30.2
^ permalink raw reply related [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions
2021-09-27 22:02 [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions Luis Chamberlain
` (5 preceding siblings ...)
2021-09-27 22:02 ` [PATCH v2 6/6] s390/block/scm_blk: " Luis Chamberlain
@ 2021-09-27 22:32 ` Jens Axboe
2021-09-28 8:44 ` Heiko Carstens
6 siblings, 1 reply; 10+ messages in thread
From: Jens Axboe @ 2021-09-27 22:32 UTC (permalink / raw)
To: Luis Chamberlain, gregkh, chaitanya.kulkarni, atulgopinathan,
hare, maximlevitsky, oakad, ulf.hansson, colin.king,
shubhankarvk, baijiaju1990, trix, dongsheng.yang, ceph-devel,
miquel.raynal, richard, vigneshr, sth, hoeppner, hca, gor,
borntraeger, oberpar, tj
Cc: linux-s390, linux-mtd, linux-mmc, linux-block, linux-kernel
On 9/27/21 4:02 PM, Luis Chamberlain wrote:
> This is the 5th series of driver conversions for add_disk() error
> handling. This set along with the entire 7th set of patches can be
> found on my 20210927-for-axboe-add-disk-error-handling branch [0].
Applied 1-2.
--
Jens Axboe
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions
2021-09-27 22:32 ` [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions Jens Axboe
@ 2021-09-28 8:44 ` Heiko Carstens
2021-09-28 12:28 ` Jens Axboe
0 siblings, 1 reply; 10+ messages in thread
From: Heiko Carstens @ 2021-09-28 8:44 UTC (permalink / raw)
To: Jens Axboe
Cc: Luis Chamberlain, gregkh, chaitanya.kulkarni, atulgopinathan,
hare, maximlevitsky, oakad, ulf.hansson, colin.king,
shubhankarvk, baijiaju1990, trix, dongsheng.yang, ceph-devel,
miquel.raynal, richard, vigneshr, sth, hoeppner, gor,
borntraeger, oberpar, tj, linux-s390, linux-mtd, linux-mmc,
linux-block, linux-kernel
On Mon, Sep 27, 2021 at 04:32:17PM -0600, Jens Axboe wrote:
> On 9/27/21 4:02 PM, Luis Chamberlain wrote:
> > This is the 5th series of driver conversions for add_disk() error
> > handling. This set along with the entire 7th set of patches can be
> > found on my 20210927-for-axboe-add-disk-error-handling branch [0].
>
> Applied 1-2.
Hmm.. naturally I would have expected that the dasd patch also would
go via block tree. But let's not spend too much time figuring out what
gets routed where.
Applied 4-6. Thanks!
^ permalink raw reply [flat|nested] 10+ messages in thread
* Re: [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions
2021-09-28 8:44 ` Heiko Carstens
@ 2021-09-28 12:28 ` Jens Axboe
0 siblings, 0 replies; 10+ messages in thread
From: Jens Axboe @ 2021-09-28 12:28 UTC (permalink / raw)
To: Heiko Carstens
Cc: Luis Chamberlain, gregkh, chaitanya.kulkarni, atulgopinathan,
hare, maximlevitsky, oakad, ulf.hansson, colin.king,
shubhankarvk, baijiaju1990, trix, dongsheng.yang, ceph-devel,
miquel.raynal, richard, vigneshr, sth, hoeppner, gor,
borntraeger, oberpar, tj, linux-s390, linux-mtd, linux-mmc,
linux-block, linux-kernel
On 9/28/21 2:44 AM, Heiko Carstens wrote:
> On Mon, Sep 27, 2021 at 04:32:17PM -0600, Jens Axboe wrote:
>> On 9/27/21 4:02 PM, Luis Chamberlain wrote:
>>> This is the 5th series of driver conversions for add_disk() error
>>> handling. This set along with the entire 7th set of patches can be
>>> found on my 20210927-for-axboe-add-disk-error-handling branch [0].
>>
>> Applied 1-2.
>
> Hmm.. naturally I would have expected that the dasd patch also would
> go via block tree. But let's not spend too much time figuring out what
> gets routed where.
> Applied 4-6. Thanks!
I left the ones that have active maintainers for them to pick. Unless
someone has already acked/reviwed it, in which case I picked it up.
I've got no problems picking them up directly, but unless it's been
reviewed by the maintainer, I prefer if they either do so or pick
them up.
--
Jens Axboe
^ permalink raw reply [flat|nested] 10+ messages in thread
end of thread, other threads:[~2021-09-28 12:28 UTC | newest]
Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-09-27 22:02 [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions Luis Chamberlain
2021-09-27 22:02 ` [PATCH v2 1/6] cdrom/gdrom: add error handling support for add_disk() Luis Chamberlain
2021-09-27 22:02 ` [PATCH v2 2/6] rbd: add add_disk() error handling Luis Chamberlain
2021-09-27 22:02 ` [PATCH v2 3/6] mtd: " Luis Chamberlain
2021-09-27 22:02 ` [PATCH v2 4/6] s390/block/dasd_genhd: add error handling support for add_disk() Luis Chamberlain
2021-09-27 22:02 ` [PATCH v2 5/6] s390/block/dcssblk: " Luis Chamberlain
2021-09-27 22:02 ` [PATCH v2 6/6] s390/block/scm_blk: " Luis Chamberlain
2021-09-27 22:32 ` [PATCH v2 0/6] block: 5th batch of add_disk() error handling conversions Jens Axboe
2021-09-28 8:44 ` Heiko Carstens
2021-09-28 12:28 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).