aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/megaraid.c
diff options
context:
space:
mode:
authorChristoph Hellwig <hch@lst.de>2005-11-29 15:36:16 -0500
committerLinus Torvalds <torvalds@g5.osdl.org>2005-11-29 16:03:01 -0500
commit238f9b063dcc9f23493a0d3fecca29fe332d4905 (patch)
treea2ddb44e978ade378774290a4fb697a232a890b6 /drivers/scsi/megaraid.c
parent238f58d898df941aa9d1cb390fb27ff4febe8965 (diff)
[PATCH] fix megaraid.c locking
This fixes locking in megaraid.c, namely: (1) make sure megaraid_queue release the adapter lock by changing the code to have a single return (2) remove the errornous scsi_assign_lock call Testing by Burton Windle. Signed-off-by: Christoph Hellwig <hch@lst.de> Acked-by: Burton Windle <bwindle@fint.org> Signed-off-by: Linus Torvalds <torvalds@osdl.org>
Diffstat (limited to 'drivers/scsi/megaraid.c')
-rw-r--r--drivers/scsi/megaraid.c29
1 files changed, 14 insertions, 15 deletions
diff --git a/drivers/scsi/megaraid.c b/drivers/scsi/megaraid.c
index dfea346b00a5..f9792528e33f 100644
--- a/drivers/scsi/megaraid.c
+++ b/drivers/scsi/megaraid.c
@@ -380,23 +380,23 @@ megaraid_queue(Scsi_Cmnd *scmd, void (*done)(Scsi_Cmnd *))
380 380
381 spin_lock_irqsave(&adapter->lock, flags); 381 spin_lock_irqsave(&adapter->lock, flags);
382 scb = mega_build_cmd(adapter, scmd, &busy); 382 scb = mega_build_cmd(adapter, scmd, &busy);
383 if (!scb)
384 goto out;
383 385
384 if(scb) { 386 scb->state |= SCB_PENDQ;
385 scb->state |= SCB_PENDQ; 387 list_add_tail(&scb->list, &adapter->pending_list);
386 list_add_tail(&scb->list, &adapter->pending_list);
387 388
388 /* 389 /*
389 * Check if the HBA is in quiescent state, e.g., during a 390 * Check if the HBA is in quiescent state, e.g., during a
390 * delete logical drive opertion. If it is, don't run 391 * delete logical drive opertion. If it is, don't run
391 * the pending_list. 392 * the pending_list.
392 */ 393 */
393 if(atomic_read(&adapter->quiescent) == 0) { 394 if (atomic_read(&adapter->quiescent) == 0)
394 mega_runpendq(adapter); 395 mega_runpendq(adapter);
395 }
396 return 0;
397 }
398 spin_unlock_irqrestore(&adapter->lock, flags);
399 396
397 busy = 0;
398 out:
399 spin_unlock_irqrestore(&adapter->lock, flags);
400 return busy; 400 return busy;
401} 401}
402 402
@@ -4677,7 +4677,6 @@ megaraid_probe_one(struct pci_dev *pdev, const struct pci_device_id *id)
4677 4677
4678 adapter->flag = flag; 4678 adapter->flag = flag;
4679 spin_lock_init(&adapter->lock); 4679 spin_lock_init(&adapter->lock);
4680 scsi_assign_lock(host, &adapter->lock);
4681 4680
4682 host->cmd_per_lun = max_cmd_per_lun; 4681 host->cmd_per_lun = max_cmd_per_lun;
4683 host->max_sectors = max_sectors_per_io; 4682 host->max_sectors = max_sectors_per_io;