mbox series

[v3,0/7] Enhance libsas hotplug feature

Message ID 1499670369-44143-1-git-send-email-wangyijing@huawei.com
Headers show
Series Enhance libsas hotplug feature | expand

Message

wangyijing July 10, 2017, 7:06 a.m. UTC
This patchset is based Johannes's patch
"scsi: sas: scsi_queue_work can fail, so make callers aware"

Now the libsas hotplug has some issues, Dan Williams report
a similar bug here before
https://www.mail-archive.com/linux-scsi@vger.kernel.org/msg39187.html

The issues we have found
1. if LLDD burst reports lots of phy-up/phy-down sas events, some events
   may lost because a same sas events is pending now, finally libsas topo
   may different the hardware.
2. receive a phy down sas event, libsas call sas_deform_port to remove
   devices, it would first delete the sas port, then put a destruction
   discovery event in a new work, and queue it at the tail of workqueue,
   once the sas port be deleted, its children device will be deleted too,
   when the destruction work start, it will found the target device has
   been removed, and report a sysfs warnning.
3. since a hotplug process will be devided into several works, if a phy up
   sas event insert into phydown works, like
   destruction work  ---> PORTE_BYTES_DMAED (sas_form_port) ---->PHYE_LOSS_OF_SIGNAL
   the hot remove flow would broken by PORTE_BYTES_DMAED event, it's not
   we expected, and issues would occur.

The first patch fix the sas events lost, and the second one introudce wait-complete
to fix the hotplug order issues.

v2->v3: some code improvements suggested by Johannes and John,
	    split v2 patch 2 into several small pathes.
v1->v2: some code improvements suggested by John Garry

Yijing Wang (7):
  libsas: Use static sas event pool to appease sas event lost
  libsas: remove unused port_gone_completion
  libsas: Use new workqueue to run sas event
  libsas: add sas event wait-complete support
  libsas: add a new workqueue to run probe/destruct discovery event
  libsas: add wait-complete support to sync discovery event
  libsas: release disco mutex during waiting in sas_ex_discover_end_dev

 drivers/scsi/libsas/sas_discover.c |  58 +++++++---
 drivers/scsi/libsas/sas_event.c    | 212 ++++++++++++++++++++++++++++++++-----
 drivers/scsi/libsas/sas_expander.c |  22 +++-
 drivers/scsi/libsas/sas_init.c     |  21 ++--
 drivers/scsi/libsas/sas_internal.h |  64 +++++++++++
 drivers/scsi/libsas/sas_phy.c      |  48 +++------
 drivers/scsi/libsas/sas_port.c     |  22 ++--
 include/scsi/libsas.h              |  27 +++--
 8 files changed, 373 insertions(+), 101 deletions(-)

-- 
2.5.0

Comments

John Garry July 13, 2017, 8:08 a.m. UTC | #1
On 13/07/2017 02:37, wangyijing wrote:
>> > So much nicer. BTW, /dev/sdb is a SATA disk, the rest are SAS.

> Oh, I take a mistake ? The result you tested the hotplug which applied this patchset is fine ?

>

> Thanks!

> Yijing.


Well basic hotplug is fine, as below. I did not do any robust testing.

root@(none)$ echo 0 > ./phy-0:7/sas_phy/phy-0:7/enable
root@(none)$ [  180.147676] hisi_sas_v2_hw HISI0162:01: found dev[8:1] 
is gone
[  180.216558] hisi_sas_v2_hw HISI0162:01: found dev[7:1] is gone
[  180.280548] hisi_sas_v2_hw HISI0162:01: found dev[6:1] is gone
[  180.352556] hisi_sas_v2_hw HISI0162:01: found dev[5:1] is gone
[  180.432495] hisi_sas_v2_hw HISI0162:01: found dev[4:1] is gone
[  180.508492] hisi_sas_v2_hw HISI0162:01: found dev[3:1] is gone
[  180.527577] sd 0:0:1:0: [sdb] Synchronizing SCSI cache
[  180.532728] sd 0:0:1:0: [sdb] Synchronize Cache(10) failed: Result: 
hostbyte=0x04 driverbyte=0x00
[  180.541591] sd 0:0:1:0: [sdb] Stopping disk
[  180.545767] sd 0:0:1:0: [sdb] Start/Stop Unit failed: Result: 
hostbyte=0x04 driverbyte=0x00
[  180.612491] hisi_sas_v2_hw HISI0162:01: found dev[2:5] is gone
[  180.696452] hisi_sas_v2_hw HISI0162:01: found dev[1:1] is gone
[  180.703221] hisi_sas_v2_hw HISI0162:01: found dev[0:2] is gone

root@(none)$ echo 1 > ./phy-0:7/sas_phy/phy-0:7/enable
root@(none)$ [  185.937831] hisi_sas_v2_hw HISI0162:01: phyup: phy7 
link_rate=11
[  185.996575] scsi 0:0:8:0: Direct-Access     SanDisk  LT0200MO 
P404 PQ: 0 ANSI: 6
[  187.059642] ata2.00: ATA-8: HGST HUS724040ALA640, MFAOA8B0, max UDMA/133
[  187.066341] ata2.00: 7814037168 sectors, multi 0: LBA48 NCQ (depth 31/32)
[  187.073278] ata2.00: ATA Identify Device Log not supported
[  187.078755] ata2.00: Security Log not supported
[  187.085239] ata2.00: ATA Identify Device Log not supported
[  187.090715] ata2.00: Security Log not supported
[  187.095236] ata2.00: configured for UDMA/133
[  187.136917] scsi 0:0:9:0: Direct-Access     ATA      HGST HUS724040AL 
A8B0 PQ: 0 ANSI: 5
[  187.187612] sd 0:0:9:0: [sdb] 7814037168 512-byte logical blocks: 
(4.00 TB/3.64 TiB)
[  187.195365] sd 0:0:9:0: [sdb] Write Protect is off
[  187.200161] sd 0:0:9:0: [sdb] Write cache: enabled, read cache: 
enabled, doesn't support DPO or FUA
[  187.223844] sd 0:0:9:0: [sdb] Attached SCSI disk
[  187.225498] scsi 0:0:10:0: Direct-Access     SanDisk  LT0200MO 
  P404 PQ: 0 ANSI: 6
[  187.243864] sd 0:0:8:0: [sda] 390721968 512-byte logical blocks: (200 
GB/186 GiB)
[  187.285879] sd 0:0:8:0: [sda] Write Protect is off
[  187.367898] sd 0:0:8:0: [sda] Write cache: disabled, read cache: 
disabled, supports DPO and FUA
[  187.524043] scsi 0:0:11:0: Direct-Access     SanDisk  LT0200MO 
  P404 PQ: 0 ANSI: 6
[  187.701505] sd 0:0:10:0: [sdc] 390721968 512-byte logical blocks: 
(200 GB/186 GiB)
[  187.743547] sd 0:0:10:0: [sdc] Write Protect is off
[  187.822546] scsi 0:0:12:0: Direct-Access     SanDisk  LT0200MO 
  P404 PQ: 0 ANSI: 6
[  187.825531] sd 0:0:10:0: [sdc] Write cache: disabled, read cache: 
disabled, supports DPO and FUA
[  188.000167] sd 0:0:11:0: [sdd] 390721968 512-byte logical blocks: 
(200 GB/186 GiB)
[  188.042205] sd 0:0:11:0: [sdd] Write Protect is off
[  188.121527] scsi 0:0:13:0: Direct-Access     SanDisk  LT0200MO 
  P404 PQ: 0 ANSI: 6
