public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Mike Christie <michaelc@cs.wisc.edu>
To: linux-scsi@vger.kernel.org
Subject: [PATCH] dont decrement counters from scsi_kill_request
Date: Wed, 04 Jan 2006 01:44:47 -0600	[thread overview]
Message-ID: <1136360688.9634.2.camel@max> (raw)

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);
 }
 
 /*



             reply	other threads:[~2006-01-04  7:44 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-01-04  7:44 Mike Christie [this message]
2006-01-04  7:51 ` [PATCH] dont decrement counters from scsi_kill_request 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1136360688.9634.2.camel@max \
    --to=michaelc@cs.wisc.edu \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox