diff options
author | Mike Christie <michaelc@cs.wisc.edu> | 2010-10-07 01:51:17 -0400 |
---|---|---|
committer | James Bottomley <James.Bottomley@suse.de> | 2010-10-25 15:55:57 -0400 |
commit | 92b3e5bbbebe86dd0071ccf23c1b21031f74bf56 (patch) | |
tree | 0d093ba4395b1cff4aa6f75c6b90c295d616a06c /drivers/scsi/qla4xxx | |
parent | d64eab764aaf1455d4cd790e3651a2d65b69e661 (diff) |
[SCSI] qla4xxx: grab hardware_lock in eh_abort before accessing srb
grab hardware_lock in eh_abort before accessing srb to avoid
race between command completion and get refcount on srb.
Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: Vikas Chaudhary <vikas.chaudhary@qlogic.com>
Signed-off-by: Ravi Anand <ravi.anand@qlogic.com>
Reviewed-by: Mike Christie <michaelc@cs.wisc.edu>
Signed-off-by: James Bottomley <James.Bottomley@suse.de>
Diffstat (limited to 'drivers/scsi/qla4xxx')
-rw-r--r-- | drivers/scsi/qla4xxx/ql4_os.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/scsi/qla4xxx/ql4_os.c b/drivers/scsi/qla4xxx/ql4_os.c index 4b6cdb68a52a..f1c58eb26ba2 100644 --- a/drivers/scsi/qla4xxx/ql4_os.c +++ b/drivers/scsi/qla4xxx/ql4_os.c | |||
@@ -2006,6 +2006,7 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd) | |||
2006 | unsigned int id = cmd->device->id; | 2006 | unsigned int id = cmd->device->id; |
2007 | unsigned int lun = cmd->device->lun; | 2007 | unsigned int lun = cmd->device->lun; |
2008 | unsigned long serial = cmd->serial_number; | 2008 | unsigned long serial = cmd->serial_number; |
2009 | unsigned long flags; | ||
2009 | struct srb *srb = NULL; | 2010 | struct srb *srb = NULL; |
2010 | int ret = SUCCESS; | 2011 | int ret = SUCCESS; |
2011 | int wait = 0; | 2012 | int wait = 0; |
@@ -2014,12 +2015,14 @@ static int qla4xxx_eh_abort(struct scsi_cmnd *cmd) | |||
2014 | "scsi%ld:%d:%d: Abort command issued cmd=%p, pid=%ld\n", | 2015 | "scsi%ld:%d:%d: Abort command issued cmd=%p, pid=%ld\n", |
2015 | ha->host_no, id, lun, cmd, serial); | 2016 | ha->host_no, id, lun, cmd, serial); |
2016 | 2017 | ||
2018 | spin_lock_irqsave(&ha->hardware_lock, flags); | ||
2017 | srb = (struct srb *) CMD_SP(cmd); | 2019 | srb = (struct srb *) CMD_SP(cmd); |
2018 | 2020 | if (!srb) { | |
2019 | if (!srb) | 2021 | spin_unlock_irqrestore(&ha->hardware_lock, flags); |
2020 | return SUCCESS; | 2022 | return SUCCESS; |
2021 | 2023 | } | |
2022 | kref_get(&srb->srb_ref); | 2024 | kref_get(&srb->srb_ref); |
2025 | spin_unlock_irqrestore(&ha->hardware_lock, flags); | ||
2023 | 2026 | ||
2024 | if (qla4xxx_abort_task(ha, srb) != QLA_SUCCESS) { | 2027 | if (qla4xxx_abort_task(ha, srb) != QLA_SUCCESS) { |
2025 | DEBUG3(printk("scsi%ld:%d:%d: Abort_task mbx failed.\n", | 2028 | DEBUG3(printk("scsi%ld:%d:%d: Abort_task mbx failed.\n", |