public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] dont decrement counters from scsi_kill_request
@ 2006-01-04  7:44 Mike Christie
  2006-01-04  7:51 ` Rolf Eike Beer
  0 siblings, 1 reply; 5+ messages in thread
From: Mike Christie @ 2006-01-04  7:44 UTC (permalink / raw)
  To: linux-scsi

This was debugged by zhenyu.z.wang@intel.com on the open-iscsi lists.

When we call scsi_kill_request() we have not yet incremented the
device and host busy counters so calling __scsi_done from
scsi_kill_request ends up doing extra decrements.

This patch has only been compile tested against scsi-misc. I am not
sure what the correct blk_complete_barrier_rq values should be. For
failures are we supposed to return zero or what is left in the command
and what how are we supposed set to indicate a error?

Signed-off-by: Mike Christie <michaelc@cs.wisc.edu>



diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c
index a7f3f0c..4b6a9fc 100644
--- a/drivers/scsi/scsi_lib.c
+++ b/drivers/scsi/scsi_lib.c
@@ -1514,8 +1514,6 @@ static void scsi_kill_request(struct req
 {
 	struct scsi_cmnd *cmd = req->special;
 
-	blkdev_dequeue_request(req);
-
 	if (unlikely(cmd == NULL)) {
 		printk(KERN_CRIT "impossible request in %s.\n",
 				 __FUNCTION__);
@@ -1523,9 +1521,19 @@ static void scsi_kill_request(struct req
 	}
 
 	scsi_init_cmd_errh(cmd);
-	cmd->result = DID_NO_CONNECT << 16;
 	atomic_inc(&cmd->device->iorequest_cnt);
-	__scsi_done(cmd);
+
+	blkdev_dequeue_request(req);
+	req->errors = DID_NO_CONNECT << 16;
+
+	if (blk_complete_barrier_rq(q, req, cmd->bufflen  >> 9)); 
+		return;
+
+	scsi_release_buffers(cmd);
+	while (end_that_request_first(req, 0, req->nr_sectors))
+		;
+	end_that_request_last(req);
+	scsi_put_command(cmd);
 }
 
 /*



^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2006-01-04  9:00 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-01-04  7:44 [PATCH] dont decrement counters from scsi_kill_request Mike Christie
2006-01-04  7:51 ` Rolf Eike Beer
2006-01-04  8:05   ` Al Viro
2006-01-04  8:13     ` Rolf Eike Beer
2006-01-04  9:00       ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox