aacraid: Fail commands that are not submitted
Subsystems (2)
PATCH 1/1 aacraid: Fail commands that are not submitted
aac_queuecommand() is a scsi_host_template.queuecommand() implementation and hence must return one of the following values:
* 0
* SCSI_MLQUEUE_HOST_BUSY
* SCSI_MLQUEUE_DEVICE_BUSY
* SCSI_MLQUEUE_EH_RETRY
* SCSI_MLQUEUE_TARGET_BUSY
Hence, instead of returning FAILED, set cmd->result, call scsi_done() and return 0.
--- drivers/scsi/aacraid/linit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/aacraid/linit.c +5 -1
@@ -242,7 +242,11 @@ static int aac_queuecommand(struct Scsi_Host *shost, {aac_priv (cmd)->owner =AAC_OWNER_LOWLEVEL ; -return aac_scsi_cmd (cmd) ?FAILED :0 ; +if (WARN_ON_ONCE (aac_scsi_cmd (cmd))) { + cmd->result =DID_ERROR <<16 ; +scsi_done (cmd); + } +return 0 ; }/**
Quoted 7 lines · Bart Van Assche
aac_queuecommand()is ascsi_host_template.queuecommand()implementation and hence must return one of the following values:
* 0
*SCSI_MLQUEUE_HOST_BUSY
*SCSI_MLQUEUE_DEVICE_BUSY
*SCSI_MLQUEUE_EH_RETRY
*SCSI_MLQUEUE_TARGET_BUSY
Doesn't scsi_dispatch_cmd() translate anything non-zero and not SCSI_MLQUEUE_DEVICE_BUSY or SCSI_MLQUEUE_TARGET_BUSY to SCSI_MLQUEUE_HOST_BUSY?
There are many dev->in_reset checks which return -1 and then FAILED is passed to scsi midlayer. Hence previously we would get SCSI_MLQUEUE_HOST_BUSY - are you sure that you still don't want this?
I am not sure what is being fixed here. Things are just being made compliant, but with possible side effects.
Quoted 18 lines
Hence, instead of returning FAILED, set
cmd->result, callscsi_done()and return 0.Cc Gilbert Wu <[email protected]>Cc Sagar Biradar <[email protected]>Cc John Garry <[email protected]>Fixes 03f295368bcd ("[PATCH] aacraid driver for 2.5")Signed-off-by Bart Van Assche <[email protected]>--- drivers/scsi/aacraid/linit.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-)drivers/scsi/aacraid/linit.c +0
-0
drivers/scsi/aacraid/linit.c static int aac_queuecommand(struct Scsi_Host *shost, · line 245
Quoted 5 lines
drivers/scsi/aacraid/linit.c +1
-1@@ -242,7 +242,11 @@ static int aac_queuecommand(struct Scsi_Host *shost, {aac_priv (cmd)->owner =AAC_OWNER_LOWLEVEL ; -return aac_scsi_cmd (cmd) ?FAILED :0 ; +if (WARN_ON_ONCE (aac_scsi_cmd (cmd))) {
why WARN for this?
Quoted 7 lines
drivers/scsi/aacraid/linit.c +4
-0+ cmd->result =DID_ERROR <<16 ; +scsi_done (cmd); + } +return 0 ; }/**
Quoted 1 line · John Garry
Doesn't
scsi_dispatch_cmd()translate anything non-zero and notSCSI_MLQUEUE_DEVICE_BUSYorSCSI_MLQUEUE_TARGET_BUSYtoSCSI_MLQUEUE_HOST_BUSY?
Yes.
Quoted 1 line
There are many
dev->in_resetchecks which return -1 and then FAILED is passed to scsi midlayer. Hence previously we would getSCSI_MLQUEUE_HOST_BUSY- are you sure that you still don't want this?
Probably. I plan to post a second version of this patch that doesn't modify the behavior of the aacraid driver.
Thanks,
Bart.