[  188.124274] sd 0:0:11:0: [sdd] Write cache: disabled, read cache: 
disabled, supports DPO and FUA
[  188.298942] sd 0:0:12:0: [sde] 390721968 512-byte logical blocks: 
(200 GB/186 GiB)
[  188.340960] sd 0:0:12:0: [sde] Write Protect is off
[  188.420023] scsi 0:0:14:0: Direct-Access     SanDisk  LT0200MO 
  P404 PQ: 0 ANSI: 6
[  188.422969] sd 0:0:12:0: [sde] Write cache: disabled, read cache: 
disabled, supports DPO and FUA
[  188.597501] sd 0:0:13:0: [sdf] 390721968 512-byte logical blocks: 
(200 GB/186 GiB)
[  188.605069] sd 0:0:8:0: [sda] Attached SCSI disk
[  188.639520] sd 0:0:13:0: [sdf] Write Protect is off
[  188.682445] scsi 0:0:15:0: Enclosure         12G SAS  Expander 
  RevB PQ: 0 ANSI: 6
[  188.721540] sd 0:0:13:0: [sdf] Write cache: disabled, read cache: 
disabled, supports DPO and FUA
[  188.896399] sd 0:0:14:0: [sdg] 390721968 512-byte logical blocks: 
(200 GB/186 GiB)
[  188.938445] sd 0:0:14:0: [sdg] Write Protect is off
[  189.020444] sd 0:0:14:0: [sdg] Write cache: disabled, read cache: 
disabled, supports DPO and FUA
[  189.060608] sd 0:0:10:0: [sdc] Attached SCSI disk
[  189.359073] sd 0:0:11:0: [sdd] Attached SCSI disk
[  189.657643] sd 0:0:12:0: [sde] Attached SCSI disk
[  189.956585] sd 0:0:13:0: [sdf] Attached SCSI disk
[  190.255148] sd 0:0:14:0: [sdg] Attached SCSI disk

root@(none)$ echo 0 > ./phy-0:7/sas_phy/phy-0:7/enable
root@(none)$ [  192.895718] hisi_sas_v2_hw HISI0162:01: found dev[8:1] 
is gone
[  192.964671] hisi_sas_v2_hw HISI0162:01: found dev[7:1] is gone
[  193.032744] hisi_sas_v2_hw HISI0162:01: found dev[6:1] is gone
[  193.096755] hisi_sas_v2_hw HISI0162:01: found dev[5:1] is gone
[  193.157072] hisi_sas_v2_hw HISI0162:01: found dev[4:1] is gone
[  193.221062] hisi_sas_v2_hw HISI0162:01: found dev[3:1] is gone
[  193.247684] sd 0:0:9:0: [sdb] Synchronizing SCSI cache
[  193.252834] sd 0:0:9:0: [sdb] Synchronize Cache(10) failed: Result: 
hostbyte=0x04 driverbyte=0x00
[  193.261701] sd 0:0:9:0: [sdb] Stopping disk
[  193.265879] sd 0:0:9:0: [sdb] Start/Stop Unit failed: Result: 
hostbyte=0x04 driverbyte=0x00
[  193.325165] hisi_sas_v2_hw HISI0162:01: found dev[2:5] is gone
[  193.381094] hisi_sas_v2_hw HISI0162:01: found dev[1:1] is gone
[  193.388719] hisi_sas_v2_hw HISI0162:01: found dev[0:2] is gone

root@(none)$ echo 1 > ./phy-0:7/sas_phy/phy-0:7/enable
root@(none)$ [  196.221879] hisi_sas_v2_hw HISI0162:01: phyup: phy7 
link_rate=11
[  196.281178] scsi 0:0:16:0: Direct-Access     SanDisk  LT0200MO 
  P404 PQ: 0 ANSI: 6
