Re: Re: [PATCH] [SCSI] pm8001: Use spin_lock_irqsave() for task_state.
From: jack_wang
Date: Sun Mar 11 2012 - 03:10:29 EST
Looks OK to me.
Thanks.
Acked-by: Jack Wang <jack_wang@xxxxxxxxx>
--------------
jack_wang
>ACK
>
>On Mar 9, 2012, at 3:13 AM, santosh nayak wrote:
>
>> From: Santosh Nayak <santoshprasadnayak@xxxxxxxxx>
>>
>> Use spin_lock_irqsave() for task_state.
>>
>> Signed-off-by: Santosh Nayak <santoshprasadnayak@xxxxxxxxx>
>> ---
>> drivers/scsi/pm8001/pm8001_hwi.c | 18 ++++++++++--------
>> 1 files changed, 10 insertions(+), 8 deletions(-)
>>
>> diff --git a/drivers/scsi/pm8001/pm8001_hwi.c b/drivers/scsi/pm8001/pm8001_hwi.c
>> index 3619f6e..9d82ee5 100644
>> --- a/drivers/scsi/pm8001/pm8001_hwi.c
>> +++ b/drivers/scsi/pm8001/pm8001_hwi.c
>> @@ -2093,6 +2093,7 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
>> struct ata_task_resp *resp ;
>> u32 *sata_resp;
>> struct pm8001_device *pm8001_dev;
>> + unsigned long flags;
>>
>> psataPayload = (struct sata_completion_resp *)(piomb + 4);
>> status = le32_to_cpu(psataPayload->status);
>> @@ -2382,26 +2383,26 @@ mpi_sata_completion(struct pm8001_hba_info *pm8001_ha, void *piomb)
>> ts->stat = SAS_DEV_NO_RESPONSE;
>> break;
>> }
>> - spin_lock_irq(&t->task_state_lock);
>> + spin_lock_irqsave(&t->task_state_lock, flags);
>> t->task_state_flags &= ~SAS_TASK_STATE_PENDING;
>> t->task_state_flags &= ~SAS_TASK_AT_INITIATOR;
>> t->task_state_flags |= SAS_TASK_STATE_DONE;
>> if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) {
>> - spin_unlock_irq(&t->task_state_lock);
>> + spin_unlock_irqrestore(&t->task_state_lock, flags);
>> PM8001_FAIL_DBG(pm8001_ha,
>> pm8001_printk("task 0x%p done with io_status 0x%x"
>> " resp 0x%x stat 0x%x but aborted by upper layer!\n",
>> t, status, ts->resp, ts->stat));
>> pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
>> } else if (t->uldd_task) {
>> - spin_unlock_irq(&t->task_state_lock);
>> + spin_unlock_irqrestore(&t->task_state_lock, flags);
>> pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
>> mb();/* ditto */
>> spin_unlock_irq(&pm8001_ha->lock);
>> t->task_done(t);
>> spin_lock_irq(&pm8001_ha->lock);
>> } else if (!t->uldd_task) {
>> - spin_unlock_irq(&t->task_state_lock);
>> + spin_unlock_irqrestore(&t->task_state_lock, flags);
>> pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
>> mb();/*ditto*/
>> spin_unlock_irq(&pm8001_ha->lock);
>> @@ -2423,6 +2424,7 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb)
>> u32 tag = le32_to_cpu(psataPayload->tag);
>> u32 port_id = le32_to_cpu(psataPayload->port_id);
>> u32 dev_id = le32_to_cpu(psataPayload->device_id);
>> + unsigned long flags;
>>
>> ccb = &pm8001_ha->ccb_info[tag];
>> t = ccb->task;
>> @@ -2593,26 +2595,26 @@ static void mpi_sata_event(struct pm8001_hba_info *pm8001_ha , void *piomb)
>> ts->stat = SAS_OPEN_TO;
>> break;
>> }
>> - spin_lock_irq(&t->task_state_lock);
>> + spin_lock_irqsave(&t->task_state_lock, flags);
>> t->task_state_flags &= ~SAS_TASK_STATE_PENDING;
>> t->task_state_flags &= ~SAS_TASK_AT_INITIATOR;
>> t->task_state_flags |= SAS_TASK_STATE_DONE;
>> if (unlikely((t->task_state_flags & SAS_TASK_STATE_ABORTED))) {
>> - spin_unlock_irq(&t->task_state_lock);
>> + spin_unlock_irqrestore(&t->task_state_lock, flags);
>> PM8001_FAIL_DBG(pm8001_ha,
>> pm8001_printk("task 0x%p done with io_status 0x%x"
>> " resp 0x%x stat 0x%x but aborted by upper layer!\n",
>> t, event, ts->resp, ts->stat));
>> pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
>> } else if (t->uldd_task) {
>> - spin_unlock_irq(&t->task_state_lock);
>> + spin_unlock_irqrestore(&t->task_state_lock, flags);
>> pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
>> mb();/* ditto */
>> spin_unlock_irq(&pm8001_ha->lock);
>> t->task_done(t);
>> spin_lock_irq(&pm8001_ha->lock);
>> } else if (!t->uldd_task) {
>> - spin_unlock_irq(&t->task_state_lock);
>> + spin_unlock_irqrestore(&t->task_state_lock, flags);
>> pm8001_ccb_task_free(pm8001_ha, t, ccb, tag);
>> mb();/*ditto*/
>> spin_unlock_irq(&pm8001_ha->lock);
>
>______________________________________________________________________
>This email may contain privileged or confidential information, which should only be used for the purpose for which it was sent by Xyratex. No further rights or licenses are granted to use such information. If you are not the intended recipient of this message, please notify the sender by return and delete it. You may not use, copy, disclose or rely on the information contained in it.
>
>Internet email is susceptible to data corruption, interception and unauthorised amendment for which Xyratex does not accept liability. While we have taken reasonable precautions to ensure that this email is free of viruses, Xyratex does not accept liability for the presence of any computer viruses in this email, nor for any losses caused as a result of viruses.
>
>Xyratex Technology Limited (03134912), Registered in England & Wales, Registered Office, Langstone Road, Havant, Hampshire, PO9 1SA.
>
>The Xyratex group of companies also includes, Xyratex Ltd, registered in Bermuda, Xyratex International Inc, registered in California, Xyratex (Malaysia) Sdn Bhd registered in Malaysia, Xyratex Technology (Wuxi) Co Ltd registered in The People's Republic of China and Xyratex Japan Limited registered in Japan.
>______________________________________________________________________
>
>
>
>__________ Information from ESET NOD32 Antivirus, version of virus signature database 5659 (20101129) __________
>
>The message was checked by ESET NOD32 Antivirus.
>
>http://www.eset.com
>
>
>韬{.n?????%?lzwm?b?Р骒r?zXЩ??{ay????j?f"?????ア?⒎?:+v???????赙zZ+????"?!?O???v??m?鹈n?帼Y&—