s390/dasd: fix race during dasd initialization
authorStefan Haberland <sth@linux.vnet.ibm.com>
Tue, 12 Sep 2017 15:22:42 +0000 (17:22 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Wed, 13 Sep 2017 14:34:23 +0000 (16:34 +0200)
Fix a panic in blk_mq_hctx_has_pending() that is caused by a racy call to
blk_mq_run_hw_queues in a dasd function that might get called with the
request queue not yet initialized during initialization.

Signed-off-by: Stefan Haberland <sth@linux.vnet.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/block/dasd.c

index ea19b4ff87a2f00837abd83c8e22a9e21016ff21..29f35e29d4801f83aa74b0a590bdb4412a9caa7c 100644 (file)
@@ -1644,7 +1644,9 @@ void dasd_generic_handle_state_change(struct dasd_device *device)
        dasd_schedule_device_bh(device);
        if (device->block) {
                dasd_schedule_block_bh(device->block);
-               blk_mq_run_hw_queues(device->block->request_queue, true);
+               if (device->block->request_queue)
+                       blk_mq_run_hw_queues(device->block->request_queue,
+                                            true);
        }
 }
 EXPORT_SYMBOL_GPL(dasd_generic_handle_state_change);
@@ -3759,7 +3761,9 @@ int dasd_generic_path_operational(struct dasd_device *device)
        dasd_schedule_device_bh(device);
        if (device->block) {
                dasd_schedule_block_bh(device->block);
-               blk_mq_run_hw_queues(device->block->request_queue, true);
+               if (device->block->request_queue)
+                       blk_mq_run_hw_queues(device->block->request_queue,
+                                            true);
                }
 
        if (!device->stopped)
@@ -4025,7 +4029,9 @@ int dasd_generic_restore_device(struct ccw_device *cdev)
 
        if (device->block) {
                dasd_schedule_block_bh(device->block);
-               blk_mq_run_hw_queues(device->block->request_queue, true);
+               if (device->block->request_queue)
+                       blk_mq_run_hw_queues(device->block->request_queue,
+                                            true);
        }
 
        clear_bit(DASD_FLAG_SUSPENDED, &device->flags);