[  196.973390] ata3.00: ATA-8: HGST HUS724040ALA640, MFAOA8B0, max UDMA/133
[  196.980088] ata3.00: 7814037168 sectors, multi 0: LBA48 NCQ (depth 31/32)
[  196.987022] ata3.00: ATA Identify Device Log not supported
[  196.992499] ata3.00: Security Log not supported
[  196.998953] ata3.00: ATA Identify Device Log not supported
[  197.004434] ata3.00: Security Log not supported
[  197.008954] ata3.00: configured for UDMA/133
[  197.050428] scsi 0:0:17:0: Direct-Access     ATA      HGST 
HUS724040AL A8B0 PQ: 0 ANSI: 5
[  197.091593] sd 0:0:17:0: [sdb] 7814037168 512-byte logical blocks: 
(4.00 TB/3.64 TiB)
[  197.099441] sd 0:0:17:0: [sdb] Write Protect is off
[  197.104326] sd 0:0:17:0: [sdb] Write cache: enabled, read cache: 
enabled, doesn't support DPO or FUA
[  197.122982] sd 0:0:17:0: [sdb] Attached SCSI disk
[  197.129367] scsi 0:0:18:0: Direct-Access     SanDisk  LT0200MO 
  P404 PQ: 0 ANSI: 6
[  197.157605] sd 0:0:16:0: [sda] 390721968 512-byte logical blocks: 
(200 GB/186 GiB)
[  197.199622] sd 0:0:16:0: [sda] Write Protect is off
[  197.281604] sd 0:0:16:0: [sda] Write cache: disabled, read cache: 
disabled, supports DPO and FUA
[  197.427727] scsi 0:0:19:0: Direct-Access     SanDisk  LT0200MO 
  P404 PQ: 0 ANSI: 6
[  197.605362] sd 0:0:18:0: [sdc] 390721968 512-byte logical blocks: 
(200 GB/186 GiB)
[  197.647409] sd 0:0:18:0: [sdc] Write Protect is off
[  197.726403] scsi 0:0:20:0: Direct-Access     SanDisk  LT0200MO 
  P404 PQ: 0 ANSI: 6
[  197.729389] sd 0:0:18:0: [sdc] Write cache: disabled, read cache: 
disabled, supports DPO and FUA
[  197.903664] sd 0:0:19:0: [sdd] 390721968 512-byte logical blocks: 
(200 GB/186 GiB)
[  197.945699] sd 0:0:19:0: [sdd] Write Protect is off
[  198.024789] scsi 0:0:21:0: Direct-Access     SanDisk  LT0200MO 
  P404 PQ: 0 ANSI: 6
[  198.027685] sd 0:0:19:0: [sdd] Write cache: disabled, read cache: 
disabled, supports DPO and FUA
[  198.202410] sd 0:0:20:0: [sde] 390721968 512-byte logical blocks: 
(200 GB/186 GiB)
[  198.244458] sd 0:0:20:0: [sde] Write Protect is off
[  198.323137] scsi 0:0:22:0: Direct-Access     SanDisk  LT0200MO 
  P404 PQ: 0 ANSI: 6
[  198.326491] sd 0:0:20:0: [sde] Write cache: disabled, read cache: 
disabled, supports DPO and FUA
[  198.500754] sd 0:0:21:0: [sdf] 390721968 512-byte logical blocks: 
(200 GB/186 GiB)
[  198.516373] sd 0:0:16:0: [sda] Attached SCSI disk
[  198.542773] sd 0:0:21:0: [sdf] Write Protect is off
[  198.585184] scsi 0:0:23:0: Enclosure         12G SAS  Expander 
  RevB PQ: 0 ANSI: 6
[  198.624911] sd 0:0:21:0: [sdf] Write cache: disabled, read cache: 
disabled, supports DPO and FUA
[  198.799446] sd 0:0:22:0: [sdg] 390721968 512-byte logical blocks: 
(200 GB/186 GiB)
[  198.841484] sd 0:0:22:0: [sdg] Write Protect is off
[  198.923508] sd 0:0:22:0: [sdg] Write cache: disabled, read cache: 
disabled, supports DPO and FUA
[  198.964420] sd 0:0:18:0: [sdc] Attached SCSI disk
[  199.262903] sd 0:0:19:0: [sdd] Attached SCSI disk
[  199.561175] sd 0:0:20:0: [sde] Attached SCSI disk
[  199.859533] sd 0:0:21:0: [sdf] Attached SCSI disk

