diff options
author | Stefan Weinhuber <wein@de.ibm.com> | 2009-12-07 06:51:48 -0500 |
---|---|---|
committer | Martin Schwidefsky <sky@mschwide.boeblingen.de.ibm.com> | 2009-12-07 06:51:34 -0500 |
commit | 22825ab7693fd29769518a0d25ba43c01a50092a (patch) | |
tree | b4cc2d22baafb8851efac2fed87fda4982dd8209 /drivers/s390/block | |
parent | 6c1e3e79430615d0472dbf9f8fed89c571e66423 (diff) |
[S390] dasd: support DIAG access for read-only devices
When a DASD device is used with the DIAG discipline, the DIAG
initialization will indicate success or error with a respective
return code. So far we have interpreted a return code of 4 as error,
but it actually means that the initialization was successful, but
the device is read-only. To allow read-only devices to be used with
DIAG we need to accept a return code of 4 as success.
Re-initialization of the DIAG access is also part of the DIAG error
recovery. If we find that the access mode of a device has been
changed from writable to read-only while the device was in use,
we print an error message.
Signed-off-by: Stefan Weinhuber <wein@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
Diffstat (limited to 'drivers/s390/block')
-rw-r--r-- | drivers/s390/block/dasd_diag.c | 19 |
1 files changed, 16 insertions, 3 deletions
diff --git a/drivers/s390/block/dasd_diag.c b/drivers/s390/block/dasd_diag.c index 4e49b4a6c880..8174ec921769 100644 --- a/drivers/s390/block/dasd_diag.c +++ b/drivers/s390/block/dasd_diag.c | |||
@@ -145,6 +145,15 @@ dasd_diag_erp(struct dasd_device *device) | |||
145 | 145 | ||
146 | mdsk_term_io(device); | 146 | mdsk_term_io(device); |
147 | rc = mdsk_init_io(device, device->block->bp_block, 0, NULL); | 147 | rc = mdsk_init_io(device, device->block->bp_block, 0, NULL); |
148 | if (rc == 4) { | ||
149 | if (!(device->features & DASD_FEATURE_READONLY)) { | ||
150 | dev_warn(&device->cdev->dev, | ||
151 | "The access mode of a DIAG device changed" | ||
152 | " to read-only"); | ||
153 | device->features |= DASD_FEATURE_READONLY; | ||
154 | } | ||
155 | rc = 0; | ||
156 | } | ||
148 | if (rc) | 157 | if (rc) |
149 | dev_warn(&device->cdev->dev, "DIAG ERP failed with " | 158 | dev_warn(&device->cdev->dev, "DIAG ERP failed with " |
150 | "rc=%d\n", rc); | 159 | "rc=%d\n", rc); |
@@ -433,16 +442,20 @@ dasd_diag_check_device(struct dasd_device *device) | |||
433 | for (sb = 512; sb < bsize; sb = sb << 1) | 442 | for (sb = 512; sb < bsize; sb = sb << 1) |
434 | block->s2b_shift++; | 443 | block->s2b_shift++; |
435 | rc = mdsk_init_io(device, block->bp_block, 0, NULL); | 444 | rc = mdsk_init_io(device, block->bp_block, 0, NULL); |
436 | if (rc) { | 445 | if (rc && (rc != 4)) { |
437 | dev_warn(&device->cdev->dev, "DIAG initialization " | 446 | dev_warn(&device->cdev->dev, "DIAG initialization " |
438 | "failed with rc=%d\n", rc); | 447 | "failed with rc=%d\n", rc); |
439 | rc = -EIO; | 448 | rc = -EIO; |
440 | } else { | 449 | } else { |
450 | if (rc == 4) | ||
451 | device->features |= DASD_FEATURE_READONLY; | ||
441 | dev_info(&device->cdev->dev, | 452 | dev_info(&device->cdev->dev, |
442 | "New DASD with %ld byte/block, total size %ld KB\n", | 453 | "New DASD with %ld byte/block, total size %ld KB%s\n", |
443 | (unsigned long) block->bp_block, | 454 | (unsigned long) block->bp_block, |
444 | (unsigned long) (block->blocks << | 455 | (unsigned long) (block->blocks << |
445 | block->s2b_shift) >> 1); | 456 | block->s2b_shift) >> 1, |
457 | (rc == 4) ? ", read-only device" : ""); | ||
458 | rc = 0; | ||
446 | } | 459 | } |
447 | out_label: | 460 | out_label: |
448 | free_page((long) label); | 461 | free_page((long) label); |