summaryrefslogtreecommitdiff
path: root/drivers/scsi/scsi_lib.c
diff options
context:
space:
mode:
authorTejun Heo <htejun@gmail.com>2006-04-11 17:27:53 +0900
committerJames Bottomley <jejb@mulgrave.il.steeleye.com>2006-04-13 13:25:49 -0500
commite36e0c80137af8f012528938dab2970c26d5ec4c (patch)
treefd48fe9041800b7f995f12e64d08d3857f00af8b /drivers/scsi/scsi_lib.c
parentaedf349773e5877d716a89368d512b9baa3e8c7b (diff)
[SCSI] SCSI: fix scsi_kill_request() busy count handling
scsi_kill_request() completes requests via normal SCSI completion path which decrements busy counts; however, requests which get passed to scsi_kill_request() aren't holding busy counts and scsi_kill_request() don't increment them before invoking completion path resulting in incorrect busy counts. Bump up busy counts before invoking completion path. Signed-off-by: Tejun Heo <htejun@gmail.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
Diffstat (limited to 'drivers/scsi/scsi_lib.c')
-rw-r--r--drivers/scsi/scsi_lib.c15
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index 8f010a314a3d..7b0f9a3810d2 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1479,6 +1479,8 @@ static inline int scsi_host_queue_ready(struct request_queue *q,
static void scsi_kill_request(struct request *req, request_queue_t *q)
{
struct scsi_cmnd *cmd = req->special;
+ struct scsi_device *sdev = cmd->device;
+ struct Scsi_Host *shost = sdev->host;
blkdev_dequeue_request(req);
@@ -1491,6 +1493,19 @@ static void scsi_kill_request(struct request *req, request_queue_t *q)
scsi_init_cmd_errh(cmd);
cmd->result = DID_NO_CONNECT << 16;
atomic_inc(&cmd->device->iorequest_cnt);
+
+ /*
+ * SCSI request completion path will do scsi_device_unbusy(),
+ * bump busy counts. To bump the counters, we need to dance
+ * with the locks as normal issue path does.
+ */
+ sdev->device_busy++;
+ spin_unlock(sdev->request_queue->queue_lock);
+ spin_lock(shost->host_lock);
+ shost->host_busy++;
+ spin_unlock(shost->host_lock);
+ spin_lock(sdev->request_queue->queue_lock);
+
__scsi_done(cmd);
}