linux-block.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] s390/dasd: driver unbind fixes
@ 2021-03-05 12:54 Stefan Haberland
  2021-03-05 12:54 ` [PATCH 1/2] s390/dasd: fix hanging DASD driver unbind Stefan Haberland
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Stefan Haberland @ 2021-03-05 12:54 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Jan Hoeppner, linux-s390, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger

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(-)

-- 
2.25.1


^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] s390/dasd: fix hanging DASD driver unbind
  2021-03-05 12:54 [PATCH 0/2] s390/dasd: driver unbind fixes Stefan Haberland
@ 2021-03-05 12:54 ` Stefan Haberland
  2021-03-05 12:54 ` [PATCH 2/2] s390/dasd: fix hanging IO request during " Stefan Haberland
  2021-03-05 18:30 ` [PATCH 0/2] s390/dasd: driver unbind fixes Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Haberland @ 2021-03-05 12:54 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Jan Hoeppner, linux-s390, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger

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.

Cc: stable@vger.kernel.org
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Tested-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
---
 drivers/s390/block/dasd.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 28c04a4efa66..22805115ebc2 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -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);
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] s390/dasd: fix hanging IO request during DASD driver unbind
  2021-03-05 12:54 [PATCH 0/2] s390/dasd: driver unbind fixes Stefan Haberland
  2021-03-05 12:54 ` [PATCH 1/2] s390/dasd: fix hanging DASD driver unbind Stefan Haberland
@ 2021-03-05 12:54 ` Stefan Haberland
  2021-03-05 18:30 ` [PATCH 0/2] s390/dasd: driver unbind fixes Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Stefan Haberland @ 2021-03-05 12:54 UTC (permalink / raw)
  To: Jens Axboe
  Cc: linux-block, Jan Hoeppner, linux-s390, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger

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")

Cc: <stable@vger.kernel.org> # v4.14+
Signed-off-by: Stefan Haberland <sth@linux.ibm.com>
Tested-by: Bjoern Walk <bwalk@linux.ibm.com>
Reviewed-by: Jan Hoeppner <hoeppner@linux.ibm.com>
---
 drivers/s390/block/dasd.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/s390/block/dasd.c b/drivers/s390/block/dasd.c
index 22805115ebc2..ba9ce4e0d30a 100644
--- a/drivers/s390/block/dasd.c
+++ b/drivers/s390/block/dasd.c
@@ -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;
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] s390/dasd: driver unbind fixes
  2021-03-05 12:54 [PATCH 0/2] s390/dasd: driver unbind fixes Stefan Haberland
  2021-03-05 12:54 ` [PATCH 1/2] s390/dasd: fix hanging DASD driver unbind Stefan Haberland
  2021-03-05 12:54 ` [PATCH 2/2] s390/dasd: fix hanging IO request during " Stefan Haberland
@ 2021-03-05 18:30 ` Jens Axboe
  2 siblings, 0 replies; 4+ messages in thread
From: Jens Axboe @ 2021-03-05 18:30 UTC (permalink / raw)
  To: Stefan Haberland
  Cc: linux-block, Jan Hoeppner, linux-s390, Heiko Carstens,
	Vasily Gorbik, Christian Borntraeger

On 3/5/21 5:54 AM, Stefan Haberland wrote:
> 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.

-- 
Jens Axboe


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2021-03-05 18:31 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-03-05 12:54 [PATCH 0/2] s390/dasd: driver unbind fixes Stefan Haberland
2021-03-05 12:54 ` [PATCH 1/2] s390/dasd: fix hanging DASD driver unbind Stefan Haberland
2021-03-05 12:54 ` [PATCH 2/2] s390/dasd: fix hanging IO request during " Stefan Haberland
2021-03-05 18:30 ` [PATCH 0/2] s390/dasd: driver unbind fixes Jens Axboe

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).