aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
authorJames Bottomley <James.Bottomley@steeleye.com>2005-09-09 14:40:23 -0400
committerJames Bottomley <jejb@mulgrave.(none)>2005-09-09 17:30:59 -0400
commit788ce43aa1ad7158f894b6bb3df8ba2f63794c20 (patch)
tree56b84ceff12e0296f782023563a7a612a34fa6d9 /drivers/scsi/scsi_lib.c
parente91442b635be776ea205fba233bdd5bc74b62bc3 (diff)
[SCSI] SCSI core: fix leakage of scsi_cmnd's
Actually, just one problem and one cosmetic fix: 1) We need to dequeue for the loop and kill case (it seems easiest simply to dequeue in the scsi_kill_request() routine) 2) There's no real need to drop the queue lock. __scsi_done() is lock agnostic, so since there's no requirement, let's just leave it in to avoid any locking issues. Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c5
1 files changed, 2 insertions, 3 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 003f8cf47cf1..d8d984841534 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1370,7 +1370,8 @@ static void scsi_kill_request(struct request *req, request_queue_t *q)
1370{ 1370{
1371 struct scsi_cmnd *cmd = req->special; 1371 struct scsi_cmnd *cmd = req->special;
1372 1372
1373 spin_unlock(q->queue_lock); 1373 blkdev_dequeue_request(req);
1374
1374 if (unlikely(cmd == NULL)) { 1375 if (unlikely(cmd == NULL)) {
1375 printk(KERN_CRIT "impossible request in %s.\n", 1376 printk(KERN_CRIT "impossible request in %s.\n",
1376 __FUNCTION__); 1377 __FUNCTION__);
@@ -1381,7 +1382,6 @@ static void scsi_kill_request(struct request *req, request_queue_t *q)
1381 cmd->result = DID_NO_CONNECT << 16; 1382 cmd->result = DID_NO_CONNECT << 16;
1382 atomic_inc(&cmd->device->iorequest_cnt); 1383 atomic_inc(&cmd->device->iorequest_cnt);
1383 __scsi_done(cmd); 1384 __scsi_done(cmd);
1384 spin_lock(q->queue_lock);
1385} 1385}
1386 1386
1387/* 1387/*
@@ -1432,7 +1432,6 @@ static void scsi_request_fn(struct request_queue *q)
1432 if (unlikely(!scsi_device_online(sdev))) { 1432 if (unlikely(!scsi_device_online(sdev))) {
1433 printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to offline device\n", 1433 printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to offline device\n",
1434 sdev->host->host_no, sdev->id, sdev->lun); 1434 sdev->host->host_no, sdev->id, sdev->lun);
1435 blkdev_dequeue_request(req);
1436 scsi_kill_request(req, q); 1435 scsi_kill_request(req, q);
1437 continue; 1436 continue;
1438 } 1437 }