Commit:     3eb7a51a3ae0ed0227e051ecf75199fccbb4cc73
Parent:     ba330ffebb43c37cabc765c7cb0a80df01554657
Author:     Darrick J. Wong <[EMAIL PROTECTED]>
AuthorDate: Tue Jan 30 01:18:35 2007 -0800
Committer:  James Bottomley <[EMAIL PROTECTED]>
CommitDate: Wed Jul 18 11:14:55 2007 -0500

    [SCSI] sas_ata: Satisfy libata qc function locking requirements
    ata_qc_complete and ata_sas_queuecmd require that the port lock be held
    when they are called.  sas_ata doesn't do this, leading to BUG messages
    about qc tags newly allocated qc tags already being in use.  This patch
    fixes the locking, which should clean up the rest of those messages.
    So far I've tested this against an IBM x206m with two SATA disks with no
    BUG messages and no other signs of things going wrong, and the machine
    finally passed the pounder stress test.
    Signed-off-by: Darrick J. Wong <[EMAIL PROTECTED]>
    Signed-off-by: James Bottomley <[EMAIL PROTECTED]>
 drivers/scsi/libsas/sas_ata.c       |    4 ++++
 drivers/scsi/libsas/sas_scsi_host.c |    4 ++++
 2 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/drivers/scsi/libsas/sas_ata.c b/drivers/scsi/libsas/sas_ata.c
index de42b5b..0bb1a14 100644
--- a/drivers/scsi/libsas/sas_ata.c
+++ b/drivers/scsi/libsas/sas_ata.c
@@ -92,7 +92,9 @@ static void sas_ata_task_done(struct sas_task *task)
        struct task_status_struct *stat = &task->task_status;
        struct ata_task_resp *resp = (struct ata_task_resp *)stat->buf;
        enum ata_completion_errors ac;
+       unsigned long flags;
+       spin_lock_irqsave(dev->sata_dev.ap->lock, flags);
        if (stat->stat == SAS_PROTO_RESPONSE) {
                ata_tf_from_fis(resp->ending_fis, &dev->;
                qc->err_mask |= ac_err_mask(dev->;
@@ -113,6 +115,8 @@ static void sas_ata_task_done(struct sas_task *task)
+       spin_unlock_irqrestore(dev->sata_dev.ap->lock, flags);
diff --git a/drivers/scsi/libsas/sas_scsi_host.c 
index dbc2a91..ba5c91b 100644
--- a/drivers/scsi/libsas/sas_scsi_host.c
+++ b/drivers/scsi/libsas/sas_scsi_host.c
@@ -216,8 +216,12 @@ int sas_queuecommand(struct scsi_cmnd *cmd,
                struct sas_task *task;
                if (dev_is_sata(dev)) {
+                       unsigned long flags;
+                       spin_lock_irqsave(dev->sata_dev.ap->lock, flags);
                        res = ata_sas_queuecmd(cmd, scsi_done,
+                       spin_unlock_irqrestore(dev->sata_dev.ap->lock, flags);
                        goto out;
To unsubscribe from this list: send the line "unsubscribe git-commits-head" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at

Reply via email to