root@(none)$ [  200.158121] sd 0:0:22:0: [sdg] Attached SCSI disk

root@(none)$


>

>

>> >

>> > John
John Garry July 13, 2017, 4:10 p.m. UTC | #2
On 10/07/2017 08:06, Yijing Wang wrote:
> Disco mutex was introudced to prevent domain rediscovery competing

> with ata error handling(87c8331). If we have already hold the lock

> in sas_revalidate_domain and sync executing probe, deadlock caused,

> because, sas_probe_sata() also need hold disco_mutex. Since disco mutex

> use to prevent revalidata domain happen during ata error handler,

> it should be safe to release disco mutex when sync probe, because

> no new revalidate domain event would be process until the sync return,

> and the current sas revalidate domain finish.

>


So with your changes we have a chain of synchronised events, running in 
separate queues. In theory it sounds ok.

Then, as you said in the commit message, sas_revalidate_domain() holds 
the disco mutex while *all* these chained events occur; so we will 
continue to hold the mutex until we have revalidated the domain, meaning 
until we have finished destroying or probing new devices.

But in the domain revalidation when you discover a new ATA device, 
function sas_probe_sata() wants to grab the disco mutex and you just 
temporarily release it, even though adding a new ATA device kicks in EH. 
This defeats the principal of using a mutex at all, which is (according 
to 87c8331 commit message) to mutually exclude the domain re-discovery 
(which has not actually finished) and the ATA EH (and device destruction).

Anyway, since we are synchronising this series of events (broadcast 
event, domain rediscovery, and device destruction), surely it should be 
possible to include the ATA EH as well, so we can actually get rid of 
the disco mutex finally, right?

Note: I think that there is a problem which you have not seen. Consider 
removing a ATA disk with IO active conncted to an expander:
- LLDD sends brodcast event
- sas_revalidate_domain(), which grabs disco mutex
- revalidate finds dev is gone
- destruct device, which calls sas_rphy_delete
	- this waits on command queue to drain
- commands time out and EH thread kicks in
	- sas_ata_strategy_handler() called
	- domain revalidation disable attempted
		- try to grab disco mutex = Deadlock.

Thanks,
John

> Signed-off-by: Yijing Wang <wangyijing@huawei.com>

> CC: John Garry <john.garry@huawei.com>

> CC: Johannes Thumshirn <jthumshirn@suse.de>

> CC: Ewan Milne <emilne@redhat.com>

> CC: Christoph Hellwig <hch@lst.de>

> CC: Tomas Henzl <thenzl@redhat.com>

> CC: Dan Williams <dan.j.williams@intel.com>

> ---

>  drivers/scsi/libsas/sas_expander.c | 10 ++++++++++

>  1 file changed, 10 insertions(+)

>

> diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c

> index 9d26c28..077024e 100644

> --- a/drivers/scsi/libsas/sas_expander.c

> +++ b/drivers/scsi/libsas/sas_expander.c

