Re: [RFC PATCH] scsi: fix hot unplug vs async scan race

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 05/25/2012 10:34 AM, Dan Williams wrote:
>> diff --git a/drivers/scsi/scsi_transport_sas.c b/drivers/scsi/scsi_transport_sas.c
>> index f7565fc..3afb38d 100644
>> --- a/drivers/scsi/scsi_transport_sas.c
>> +++ b/drivers/scsi/scsi_transport_sas.c
>> @@ -1592,7 +1592,7 @@ int sas_rphy_add(struct sas_rphy *rphy)
>>                else
>>                        lun = 0;
>>
>> -               scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, lun, 0);
>> +               rphy->starget = scsi_scan_target(&rphy->dev, 0, rphy->scsi_target_id, lun, 0);
>>        }
>>
>>        return 0;
>> @@ -1669,7 +1669,8 @@ sas_rphy_remove(struct sas_rphy *rphy)
>>
>>        switch (rphy->identify.device_type) {
>>        case SAS_END_DEVICE:
>> -               scsi_remove_target(dev);
>> +               __scsi_remove_target(rphy->starget);
>> +               rphy->starget = NULL;
>>                break;

I do not think it is safe to have the starget pointer on the phy and
then pass it to scsi_remove_target. If you did

for each device
	echo 1 > /sys/..../remove

then the target would get reaped/freed from under the transport class right?

It looks like the fc class needs a similar fix though too.

iSCSI is ok since no iscsi driver does scsi_scan_host and does async
scanning from userspace.
--
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


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux