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? Thanks, Bart. -- To unsubscribe from this list: send the line "unsubscribe linux-scsi" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html