Skip to content

Commit

Permalink
scsi: aacraid: Disabling TM path and only processing IOP reset
Browse files Browse the repository at this point in the history
Fixes the occasional adapter panic when sg_reset is issued with -d, -t, -b
and -H flags.  Removal of command type HBA_IU_TYPE_SCSI_TM_REQ in
aac_hba_send since iu_type, request_id and fib_flags are not populated.
Device and target reset handlers are made to send TMF commands only when
reset_state is 0.

Link: https://lore.kernel.org/r/[email protected]
Reviewed-by: Sagar Biradar <[email protected]>
Signed-off-by: Sagar Biradar <[email protected]>
Signed-off-by: Balsundar P <[email protected]>
Signed-off-by: Martin K. Petersen <[email protected]>
  • Loading branch information
Sagar Biradar authored and martinkpetersen committed Mar 12, 2020
1 parent ed83038 commit bef18d3
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 10 deletions.
2 changes: 1 addition & 1 deletion drivers/scsi/aacraid/commsup.c
Original file line number Diff line number Diff line change
Expand Up @@ -729,7 +729,7 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback,
hbacmd->request_id =
cpu_to_le32((((u32)(fibptr - dev->fibs)) << 2) + 1);
fibptr->flags |= FIB_CONTEXT_FLAG_SCSI_CMD;
} else if (command != HBA_IU_TYPE_SCSI_TM_REQ)
} else
return -EINVAL;


Expand Down
34 changes: 25 additions & 9 deletions drivers/scsi/aacraid/linit.c
Original file line number Diff line number Diff line change
Expand Up @@ -733,7 +733,11 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)
status = aac_hba_send(HBA_IU_TYPE_SCSI_TM_REQ, fib,
(fib_callback) aac_hba_callback,
(void *) cmd);

if (status != -EINPROGRESS) {
aac_fib_complete(fib);
aac_fib_free(fib);
return ret;
}
/* Wait up to 15 secs for completion */
for (count = 0; count < 15; ++count) {
if (cmd->SCp.sent_command) {
Expand Down Expand Up @@ -912,11 +916,11 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd)

info = &aac->hba_map[bus][cid];

if (info->devtype != AAC_DEVTYPE_NATIVE_RAW &&
info->reset_state > 0)
if (!(info->devtype == AAC_DEVTYPE_NATIVE_RAW &&
!(info->reset_state > 0)))
return FAILED;

pr_err("%s: Host adapter reset request. SCSI hang ?\n",
pr_err("%s: Host device reset request. SCSI hang ?\n",
AAC_DRIVERNAME);

fib = aac_fib_alloc(aac);
Expand All @@ -931,7 +935,12 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd)
status = aac_hba_send(command, fib,
(fib_callback) aac_tmf_callback,
(void *) info);

if (status != -EINPROGRESS) {
info->reset_state = 0;
aac_fib_complete(fib);
aac_fib_free(fib);
return ret;
}
/* Wait up to 15 seconds for completion */
for (count = 0; count < 15; ++count) {
if (info->reset_state == 0) {
Expand Down Expand Up @@ -970,11 +979,11 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd)

info = &aac->hba_map[bus][cid];

if (info->devtype != AAC_DEVTYPE_NATIVE_RAW &&
info->reset_state > 0)
if (!(info->devtype == AAC_DEVTYPE_NATIVE_RAW &&
!(info->reset_state > 0)))
return FAILED;

pr_err("%s: Host adapter reset request. SCSI hang ?\n",
pr_err("%s: Host target reset request. SCSI hang ?\n",
AAC_DRIVERNAME);

fib = aac_fib_alloc(aac);
Expand All @@ -991,6 +1000,13 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd)
(fib_callback) aac_tmf_callback,
(void *) info);

if (status != -EINPROGRESS) {
info->reset_state = 0;
aac_fib_complete(fib);
aac_fib_free(fib);
return ret;
}

/* Wait up to 15 seconds for completion */
for (count = 0; count < 15; ++count) {
if (info->reset_state <= 0) {
Expand Down Expand Up @@ -1043,7 +1059,7 @@ static int aac_eh_bus_reset(struct scsi_cmnd* cmd)
}
}

pr_err("%s: Host adapter reset request. SCSI hang ?\n", AAC_DRIVERNAME);
pr_err("%s: Host bus reset request. SCSI hang ?\n", AAC_DRIVERNAME);

/*
* Check the health of the controller
Expand Down

0 comments on commit bef18d3

Please sign in to comment.