diff options
author | Jeff Skirvin <jeffrey.d.skirvin@intel.com> | 2012-03-08 22:42:03 -0800 |
---|---|---|
committer | Dan Williams <dan.j.williams@intel.com> | 2012-05-17 14:33:41 -0700 |
commit | 033d19d298b4245da2d3d6c795ea97e419f9ac61 (patch) | |
tree | 2e66627f294b9e2b52174e719ff987464cedaeec /drivers/scsi/isci/remote_device.c | |
parent | 0c3ce38f1bc8b6a6d8df0959e3c0dece31f9350c (diff) | |
download | linux-033d19d298b4245da2d3d6c795ea97e419f9ac61.tar.gz linux-033d19d298b4245da2d3d6c795ea97e419f9ac61.tar.bz2 linux-033d19d298b4245da2d3d6c795ea97e419f9ac61.zip |
isci: Callbacks to libsas occur under scic_lock and are synchronized.
This patch changes the callback mechanism to libsas to only occur while
the scic_lock is held; the abort path cleanup of I/Os also checks to make
sure IREQ_ABORT_PATH_ACTIVE is clear before proceding.
Signed-off-by: Jeff Skirvin <jeffrey.d.skirvin@intel.com>
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
Diffstat (limited to 'drivers/scsi/isci/remote_device.c')
-rw-r--r-- | drivers/scsi/isci/remote_device.c | 43 |
1 files changed, 37 insertions, 6 deletions
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c index d1c2a2294a32..21a9800a9bec 100644 --- a/drivers/scsi/isci/remote_device.c +++ b/drivers/scsi/isci/remote_device.c @@ -145,6 +145,39 @@ static bool isci_compare_suspendcount( return localcount != idev->rnc.suspend_count; } +static bool isci_check_reqterm( + struct isci_host *ihost, + struct isci_remote_device *idev, + struct isci_request *ireq, + u32 localcount) +{ + unsigned long flags; + bool res; + + spin_lock_irqsave(&ihost->scic_lock, flags); + res = isci_compare_suspendcount(idev, localcount) + && !test_bit(IREQ_ABORT_PATH_ACTIVE, &ireq->flags); + spin_unlock_irqrestore(&ihost->scic_lock, flags); + + return res; +} + +static bool isci_check_devempty( + struct isci_host *ihost, + struct isci_remote_device *idev, + u32 localcount) +{ + unsigned long flags; + bool res; + + spin_lock_irqsave(&ihost->scic_lock, flags); + res = isci_compare_suspendcount(idev, localcount) + && idev->started_request_count == 0; + spin_unlock_irqrestore(&ihost->scic_lock, flags); + + return res; +} + enum sci_status isci_remote_device_terminate_requests( struct isci_host *ihost, struct isci_remote_device *idev, @@ -179,17 +212,15 @@ enum sci_status isci_remote_device_terminate_requests( sci_remote_device_terminate_req(ihost, idev, 0, ireq); spin_unlock_irqrestore(&ihost->scic_lock, flags); wait_event(ihost->eventq, - (isci_compare_suspendcount(idev, - rnc_suspend_count) - && !test_bit(IREQ_ACTIVE, &ireq->flags))); + isci_check_reqterm(ihost, idev, ireq, + rnc_suspend_count)); } else { /* Terminate all TCs. */ sci_remote_device_terminate_requests(idev); spin_unlock_irqrestore(&ihost->scic_lock, flags); wait_event(ihost->eventq, - (isci_compare_suspendcount(idev, - rnc_suspend_count) - && idev->started_request_count == 0)); + isci_check_devempty(ihost, idev, + rnc_suspend_count)); } dev_dbg(&ihost->pdev->dev, "%s: idev=%p, wait done\n", __func__, idev); |