Skip to contentSkip to conversation

s390/dasd: driver unbind fixes

PATCH Applied Stefan Haberland 2 participants 4 messages Mar 5, 2021

Subsystems (3)
lore
Share & tools
lore

Stefan Haberland

author maintainer
#0 lore raw

cover s390/dasd: driver unbind fixes

Hi Jens,

please apply the following patches that fix two issues that may happen during driver unbind.

Stefan Haberland (2):
s390/dasd: fix hanging DASD driver unbind s390/dasd: fix hanging IO request during DASD driver unbind

 drivers/s390/block/dasd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.25.1
author maintainer
#1 lore raw

PATCH 1/2 s390/dasd: fix hanging DASD driver unbind

In case of an unbind of the DASD device driver the function dasd_generic_remove() is called which shuts down the device. Among others this functions removes the int_handler from the cdev. During shutdown the device cancels all outstanding IO requests and waits for completion of the clear request.
Unfortunately the clear interrupt will never be received when there is no interrupt handler connected.

Fix by moving the int_handler removal after the call to the state machine where no request or interrupt is outstanding.

---
 drivers/s390/block/dasd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/s390/block/dasd.c +1 -2
index 28c04a4efa66..22805115ebc2 100644
@@ -3487,8 +3487,6 @@ void dasd_generic_remove(struct ccw_device *cdev)
 	struct dasd_device *device;
 	struct dasd_block *block;
 
-	cdev->handler = NULL;
-
 	device = dasd_device_from_cdev(cdev);
 	if (IS_ERR(device)) {
 		dasd_remove_sysfs_files(cdev);
@@ -3507,6 +3505,7 @@ void dasd_generic_remove(struct ccw_device *cdev)
 	 * no quite down yet.
 	 */
 	dasd_set_target_state(device, DASD_STATE_NEW);
+	cdev->handler = NULL;
 	/* dasd_delete_device destroys the device reference. */
 	block = device->block;
 	dasd_delete_device(device);
Signature · 1 line
2.25.1
author maintainer
#2 lore raw

PATCH 2/2 s390/dasd: fix hanging IO request during DASD driver unbind

In reply to Stefan Haberland

Prevent that an IO request is build during device shutdown initiated by a driver unbind. This request will never be able to be processed or canceled and will hang forever. This will lead also to a hanging unbind.

Fix by checking not only if the device is in READY state but also check that there is no device offline initiated before building a new IO request.

Fixes e443343e509a ("s390/dasd: blk-mq conversion")
---
 drivers/s390/block/dasd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/s390/block/dasd.c +2 -1
index 22805115ebc2..ba9ce4e0d30a 100644
@@ -3052,7 +3052,8 @@ static blk_status_t do_dasd_request(struct blk_mq_hw_ctx *hctx,
 
 	basedev = block->base;
 	spin_lock_irq(&dq->lock);
-	if (basedev->state < DASD_STATE_READY) {
+	if (basedev->state < DASD_STATE_READY ||
+	    test_bit(DASD_FLAG_OFFLINE, &basedev->flags)) {
 		DBF_DEV_EVENT(DBF_ERR, basedev,
 			      "device not ready for request %p", req);
 		rc = BLK_STS_IOERR;
Signature · 1 line
2.25.1
maintainer Applied
#3 lore raw
In reply to Stefan Haberland
Quoted 11 lines · Stefan Haberland

Hi Jens,

please apply the following patches that fix two issues that may happen during driver unbind.

Stefan Haberland (2):
s390/dasd: fix hanging DASD driver unbind s390/dasd: fix hanging IO request during DASD driver unbind

 drivers/s390/block/dasd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.

Signature · 1 line
Jens Axboe