Skip to content

Commit 362ce84

Browse files
stefan-haberlandMartin Schwidefsky
authored andcommitted
s390/dasd: fix infinite loop during format
Error recovery requests may not be cleaned up correctly so that other needed erp requests can not be build because of insufficient memory. This would lead to an infinite loop trying to build erp requests. Signed-off-by: Stefan Haberland <stefan.haberland@de.ibm.com> Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
1 parent cfb0b24 commit 362ce84

1 file changed

Lines changed: 15 additions & 10 deletions

File tree

‎drivers/s390/block/dasd.c‎

Lines changed: 15 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2261,8 +2261,8 @@ static inline int _wait_for_wakeup_queue(struct list_head *ccw_queue)
22612261
static int _dasd_sleep_on_queue(struct list_head *ccw_queue, int interruptible)
22622262
{
22632263
struct dasd_device *device;
2264-
int rc;
22652264
struct dasd_ccw_req *cqr, *n;
2265+
int rc;
22662266

22672267
retry:
22682268
list_for_each_entry_safe(cqr, n, ccw_queue, blocklist) {
@@ -2310,21 +2310,26 @@ static int _dasd_sleep_on_queue(struct list_head *ccw_queue, int interruptible)
23102310
/*
23112311
* for alias devices simplify error recovery and
23122312
* return to upper layer
2313+
* do not skip ERP requests
23132314
*/
2314-
if (cqr->startdev != cqr->basedev &&
2315+
if (cqr->startdev != cqr->basedev && !cqr->refers &&
23152316
(cqr->status == DASD_CQR_TERMINATED ||
23162317
cqr->status == DASD_CQR_NEED_ERP))
23172318
return -EAGAIN;
2318-
else {
2319-
/* normal recovery for basedev IO */
2320-
if (__dasd_sleep_on_erp(cqr)) {
2321-
if (!cqr->status == DASD_CQR_TERMINATED &&
2322-
!cqr->status == DASD_CQR_NEED_ERP)
2323-
break;
2324-
rc = 1;
2325-
}
2319+
2320+
/* normal recovery for basedev IO */
2321+
if (__dasd_sleep_on_erp(cqr)) {
2322+
goto retry;
2323+
/* remember that ERP was needed */
2324+
rc = 1;
2325+
/* skip processing for active cqr */
2326+
if (cqr->status != DASD_CQR_TERMINATED &&
2327+
cqr->status != DASD_CQR_NEED_ERP)
2328+
break;
23262329
}
23272330
}
2331+
2332+
/* start ERP requests in upper loop */
23282333
if (rc)
23292334
goto retry;
23302335

0 commit comments

Comments
 (0)