* [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* Re: [PATCH] dont decrement counters from scsi_kill_request
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
0 siblings, 1 reply; 5+ messages in thread
From: Rolf Eike Beer @ 2006-01-04 7:51 UTC (permalink / raw)
To: Mike Christie; +Cc: linux-scsi
[-- Attachment #1: Type: text/plain, Size: 204 bytes --]
Mike Christie wrote:
>+ while (end_that_request_first(req, 0, req->nr_sectors))
>+ ;
This should be something like
while (...)
{}
so it is absolutely clear that the empty body is intentional.
Eike
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] dont decrement counters from scsi_kill_request
2006-01-04 7:51 ` Rolf Eike Beer
@ 2006-01-04 8:05 ` Al Viro
2006-01-04 8:13 ` Rolf Eike Beer
0 siblings, 1 reply; 5+ messages in thread
From: Al Viro @ 2006-01-04 8:05 UTC (permalink / raw)
To: Rolf Eike Beer; +Cc: Mike Christie, linux-scsi
On Wed, Jan 04, 2006 at 08:51:57AM +0100, Rolf Eike Beer wrote:
> Mike Christie wrote:
>
> >+ while (end_that_request_first(req, 0, req->nr_sectors))
> >+ ;
>
> This should be something like
>
> while (...)
> {}
>
> so it is absolutely clear that the empty body is intentional.
Please, do not inflict that ugliness on everyone. FWIW, it's less
idiomatic than normal use of ; and personally I'd parse it as "somebody
had fscked up using editor", not as "wow, they _really_ meant it to be
an empty body".
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] dont decrement counters from scsi_kill_request
2006-01-04 8:05 ` Al Viro
@ 2006-01-04 8:13 ` Rolf Eike Beer
2006-01-04 9:00 ` Christoph Hellwig
0 siblings, 1 reply; 5+ messages in thread
From: Rolf Eike Beer @ 2006-01-04 8:13 UTC (permalink / raw)
To: Al Viro; +Cc: Mike Christie, linux-scsi
[-- Attachment #1: Type: text/plain, Size: 847 bytes --]
Al Viro wrote:
>On Wed, Jan 04, 2006 at 08:51:57AM +0100, Rolf Eike Beer wrote:
>> Mike Christie wrote:
>> >+ while (end_that_request_first(req, 0, req->nr_sectors))
>> >+ ;
>>
>> This should be something like
>>
>> while (...)
>> {}
>>
>> so it is absolutely clear that the empty body is intentional.
>
>Please, do not inflict that ugliness on everyone. FWIW, it's less
>idiomatic than normal use of ; and personally I'd parse it as "somebody
>had fscked up using editor", not as "wow, they _really_ meant it to be
>an empty body".
Using only ; on a single line looks like some code left over from removing
code... Ok, so let's agree to disagree. Since coding style says the opening
brace should be on the same line as the while, would it be better to put
everthing in one line to make clear what's going on?
Eike
[-- Attachment #2: Type: application/pgp-signature, Size: 189 bytes --]
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] dont decrement counters from scsi_kill_request
2006-01-04 8:13 ` Rolf Eike Beer
@ 2006-01-04 9:00 ` Christoph Hellwig
0 siblings, 0 replies; 5+ messages in thread
From: Christoph Hellwig @ 2006-01-04 9:00 UTC (permalink / raw)
To: Rolf Eike Beer; +Cc: Al Viro, Mike Christie, linux-scsi
On Wed, Jan 04, 2006 at 09:13:36AM +0100, Rolf Eike Beer wrote:
> Al Viro wrote:
> >On Wed, Jan 04, 2006 at 08:51:57AM +0100, Rolf Eike Beer wrote:
> >> Mike Christie wrote:
> >> >+ while (end_that_request_first(req, 0, req->nr_sectors))
> >> >+ ;
> >>
> >> This should be something like
> >>
> >> while (...)
> >> {}
> >>
> >> so it is absolutely clear that the empty body is intentional.
> >
> >Please, do not inflict that ugliness on everyone. FWIW, it's less
> >idiomatic than normal use of ; and personally I'd parse it as "somebody
> >had fscked up using editor", not as "wow, they _really_ meant it to be
> >an empty body".
>
> Using only ; on a single line looks like some code left over from removing
> code...
It's a common idiom and above code is copy and pasted from a perfectly
fine indented function. So could you please stop this silly discussion
now?
^ permalink raw reply [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