]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
s390/dasd: fix hanging IO request during DASD driver unbind
authorStefan Haberland <sth@linux.ibm.com>
Fri, 5 Mar 2021 12:54:39 +0000 (13:54 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 17 Mar 2021 15:34:31 +0000 (16:34 +0100)
commit 66f669a272898feb1c69b770e1504aa2ec7723d1 upstream.

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>
Signed-off-by: Jens Axboe <axboe@kernel.dk>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/s390/block/dasd.c

index 821a40581a5dbedb5b5e2d97f6e3b1ca164eb789..2dbe9c25ba7442bd485be499f4c3cd395015c3bd 100644 (file)
@@ -2998,7 +2998,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;