Skip to content

Commit 4199534

Browse files
Stefan Haberlandaxboe
authored andcommitted
s390/dasd: fix endless loop after read unit address configuration
After getting a storage server event that causes the DASD device driver to update its unit address configuration during a device shutdown there is the possibility of an endless loop in the device driver. In the system log there will be ongoing DASD error messages with RC: -19. The reason is that the loop starting the ruac request only terminates when the retry counter is decreased to 0. But in the sleep_on function there are early exit paths that do not decrease the retry counter. Prevent an endless loop by handling those cases separately. Remove the unnecessary do..while loop since the sleep_on function takes care of retries by itself. Fixes: 8e09f21 ("[S390] dasd: add hyper PAV support to DASD device driver, part 1") Cc: stable@vger.kernel.org # 2.6.25+ Signed-off-by: Stefan Haberland <sth@linux.ibm.com> Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com> Signed-off-by: Jens Axboe <axboe@kernel.dk>
1 parent 0eb6ddf commit 4199534

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

drivers/s390/block/dasd_alias.c

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -383,6 +383,20 @@ suborder_not_supported(struct dasd_ccw_req *cqr)
383383
char msg_format;
384384
char msg_no;
385385

386+
/*
387+
* intrc values ENODEV, ENOLINK and EPERM
388+
* will be optained from sleep_on to indicate that no
389+
* IO operation can be started
390+
*/
391+
if (cqr->intrc == -ENODEV)
392+
return 1;
393+
394+
if (cqr->intrc == -ENOLINK)
395+
return 1;
396+
397+
if (cqr->intrc == -EPERM)
398+
return 1;
399+
386400
sense = dasd_get_sense(&cqr->irb);
387401
if (!sense)
388402
return 0;
@@ -447,12 +461,8 @@ static int read_unit_address_configuration(struct dasd_device *device,
447461
lcu->flags &= ~NEED_UAC_UPDATE;
448462
spin_unlock_irqrestore(&lcu->lock, flags);
449463

450-
do {
451-
rc = dasd_sleep_on(cqr);
452-
if (rc && suborder_not_supported(cqr))
453-
return -EOPNOTSUPP;
454-
} while (rc && (cqr->retries > 0));
455-
if (rc) {
464+
rc = dasd_sleep_on(cqr);
465+
if (rc && !suborder_not_supported(cqr)) {
456466
spin_lock_irqsave(&lcu->lock, flags);
457467
lcu->flags |= NEED_UAC_UPDATE;
458468
spin_unlock_irqrestore(&lcu->lock, flags);

0 commit comments

Comments
 (0)