aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2005-05-13 11:46:08 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-05-20 13:53:54 -0400
commitd8c37e7b9a619855e05d5d4e56c68f799b1f539c (patch)
treef32bcada38a55c16b8c0040043cd0ee087f48aec /drivers/scsi/scsi.c
parent5b8ef8425898e957243053c26ac2b68bd4bc42ec (diff)
[SCSI] remove a timer race in scsi_queue_insert()
scsi_queue_insert() has four callers. Three callers call with timer disabled and one (the second invocation in scsi_dispatch_cmd()) calls with timer activated. scsi_queue_insert() used to always call scsi_delete_timer() and ignore the return value. This results in race with timer expiration. Remove scsi_delete_timer() call from scsi_queue_insert() and make the caller delete timer and check the return value. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi.c')
-rw-r--r--drivers/scsi/scsi.c10
1 files changed, 6 insertions, 4 deletions
diff --git a/drivers/scsi/scsi.c b/drivers/scsi/scsi.c
index 05d2bd075fd4..0d730f646bce 100644
--- a/drivers/scsi/scsi.c
+++ b/drivers/scsi/scsi.c
@@ -638,10 +638,12 @@ int scsi_dispatch_cmd(struct scsi_cmnd *cmd)
638 } 638 }
639 spin_unlock_irqrestore(host->host_lock, flags); 639 spin_unlock_irqrestore(host->host_lock, flags);
640 if (rtn) { 640 if (rtn) {
641 atomic_inc(&cmd->device->iodone_cnt); 641 if (scsi_delete_timer(cmd)) {
642 scsi_queue_insert(cmd, 642 atomic_inc(&cmd->device->iodone_cnt);
643 (rtn == SCSI_MLQUEUE_DEVICE_BUSY) ? 643 scsi_queue_insert(cmd,
644 rtn : SCSI_MLQUEUE_HOST_BUSY); 644 (rtn == SCSI_MLQUEUE_DEVICE_BUSY) ?
645 rtn : SCSI_MLQUEUE_HOST_BUSY);
646 }
645 SCSI_LOG_MLQUEUE(3, 647 SCSI_LOG_MLQUEUE(3,
646 printk("queuecommand : request rejected\n")); 648 printk("queuecommand : request rejected\n"));
647 } 649 }