Skip to content

Commit ae3dffd

Browse files
Sagar Biradargregkh
Sagar Biradar
authored andcommitted
scsi: aacraid: Disabling TM path and only processing IOP reset
[ Upstream commit bef18d3 ] 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]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 6260277 commit ae3dffd

File tree

2 files changed

+26
-10
lines changed

2 files changed

+26
-10
lines changed

drivers/scsi/aacraid/commsup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -728,7 +728,7 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback,
728728
hbacmd->request_id =
729729
cpu_to_le32((((u32)(fibptr - dev->fibs)) << 2) + 1);
730730
fibptr->flags |= FIB_CONTEXT_FLAG_SCSI_CMD;
731-
} else if (command != HBA_IU_TYPE_SCSI_TM_REQ)
731+
} else
732732
return -EINVAL;
733733

734734

drivers/scsi/aacraid/linit.c

Lines changed: 25 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -723,7 +723,11 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)
723723
status = aac_hba_send(HBA_IU_TYPE_SCSI_TM_REQ, fib,
724724
(fib_callback) aac_hba_callback,
725725
(void *) cmd);
726-
726+
if (status != -EINPROGRESS) {
727+
aac_fib_complete(fib);
728+
aac_fib_free(fib);
729+
return ret;
730+
}
727731
/* Wait up to 15 secs for completion */
728732
for (count = 0; count < 15; ++count) {
729733
if (cmd->SCp.sent_command) {
@@ -902,11 +906,11 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd)
902906

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

905-
if (info->devtype != AAC_DEVTYPE_NATIVE_RAW &&
906-
info->reset_state > 0)
909+
if (!(info->devtype == AAC_DEVTYPE_NATIVE_RAW &&
910+
!(info->reset_state > 0)))
907911
return FAILED;
908912

909-
pr_err("%s: Host adapter reset request. SCSI hang ?\n",
913+
pr_err("%s: Host device reset request. SCSI hang ?\n",
910914
AAC_DRIVERNAME);
911915

912916
fib = aac_fib_alloc(aac);
@@ -921,7 +925,12 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd)
921925
status = aac_hba_send(command, fib,
922926
(fib_callback) aac_tmf_callback,
923927
(void *) info);
924-
928+
if (status != -EINPROGRESS) {
929+
info->reset_state = 0;
930+
aac_fib_complete(fib);
931+
aac_fib_free(fib);
932+
return ret;
933+
}
925934
/* Wait up to 15 seconds for completion */
926935
for (count = 0; count < 15; ++count) {
927936
if (info->reset_state == 0) {
@@ -960,11 +969,11 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd)
960969

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

963-
if (info->devtype != AAC_DEVTYPE_NATIVE_RAW &&
964-
info->reset_state > 0)
972+
if (!(info->devtype == AAC_DEVTYPE_NATIVE_RAW &&
973+
!(info->reset_state > 0)))
965974
return FAILED;
966975

967-
pr_err("%s: Host adapter reset request. SCSI hang ?\n",
976+
pr_err("%s: Host target reset request. SCSI hang ?\n",
968977
AAC_DRIVERNAME);
969978

970979
fib = aac_fib_alloc(aac);
@@ -981,6 +990,13 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd)
981990
(fib_callback) aac_tmf_callback,
982991
(void *) info);
983992

993+
if (status != -EINPROGRESS) {
994+
info->reset_state = 0;
995+
aac_fib_complete(fib);
996+
aac_fib_free(fib);
997+
return ret;
998+
}
999+
9841000
/* Wait up to 15 seconds for completion */
9851001
for (count = 0; count < 15; ++count) {
9861002
if (info->reset_state <= 0) {
@@ -1033,7 +1049,7 @@ static int aac_eh_bus_reset(struct scsi_cmnd* cmd)
10331049
}
10341050
}
10351051

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

10381054
/*
10391055
* Check the health of the controller

0 commit comments

Comments
 (0)