public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Dan Carpenter <dan.carpenter@oracle.com>
To: jack wang <jack_wang@usish.com>,
	James Bottomley <James.Bottomley@suse.de>
Cc: linux-scsi@vger.kernel.org
Subject: re: [SCSI] pm8001: Fix for sata io circular lock dependency.
Date: Wed, 5 Oct 2011 09:25:13 +0300	[thread overview]
Message-ID: <20111005062513.GC32513@elgon.mountain> (raw)

The locking in 9e79e12554d "[SCSI] pm8001: Fix for sata io circular
lock dependency." is wrong.  We should revert this patch.

diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
index a3de306..68695b7 100644
--- a/drivers/scsi/pm8001/pm8001_hwi.c
+++ b/drivers/scsi/pm8001/pm8001_hwi.c
@@ -1901,7 +1901,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
 {
        struct sas_task *t;
        struct pm8001_ccb_info *ccb;
-       unsigned long flags;
+       unsigned long flags = 0;
        u32 param;
        u32 status;
        u32 tag;
@@ -2040,7 +2040,9 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
                        ts->stat = SAS_QUEUE_FULL;
                        pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
                        mb();/*in order to force CPU ordering*/
+                       spin_unlock_irqrestore(&pm8001_ha->lock, flags);
                        t->task_done(t);
+                       spin_lock_irqsave(&pm8001_ha->lock, flags);
                        return;
                }
                break;

We can't just call spin_unlock_irqrestore(&pm8001_ha->lock, 0);
It makes no sense to call spin_lock_irqsave() and then return
immediately.  We could call spin_lock_irq() if we don't plan to
restore the state of flags.

regards,
dan carpenter

                 reply	other threads:[~2011-10-05  6:25 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111005062513.GC32513@elgon.mountain \
    --to=dan.carpenter@oracle.com \
    --cc=James.Bottomley@suse.de \
    --cc=jack_wang@usish.com \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox