* [PATCH] megaraid bad queuecommand return
@ 2004-11-19 8:53 Jens Axboe
2004-11-19 12:17 ` Jens Axboe
0 siblings, 1 reply; 2+ messages in thread
From: Jens Axboe @ 2004-11-19 8:53 UTC (permalink / raw)
To: linux-scsi, James Bottomley
Hi,
In case of scb allocation failure, mega_build_cmd() can return NULL scb
but set busy, which causes a non-zero return from ->queuecommand() while
the scsi command has been completed. Flagging error and calling done
should be enough for appropriate retries.
Signed-off-by: Jens Axboe <axboe@suse.de>
===== drivers/scsi/megaraid.c 1.73 vs edited =====
--- 1.73/drivers/scsi/megaraid.c 2004-11-11 09:43:34 +01:00
+++ edited/drivers/scsi/megaraid.c 2004-11-19 09:03:43 +01:00
@@ -634,11 +634,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_
}
if(!(scb = mega_allocate_scb(adapter, cmd))) {
-
- cmd->result = (DID_ERROR << 16);
- cmd->scsi_done(cmd);
*busy = 1;
-
return NULL;
}
@@ -677,11 +673,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_
/* Allocate a SCB and initialize passthru */
if(!(scb = mega_allocate_scb(adapter, cmd))) {
-
- cmd->result = (DID_ERROR << 16);
- cmd->scsi_done(cmd);
*busy = 1;
-
return NULL;
}
pthru = scb->pthru;
@@ -723,11 +715,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_
/* Allocate a SCB and initialize mailbox */
if(!(scb = mega_allocate_scb(adapter, cmd))) {
-
- cmd->result = (DID_ERROR << 16);
- cmd->scsi_done(cmd);
*busy = 1;
-
return NULL;
}
mbox = (mbox_t *)scb->raw_mbox;
@@ -867,11 +855,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_
/* Allocate a SCB and initialize mailbox */
if(!(scb = mega_allocate_scb(adapter, cmd))) {
-
- cmd->result = (DID_ERROR << 16);
- cmd->scsi_done(cmd);
*busy = 1;
-
return NULL;
}
@@ -899,11 +883,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_
else {
/* Allocate a SCB and initialize passthru */
if(!(scb = mega_allocate_scb(adapter, cmd))) {
-
- cmd->result = (DID_ERROR << 16);
- cmd->scsi_done(cmd);
*busy = 1;
-
return NULL;
}
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [PATCH] megaraid bad queuecommand return
2004-11-19 8:53 [PATCH] megaraid bad queuecommand return Jens Axboe
@ 2004-11-19 12:17 ` Jens Axboe
0 siblings, 0 replies; 2+ messages in thread
From: Jens Axboe @ 2004-11-19 12:17 UTC (permalink / raw)
To: linux-scsi, James Bottomley
On Fri, Nov 19 2004, Jens Axboe wrote:
> Hi,
>
> In case of scb allocation failure, mega_build_cmd() can return NULL scb
> but set busy, which causes a non-zero return from ->queuecommand() while
> the scsi command has been completed. Flagging error and calling done
> should be enough for appropriate retries.
Of course the other way around for this particular patch - just return
busy and let the mid layer handle it, but make sure not to call done()
first.
> Signed-off-by: Jens Axboe <axboe@suse.de>
>
> ===== drivers/scsi/megaraid.c 1.73 vs edited =====
> --- 1.73/drivers/scsi/megaraid.c 2004-11-11 09:43:34 +01:00
> +++ edited/drivers/scsi/megaraid.c 2004-11-19 09:03:43 +01:00
> @@ -634,11 +634,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_
> }
>
> if(!(scb = mega_allocate_scb(adapter, cmd))) {
> -
> - cmd->result = (DID_ERROR << 16);
> - cmd->scsi_done(cmd);
> *busy = 1;
> -
> return NULL;
> }
>
> @@ -677,11 +673,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_
>
> /* Allocate a SCB and initialize passthru */
> if(!(scb = mega_allocate_scb(adapter, cmd))) {
> -
> - cmd->result = (DID_ERROR << 16);
> - cmd->scsi_done(cmd);
> *busy = 1;
> -
> return NULL;
> }
> pthru = scb->pthru;
> @@ -723,11 +715,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_
>
> /* Allocate a SCB and initialize mailbox */
> if(!(scb = mega_allocate_scb(adapter, cmd))) {
> -
> - cmd->result = (DID_ERROR << 16);
> - cmd->scsi_done(cmd);
> *busy = 1;
> -
> return NULL;
> }
> mbox = (mbox_t *)scb->raw_mbox;
> @@ -867,11 +855,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_
>
> /* Allocate a SCB and initialize mailbox */
> if(!(scb = mega_allocate_scb(adapter, cmd))) {
> -
> - cmd->result = (DID_ERROR << 16);
> - cmd->scsi_done(cmd);
> *busy = 1;
> -
> return NULL;
> }
>
> @@ -899,11 +883,7 @@ mega_build_cmd(adapter_t *adapter, Scsi_
> else {
> /* Allocate a SCB and initialize passthru */
> if(!(scb = mega_allocate_scb(adapter, cmd))) {
> -
> - cmd->result = (DID_ERROR << 16);
> - cmd->scsi_done(cmd);
> *busy = 1;
> -
> return NULL;
> }
>
>
> --
> Jens Axboe
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
>
--
Jens Axboe
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2004-11-19 12:17 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-11-19 8:53 [PATCH] megaraid bad queuecommand return Jens Axboe
2004-11-19 12:17 ` Jens Axboe
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox