On 3/21/19 7:11 PM, Ming Lei wrote:
On Fri, Mar 22, 2019 at 09:45:54AM +0800, zhengbin wrote:
+ /* If device state changes to SDEV_RUNNING, we need to run hw queue
+ * to avoid io hung.
+ */
+ if (ret == 0 && state == SDEV_RUNNING)
+ blk_mq_run_hw_queues(sdev->request_queue, true);
Thinking of further, this way isn't safe, given the caller should make
sure that the queue is alive before calling blk_mq_run_hw_queues().
Now it is in sysfs write path, and the scsi device can become gone
just before calling blk_mq_run_hw_queues().
Hi Ming,
What makes you think that this approach is unsafe? I think that
__scsi_remove_device() waits until all sysfs callbacks have finished
before it calls blk_cleanup_queue().
Bart.