> @@ -776,6 +776,7 @@ static struct domain_device *sas_ex_discover_end_dev(

>  	struct ex_phy *phy = &parent_ex->ex_phy[phy_id];

>  	struct domain_device *child = NULL;

>  	struct sas_rphy *rphy;

> +	bool prev_lock;

>  	int res;

>

>  	if (phy->attached_sata_host || phy->attached_sata_ps)

> @@ -803,6 +804,7 @@ static struct domain_device *sas_ex_discover_end_dev(

>  	sas_ex_get_linkrate(parent, child, phy);

>  	sas_device_set_phy(child, phy->port);

>

> +	prev_lock = mutex_is_locked(&child->port->ha->disco_mutex);

>  #ifdef CONFIG_SCSI_SAS_ATA

>  	if ((phy->attached_tproto & SAS_PROTOCOL_STP) || phy->attached_sata_dev) {

>  		res = sas_get_ata_info(child, phy);

> @@ -832,7 +834,11 @@ static struct domain_device *sas_ex_discover_end_dev(

>  				    SAS_ADDR(parent->sas_addr), phy_id, res);

>  			goto out_list_del;

>  		}

> +		if (prev_lock)

> +			mutex_unlock(&child->port->ha->disco_mutex);

>  		sas_disc_wait_completion(child->port, DISCE_PROBE);

> +		if (prev_lock)

> +			mutex_lock(&child->port->ha->disco_mutex);

>

>  	} else

>  #endif

> @@ -861,7 +867,11 @@ static struct domain_device *sas_ex_discover_end_dev(

>  				    SAS_ADDR(parent->sas_addr), phy_id, res);

>  			goto out_list_del;

>  		}

> +		if (prev_lock)

> +			mutex_unlock(&child->port->ha->disco_mutex);

>  		sas_disc_wait_completion(child->port, DISCE_PROBE);

> +		if (prev_lock)

> +			mutex_lock(&child->port->ha->disco_mutex);

