From: Wenchao Hao <haowenchao2@huawei.com>
To: Bart Van Assche <bvanassche@acm.org>,
"James E . J . Bottomley" <jejb@linux.ibm.com>,
"Martin K . Petersen" <martin.petersen@oracle.com>
Cc: <linux-kernel@vger.kernel.org>, <louhongxiang@huawei.com>,
<linux-scsi@vger.kernel.org>
Subject: Re: [PATCH 1/2] scsi: core: scsi_device_online() return false if state is SDEV_CANCEL
Date: Sun, 24 Sep 2023 14:37:02 +0800 [thread overview]
Message-ID: <407be945-9fd2-8e00-e72b-82e2f311dbeb@huawei.com> (raw)
In-Reply-To: <50b20a3e-e264-4788-8e52-f7b57cf944f0@acm.org>
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.
next prev parent reply other threads:[~2023-09-24 6:37 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-22 9:36 [PATCH 0/2] Fix two issue between removing device and error handle Wenchao Hao
2023-09-22 9:36 ` [PATCH 1/2] scsi: core: scsi_device_online() return false if state is SDEV_CANCEL Wenchao Hao
2023-09-22 15:23 ` Bart Van Assche
2023-09-24 6:37 ` Wenchao Hao [this message]
2023-09-25 15:02 ` Wenchao Hao
2023-09-22 9:36 ` [PATCH 2/2] scsi: scsi_error: Fix device reset is not triggered Wenchao Hao
2023-09-22 15:18 ` Bart Van Assche
2023-09-24 6:57 ` Wenchao Hao
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=407be945-9fd2-8e00-e72b-82e2f311dbeb@huawei.com \
--to=haowenchao2@huawei.com \
--cc=bvanassche@acm.org \
--cc=jejb@linux.ibm.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-scsi@vger.kernel.org \
--cc=louhongxiang@huawei.com \
--cc=martin.petersen@oracle.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®