Hi, Bart,
On 2016/12/7 10:45, Bart Van Assche wrote:
> On 12/06/16 17:21, Wei Fang wrote:
>> The state of the scsi device first is changed to SDEV_BLOCK in
>> scsi_add_lun() as you mentioned, then it will be changed to SDEV_RUNNING
>> in scsi_sysfs_add_sdev().
>
> Hello Wei,
>
> The purpose of the scsi_device_set_state(sdev, SDEV_RUNNING) call in
> scsi_sysfs_add_sdev() is to change the device state from SDEV_CREATED
> into SDEV_RUNNING. Have you tried to modify scsi_sysfs_add_sdev() such
> that it only changes the device state into SDEV_RUNNING if the current
> state is SDEV_CREATED and also such that it changes SDEV_CREATED_BLOCK
> into SDEV_BLOCK?
Does those code in scsi_add_lun() have done this thing?
...
ret = scsi_device_set_state(sdev, SDEV_RUNNING);
if (ret) {
ret = scsi_device_set_state(sdev, SDEV_BLOCK);
...
}
...
You mean we shouldn't change the device state from SDEV_BLOCK
into SDEV_RUNNING in scsi_sysfs_add_sdev()?
I thought it doesn't matter that the state is changed from SDEV_BLOCK
to SDEV_RUNNING in scsi_sysfs_add_sdev(), if the queue can be unblocked
in scsi_internal_device_unblock() in SDEV_RUNNING state. But it
was broken since commit 5c10e63c943b.
Thanks,
Wei
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html