[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <407be945-9fd2-8e00-e72b-82e2f311dbeb@huawei.com>
Date: Sun, 24 Sep 2023 14:37:02 +0800
From: Wenchao Hao <haowenchao2@...wei.com>
To: Bart Van Assche <bvanassche@....org>,
"James E . J . Bottomley" <jejb@...ux.ibm.com>,
"Martin K . Petersen" <martin.petersen@...cle.com>
CC: <linux-kernel@...r.kernel.org>, <louhongxiang@...wei.com>,
<linux-scsi@...r.kernel.org>
Subject: Re: [PATCH 1/2] scsi: core: scsi_device_online() return false if
state is SDEV_CANCEL
On 2023/9/22 23:23, Bart Van Assche wrote:
> On 9/22/23 02:36, Wenchao Hao wrote:
>> SDEV_CANCEL is set when removing device and scsi_device_online() should
>> return false if sdev_state is SDEV_CANCEL.
>>
>> IO hang would be caused if return true when state is SDEV_CANCEL with
>> following order:
>>
>> T1: T2:scsi_error_handler
>> __scsi_remove_device()
>> scsi_device_set_state(sdev, SDEV_CANCEL)
>> scsi_eh_flush_done_q()
>> if (scsi_device_online(sdev))
>> scsi_queue_insert(scmd,...)
>>
>> The command added by scsi_queue_insert() would never be handled any
>> more.
>
> Why not? I think the blk_mq_destroy_queue() call in __scsi_remove_device() will cause it to fail.
>
> Thanks,
>
> Bart.
>
Sorry, I did not describe in detail, the __scsi_remove_device() would be blocked
in blk_mq_freeze_queue_wait() to wait all block requests finished, so
blk_mq_destroy_queue() would not be called, and the task which try to remove
scsi_device would be hung.
Powered by blists - more mailing lists