summaryrefslogtreecommitdiffstats
path: root/drivers/s390/block/dasd_genhd.c
diff options
context:
space:
mode:
authorStefan Haberland <stefan.haberland@de.ibm.com>2014-11-24 15:04:09 +0100
committerMartin Schwidefsky <schwidefsky@de.ibm.com>2014-11-28 09:47:42 +0100
commit6ebdf1c79d09ad3d65c714a79db0a0c141a013ba (patch)
treefd9d6e09519f82f7035eb636f7fd8bcefc4b6741 /drivers/s390/block/dasd_genhd.c
parents390/dasd: fix list corruption for sleep_on requests (diff)
downloadlinux-6ebdf1c79d09ad3d65c714a79db0a0c141a013ba.tar.xz
linux-6ebdf1c79d09ad3d65c714a79db0a0c141a013ba.zip
s390/dasd: retry partition detection
In case somebody attempted to open the device during online processing the partition detection ioctl may have failed. Added a retry loop to avoid not detected partitions. Signed-off-by: Stefan Haberland <stefan.haberland@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/block/dasd_genhd.c')
-rw-r--r--drivers/s390/block/dasd_genhd.c26
1 files changed, 24 insertions, 2 deletions
diff --git a/drivers/s390/block/dasd_genhd.c b/drivers/s390/block/dasd_genhd.c
index f224d59c4b6b..90f39f79f5d7 100644
--- a/drivers/s390/block/dasd_genhd.c
+++ b/drivers/s390/block/dasd_genhd.c
@@ -99,15 +99,37 @@ void dasd_gendisk_free(struct dasd_block *block)
int dasd_scan_partitions(struct dasd_block *block)
{
struct block_device *bdev;
+ int retry, rc;
+ retry = 5;
bdev = bdget_disk(block->gdp, 0);
- if (!bdev || blkdev_get(bdev, FMODE_READ, NULL) < 0)
+ if (!bdev) {
+ DBF_DEV_EVENT(DBF_ERR, block->base, "%s",
+ "scan partitions error, bdget returned NULL");
return -ENODEV;
+ }
+
+ rc = blkdev_get(bdev, FMODE_READ, NULL);
+ if (rc < 0) {
+ DBF_DEV_EVENT(DBF_ERR, block->base,
+ "scan partitions error, blkdev_get returned %d",
+ rc);
+ return -ENODEV;
+ }
/*
* See fs/partition/check.c:register_disk,rescan_partitions
* Can't call rescan_partitions directly. Use ioctl.
*/
- ioctl_by_bdev(bdev, BLKRRPART, 0);
+ rc = ioctl_by_bdev(bdev, BLKRRPART, 0);
+ while (rc == -EBUSY && retry > 0) {
+ schedule();
+ rc = ioctl_by_bdev(bdev, BLKRRPART, 0);
+ retry--;
+ DBF_DEV_EVENT(DBF_ERR, block->base,
+ "scan partitions error, retry %d rc %d",
+ retry, rc);
+ }
+
/*
* Since the matching blkdev_put call to the blkdev_get in
* this function is not called before dasd_destroy_partitions