aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/isci/remote_device.c
diff options
context:
space:
mode:
authorJeff Skirvin <jeffrey.d.skirvin@intel.com>2012-03-13 17:15:11 -0700
committerDan Williams <dan.j.williams@intel.com>2012-05-17 14:33:44 -0700
commitde2eb4d5c5c25e8fb75d1e19092f24b83cb7d8d5 (patch)
tree537fae73fbf34d34b5e83151a467275986ffb6b5 /drivers/scsi/isci/remote_device.c
parentisci: Fixed RNC bug that lost the suspension or resumption during destroy (diff)
downloadlinux-dev-de2eb4d5c5c25e8fb75d1e19092f24b83cb7d8d5.tar.xz
linux-dev-de2eb4d5c5c25e8fb75d1e19092f24b83cb7d8d5.zip
isci: End the RNC resumption wait when the RNC is destroyed.
While the RNC is suspended for I/O cleanup, the remote device can be stopped and the RNC setup for destruction. These changes accomodate that case in the abort path. 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.c29
1 files changed, 21 insertions, 8 deletions
diff --git a/drivers/scsi/isci/remote_device.c b/drivers/scsi/isci/remote_device.c
index a3a6487264ea..c3aa6c5457b9 100644
--- a/drivers/scsi/isci/remote_device.c
+++ b/drivers/scsi/isci/remote_device.c
@@ -1368,27 +1368,40 @@ static void isci_remote_device_resume_from_abort_complete(void *cbparam)
wake_up(&ihost->eventq);
}
+static bool isci_remote_device_test_resume_done(
+ struct isci_host *ihost,
+ struct isci_remote_device *idev)
+{
+ unsigned long flags;
+ bool done;
+
+ spin_lock_irqsave(&ihost->scic_lock, flags);
+ done = !test_bit(IDEV_ABORT_PATH_RESUME_PENDING, &idev->flags)
+ || test_bit(IDEV_STOP_PENDING, &idev->flags)
+ || sci_remote_node_context_is_being_destroyed(&idev->rnc);
+ spin_unlock_irqrestore(&ihost->scic_lock, flags);
+
+ return done;
+}
void isci_remote_device_wait_for_resume_from_abort(
struct isci_host *ihost,
struct isci_remote_device *idev)
{
- dev_dbg(scirdev_to_dev(idev), "%s: starting resume wait: %p\n",
+ dev_dbg(&ihost->pdev->dev, "%s: starting resume wait: %p\n",
__func__, idev);
#define MAX_RESUME_MSECS 10000
if (!wait_event_timeout(ihost->eventq,
- (!test_bit(IDEV_ABORT_PATH_RESUME_PENDING,
- &idev->flags)
- || test_bit(IDEV_STOP_PENDING, &idev->flags)),
- msecs_to_jiffies(MAX_RESUME_MSECS))) {
+ isci_remote_device_test_resume_done(ihost, idev),
+ msecs_to_jiffies(MAX_RESUME_MSECS))) {
- dev_warn(scirdev_to_dev(idev), "%s: #### Timeout waiting for "
+ dev_warn(&ihost->pdev->dev, "%s: #### Timeout waiting for "
"resume: %p\n", __func__, idev);
}
clear_bit(IDEV_ABORT_PATH_RESUME_PENDING, &idev->flags);
- dev_dbg(scirdev_to_dev(idev), "%s: resume wait done: %p\n",
+ dev_dbg(&ihost->pdev->dev, "%s: resume wait done: %p\n",
__func__, idev);
}
@@ -1414,7 +1427,7 @@ enum sci_status isci_remote_device_resume_from_abort(
idev, isci_remote_device_resume_from_abort_complete,
idev);
spin_unlock_irqrestore(&ihost->scic_lock, flags);
- if (!destroyed)
+ if (!destroyed && (status == SCI_SUCCESS))
isci_remote_device_wait_for_resume_from_abort(ihost, idev);
else
clear_bit(IDEV_ABORT_PATH_RESUME_PENDING, &idev->flags);