On 07/01/2013 02:05 PM, Bart Van Assche wrote:
> On 07/01/13 10:27, Hannes Reinecke wrote:
>> On 06/27/2013 04:57 PM, Bart Van Assche wrote:
>>> diff --git a/drivers/scsi/scsi_sysfs.c b/drivers/scsi/scsi_sysfs.c
>>> index dfbaa34..666b741 100644
>>> --- a/drivers/scsi/scsi_sysfs.c
>>> +++ b/drivers/scsi/scsi_sysfs.c
>>> @@ -959,14 +959,16 @@ void __scsi_remove_device(struct scsi_device *sdev)
>>>   {
>>>     struct Scsi_Host *shost = sdev->host;
>>>     struct device *dev = &sdev->sdev_gendev;
>>> +   enum scsi_device_state sdev_state;
>>>     int res;
>>>   
>>>     if (sdev->is_visible) {
>>>             spin_lock_irq(shost->host_lock);
>>> +           sdev_state = sdev->sdev_state;
>>>             res = scsi_device_set_state(sdev, SDEV_CANCEL);
>>>             spin_unlock_irq(shost->host_lock);
>>>   
>>> -           if (res != 0)
>>> +           if (res != 0 && sdev_state != SDEV_TRANSPORT_OFFLINE)
>>>                     return;
>>>   
>>>             bsg_unregister_queue(sdev->request_queue);
>>>
>> Hmm. This is really subtle. Do you mind adding inserting a comment
>> here on why this is required?
> 
> How about inserting the following comment just above the last if-statement
> in the code cited above ?
> 
>               /*
>                * The transition from SDEV_TRANSPORT_OFFLINE into SDEV_CANCEL
>                * is not allowed since this transition would re-enable I/O. If
>                * the device state was already SDEV_TRANSPORT_OFFLINE,
>                * proceed with device removal.
>                */
> 
> Bart.
> 
Perfect.

Cheers,

Hannes
-- 
Dr. Hannes Reinecke                   zSeries & Storage
h...@suse.de                          +49 911 74053 688
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: J. Hawn, J. Guild, F. Imendörffer, HRB 16746 (AG Nürnberg)
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to