Skip to content

Commit

Permalink
[SCSI] SCSI core: fix leakage of scsi_cmnd's
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
James Bottomley authored and James Bottomley committed Sep 9, 2005
1 parent e91442b commit 788ce43
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions drivers/scsi/scsi_lib.c
Original file line number Diff line number Diff line change
Expand Up @@ -1370,7 +1370,8 @@ static void scsi_kill_request(struct request *req, request_queue_t *q)
{
struct scsi_cmnd *cmd = req->special;

spin_unlock(q->queue_lock);
blkdev_dequeue_request(req);

if (unlikely(cmd == NULL)) {
printk(KERN_CRIT "impossible request in %s.\n",
__FUNCTION__);
Expand All @@ -1381,7 +1382,6 @@ static void scsi_kill_request(struct request *req, request_queue_t *q)
cmd->result = DID_NO_CONNECT << 16;
atomic_inc(&cmd->device->iorequest_cnt);
__scsi_done(cmd);
spin_lock(q->queue_lock);
}

/*
Expand Down Expand Up @@ -1432,7 +1432,6 @@ static void scsi_request_fn(struct request_queue *q)
if (unlikely(!scsi_device_online(sdev))) {
printk(KERN_ERR "scsi%d (%d:%d): rejecting I/O to offline device\n",
sdev->host->host_no, sdev->id, sdev->lun);
blkdev_dequeue_request(req);
scsi_kill_request(req, q);
continue;
}
Expand Down

0 comments on commit 788ce43

Please sign in to comment.