]> git.ipfire.org Git - thirdparty/linux.git/commitdiff
s390/dasd: Fix path verification interrupted by concurrent dasd_sleep_on_immediatly
authorStefan Haberland <sth@linux.ibm.com>
Mon, 27 Jul 2026 14:28:38 +0000 (16:28 +0200)
committerJens Axboe <axboe@kernel.dk>
Fri, 31 Jul 2026 14:28:05 +0000 (08:28 -0600)
When all channel paths to a DASD device are lost and subsequently
recovered, the path event handler starts one IO per path via
dasd_sleep_on_immediatly() to execute read configuration data (RCD) with
high priority.

dasd_sleep_on_immediatly() works by terminating the currently running
request before inserting the new request.
If a concurrent caller, such as the attention handler
dasd_eckd_check_attention_work() or the summary unit
check handler summary_unit_check_handling_work(), also calls
dasd_sleep_on_immediatly() while a path verification RCD is in progress,
the RCD gets terminated.

The problem is that a terminated request transitions from CLEARED to
TERMINATED without going through the normal retry path in
__dasd_device_process_ccw_queue.

The RCD therefore returns -EIO, and the affected paths remain
non-operational after recovery. RCD CQRs used for path verification
already carry the DASD_CQR_VERIFY_PATH flag.

Extend _dasd_term_running_cqr() to check this flag: instead of terminating
such a request, return -EAGAIN. In dasd_sleep_on_immediatly(), loop on
-EAGAIN with a short sleep, waiting for the path verification request to
complete before inserting the new request.

This is consistent with the already indefinite wait_event() that
dasd_sleep_on_immediatly() uses for its own request, and all other callers
(attention handler, summary unit check handler, reserve/release/steal-lock)
benefit automatically without requiring changes.

Reviewed-by: Jan Höppner <hoeppner@linux.ibm.com>
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Link: https://patch.msgid.link/20260727142840.567286-2-sth@linux.ibm.com
Signed-off-by: Jens Axboe <axboe@kernel.dk>
drivers/s390/block/dasd.c

index 3181c06d91ce3736ce6f0af39cf6c10a1cc22041..d8d912a3b3feccbc815f92ae85503f2c7a3632cf 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/debugfs.h>
 #include <linux/seq_file.h>
 #include <linux/vmalloc.h>
+#include <linux/delay.h>
 
 #include <asm/machine.h>
 #include <asm/ccwdev.h>
@@ -2511,6 +2512,13 @@ static inline int _dasd_term_running_cqr(struct dasd_device *device)
        if (list_empty(&device->ccw_queue))
                return 0;
        cqr = list_entry(device->ccw_queue.next, struct dasd_ccw_req, devlist);
+       /*
+        * Path verification requests must not be terminated. They are critical
+        * for bringing paths back online. Terminating them would cause rc=-EIO
+        * because CLEARED requests skip the retry path.
+        */
+       if (test_bit(DASD_CQR_VERIFY_PATH, &cqr->flags))
+               return -EAGAIN;
        rc = device->discipline->term_IO(cqr);
        if (!rc)
                /*
@@ -2535,7 +2543,11 @@ int dasd_sleep_on_immediatly(struct dasd_ccw_req *cqr)
                return -EIO;
        }
        spin_lock_irq(get_ccwdev_lock(device->cdev));
-       rc = _dasd_term_running_cqr(device);
+       while ((rc = _dasd_term_running_cqr(device)) == -EAGAIN) {
+               spin_unlock_irq(get_ccwdev_lock(device->cdev));
+               msleep(1);
+               spin_lock_irq(get_ccwdev_lock(device->cdev));
+       }
        if (rc) {
                spin_unlock_irq(get_ccwdev_lock(device->cdev));
                return rc;