]> git.baikalelectronics.ru Git - kernel.git/commit
[SCSI] libsas: prevent domain rediscovery competing with ata error handling
authorDan Williams <dan.j.williams@intel.com>
Fri, 18 Nov 2011 01:59:51 +0000 (17:59 -0800)
committerJames Bottomley <JBottomley@Parallels.com>
Sun, 19 Feb 2012 19:52:34 +0000 (13:52 -0600)
commit6bc44cf2308f4304e70c04456d035188ea149f1b
tree4ed0e98760c977010fe54778c1a25625840b4583
parenta1b71db9452880cf46ca17bdfe2355ba99217425
[SCSI] libsas: prevent domain rediscovery competing with ata error handling

libata error handling provides for a timeout for link recovery.  libsas
must not rescan for previously known devices in this interval otherwise
it may remove a device that is simply waiting for its link to recover.
Let libata-eh make the determination of when the link is stable and
prevent libsas (host workqueue) from taking action while this
determination is pending.

Using a mutex (ha->disco_mutex) to flush and disable revalidation while
eh is running requires any discovery action that may block on eh be
moved to its own context outside the lock.  Probing ATA devices
explicitly waits on ata-eh and the cache-flush-io issued during device
removal may also pend awaiting eh completion.  Essentially any rphy
add/remove activity needs to run outside the lock.

This adds two new cleanup states for sas_unregister_domain_devices()
'allocated-but-not-probed', and 'flagged-for-destruction'.  In the
'allocated-but-not-probed' state  dev->rphy points to a rphy that is
known to have not been through a sas_rphy_add() event.  At domain
teardown check if this device is still pending probe and cleanup
accordingly.  Similarly if a device has already been queued for removal
then sas_unregister_domain_devices has nothing to do.

Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>
drivers/scsi/libsas/sas_ata.c
drivers/scsi/libsas/sas_discover.c
drivers/scsi/libsas/sas_event.c
drivers/scsi/libsas/sas_expander.c
drivers/scsi/libsas/sas_init.c
drivers/scsi/libsas/sas_internal.h
drivers/scsi/libsas/sas_port.c
drivers/scsi/scsi_transport_sas.c
include/scsi/libsas.h
include/scsi/sas_ata.h
include/scsi/scsi_transport_sas.h