Skip to contentSkip to conversation

aacraid: Fail commands that are not submitted

PATCH In review Bart Van Assche 2 participants 3 messages Oct 14, 2025 – Oct 20, 2025

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

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.

Cc Gilbert Wu <[email protected]>
Cc Sagar Biradar <[email protected]>
Cc John Garry <[email protected]>
Fixes 03f295368bcd ("[PATCH] aacraid driver for 2.5")
---
 drivers/scsi/aacraid/linit.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/aacraid/linit.c +5 -1
index ea66196ef7c7..01156d1a1d06 100644
@@ -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;
 }
 
 /**
#1 lore raw
Quoted 7 lines · Bart Van Assche

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

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, call scsi_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")
---
  drivers/scsi/aacraid/linit.c | 6 +++++-
  1 file changed, 5 insertions(+), 1 deletion(-)
drivers/scsi/aacraid/linit.c +0 -0
index ea66196ef7c7..01156d1a1d06 100644

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;
  }
 
  /**
#2 lore raw
Quoted 1 line · John Garry

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?

Yes.

Quoted 1 line

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?

Probably. I plan to post a second version of this patch that doesn't modify the behavior of the aacraid driver.

Thanks,

Bart.