linux-scsi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Mike Christie <michaelc@cs.wisc.edu>
To: Dan Williams <dan.j.williams@intel.com>
Cc: linux-scsi@vger.kernel.org, JBottomley@parallels.com,
	Robert Love <robert.w.love@intel.com>,
	Nagalakshmi Nandigama <Nagalakshmi.Nandigama@lsi.com>,
	Kashyap Desai <kashyap.desai@lsi.com>,
	Matthew Wilcox <matthew@wil.cx>,
	Dariusz Majchrzak <dariusz.majchrzak@intel.com>
Subject: Re: [RFC PATCH] scsi: fix hot unplug vs async scan race
Date: Fri, 25 May 2012 23:52:21 -0500	[thread overview]
Message-ID: <4FC06185.10003@cs.wisc.edu> (raw)
In-Reply-To: <CAA9_cme9j7n726kOxOupJLd4Tajjic8QwLA_LXk21B7YEH15BA@mail.gmail.com>

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.

  reply	other threads:[~2012-05-26  4:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-05-25  7:55 [RFC PATCH] scsi: fix hot unplug vs async scan race Dan Williams
2012-05-25 15:34 ` Dan Williams
2012-05-26  4:52   ` Mike Christie [this message]
2012-05-30  0:48     ` Dan Williams
2012-05-30 18:20       ` Mike Christie

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=4FC06185.10003@cs.wisc.edu \
    --to=michaelc@cs.wisc.edu \
    --cc=JBottomley@parallels.com \
    --cc=Nagalakshmi.Nandigama@lsi.com \
    --cc=dan.j.williams@intel.com \
    --cc=dariusz.majchrzak@intel.com \
    --cc=kashyap.desai@lsi.com \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew@wil.cx \
    --cc=robert.w.love@intel.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;
as well as URLs for NNTP newsgroup(s).