>  	} else {

>  		SAS_DPRINTK("target proto 0x%x at %016llx:0x%x not handled\n",

>  			    phy->attached_tproto, SAS_ADDR(parent->sas_addr),

>
John Garry July 14, 2017, 8:26 a.m. UTC | #3
On 14/07/2017 02:44, wangyijing wrote:
>

>

> 在 2017/7/14 0:10, John Garry 写道:

>> On 10/07/2017 08:06, Yijing Wang wrote:

>>> Disco mutex was introudced to prevent domain rediscovery competing

>>> with ata error handling(87c8331). If we have already hold the lock

>>> in sas_revalidate_domain and sync executing probe, deadlock caused,

>>> because, sas_probe_sata() also need hold disco_mutex. Since disco mutex

>>> use to prevent revalidata domain happen during ata error handler,

>>> it should be safe to release disco mutex when sync probe, because

>>> no new revalidate domain event would be process until the sync return,

>>> and the current sas revalidate domain finish.

>>>

>>

>> So with your changes we have a chain of synchronised events, running in separate queues. In theory it sounds ok.

>>

>> Then, as you said in the commit message, sas_revalidate_domain() holds the disco mutex while *all* these chained events occur; so we will continue to hold the mutex until we have revalidated the domain, meaning until we have finished destroying or probing new devices.

>>

>> But in the domain revalidation when you discover a new ATA device, function sas_probe_sata() wants to grab the disco mutex and you just temporarily release it, even though adding a new ATA device kicks in EH. This defeats the principal of using a mutex at all, which is (according to 87c8331 commit message) to mutually exclude the domain re-discovery (which has not actually finished) and the ATA EH (and device destruction).

>>

>> Anyway, since we are synchronising this series of events (broadcast event, domain rediscovery, and device destruction), surely it should be possible to include the ATA EH as well, so we can actually get rid of the disco mutex finally, right?

>

> Yes, disco mutex make this issue complex, I checked the commit history, Dan introudce disco mutex and probe/destruct discovery event, so it seems to

> need a big rework to the libsas process logic, I am so sorry that I have no more time to deal with it, I will leave today, if you like, you could

> rework my patchset or add additional changes based this patchset.

>

>


Since we are now synchronising everything, we should work on removing 
the disco mutex. After all, that is what a mutex is for - synchronising.

But the devil is in the detail...

>

>>

>> Note: I think that there is a problem which you have not seen. Consider removing a ATA disk with IO active conncted to an expander:

>> - LLDD sends brodcast event

>> - sas_revalidate_domain(), which grabs disco mutex

>> - revalidate finds dev is gone

>> - destruct device, which calls sas_rphy_delete

>>     - this waits on command queue to drain

>> - commands time out and EH thread kicks in

>>     - sas_ata_strategy_handler() called

>>     - domain revalidation disable attempted

>>         - try to grab disco mutex = Deadlock.

>

> Yes, it's a issue I haven't found.

>

>

> Thanks!

> Yijing.

>

>

>

>

> Hi John, I also agree to rework disco mutex

>

>

>>

>> Thanks,

>> John

>>

>>> Signed-off-by: Yijing Wang <wangyijing@huawei.com>

>>> CC: John Garry <john.garry@huawei.com>

>>> CC: Johannes Thumshirn <jthumshirn@suse.de>

>>> CC: Ewan Milne <emilne@redhat.com>

>>> CC: Christoph Hellwig <hch@lst.de>

>>> CC: Tomas Henzl <thenzl@redhat.com>

>>> CC: Dan Williams <dan.j.williams@intel.com>

>>> ---

>>>  drivers/scsi/libsas/sas_expander.c | 10 ++++++++++

>>>  1 file changed, 10 insertions(+)

>>>

>>> diff --git a/drivers/scsi/libsas/sas_expander.c b/drivers/scsi/libsas/sas_expander.c

>>> index 9d26c28..077024e 100644

>>> --- a/drivers/scsi/libsas/sas_expander.c

>>> +++ b/drivers/scsi/libsas/sas_expander.c

>>> @@ -776,6 +776,7 @@ static struct domain_device *sas_ex_discover_end_dev(

>>>      struct ex_phy *phy = &parent_ex->ex_phy[phy_id];

>>>      struct domain_device *child = NULL;

>>>      struct sas_rphy *rphy;

>>> +    bool prev_lock;

>>>      int res;

>>>

>>>      if (phy->attached_sata_host || phy->attached_sata_ps)

>>> @@ -803,6 +804,7 @@ static struct domain_device *sas_ex_discover_end_dev(

>>>      sas_ex_get_linkrate(parent, child, phy);

>>>      sas_device_set_phy(child, phy->port);

>>>

>>> +    prev_lock = mutex_is_locked(&child->port->ha->disco_mutex);

>>>  #ifdef CONFIG_SCSI_SAS_ATA

>>>      if ((phy->attached_tproto & SAS_PROTOCOL_STP) || phy->attached_sata_dev) {

>>>          res = sas_get_ata_info(child, phy);

>>> @@ -832,7 +834,11 @@ static struct domain_device *sas_ex_discover_end_dev(

>>>                      SAS_ADDR(parent->sas_addr), phy_id, res);

>>>              goto out_list_del;

>>>          }

>>> +        if (prev_lock)

>>> +            mutex_unlock(&child->port->ha->disco_mutex);

>>>          sas_disc_wait_completion(child->port, DISCE_PROBE);

>>> +        if (prev_lock)

>>> +            mutex_lock(&child->port->ha->disco_mutex);

>>>

>>>      } else

>>>  #endif

>>> @@ -861,7 +867,11 @@ static struct domain_device *sas_ex_discover_end_dev(

>>>                      SAS_ADDR(parent->sas_addr), phy_id, res);

>>>              goto out_list_del;

>>>          }

>>> +        if (prev_lock)

>>> +            mutex_unlock(&child->port->ha->disco_mutex);

>>>          sas_disc_wait_completion(child->port, DISCE_PROBE);

>>> +        if (prev_lock)

>>> +            mutex_lock(&child->port->ha->disco_mutex);

>>>      } else {

>>>          SAS_DPRINTK("target proto 0x%x at %016llx:0x%x not handled\n",

>>>                  phy->attached_tproto, SAS_ADDR(parent->sas_addr),

>>>

>>

>>

>>

>> .

>>

>

>

> .

>