Commit ae5afc39 authored by Sagar Biradar's avatar Sagar Biradar Committed by Greg Kroah-Hartman

scsi: aacraid: Disabling TM path and only processing IOP reset

[ Upstream commit bef18d30 ]

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/1581553771-25796-1-git-send-email-Sagar.Biradar@microchip.comReviewed-by: default avatarSagar Biradar <Sagar.Biradar@microchip.com>
Signed-off-by: default avatarSagar Biradar <Sagar.Biradar@microchip.com>
Signed-off-by: default avatarBalsundar P <balsundar.p@microsemi.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: default avatarSasha Levin <sashal@kernel.org>
parent 6854738c
...@@ -743,7 +743,7 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback, ...@@ -743,7 +743,7 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback,
hbacmd->request_id = hbacmd->request_id =
cpu_to_le32((((u32)(fibptr - dev->fibs)) << 2) + 1); cpu_to_le32((((u32)(fibptr - dev->fibs)) << 2) + 1);
fibptr->flags |= FIB_CONTEXT_FLAG_SCSI_CMD; fibptr->flags |= FIB_CONTEXT_FLAG_SCSI_CMD;
} else if (command != HBA_IU_TYPE_SCSI_TM_REQ) } else
return -EINVAL; return -EINVAL;
......
...@@ -736,7 +736,11 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) ...@@ -736,7 +736,11 @@ static int aac_eh_abort(struct scsi_cmnd* cmd)
status = aac_hba_send(HBA_IU_TYPE_SCSI_TM_REQ, fib, status = aac_hba_send(HBA_IU_TYPE_SCSI_TM_REQ, fib,
(fib_callback) aac_hba_callback, (fib_callback) aac_hba_callback,
(void *) cmd); (void *) cmd);
if (status != -EINPROGRESS) {
aac_fib_complete(fib);
aac_fib_free(fib);
return ret;
}
/* Wait up to 15 secs for completion */ /* Wait up to 15 secs for completion */
for (count = 0; count < 15; ++count) { for (count = 0; count < 15; ++count) {
if (cmd->SCp.sent_command) { if (cmd->SCp.sent_command) {
...@@ -915,11 +919,11 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd) ...@@ -915,11 +919,11 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd)
info = &aac->hba_map[bus][cid]; info = &aac->hba_map[bus][cid];
if (info->devtype != AAC_DEVTYPE_NATIVE_RAW && if (!(info->devtype == AAC_DEVTYPE_NATIVE_RAW &&
info->reset_state > 0) !(info->reset_state > 0)))
return FAILED; return FAILED;
pr_err("%s: Host adapter reset request. SCSI hang ?\n", pr_err("%s: Host device reset request. SCSI hang ?\n",
AAC_DRIVERNAME); AAC_DRIVERNAME);
fib = aac_fib_alloc(aac); fib = aac_fib_alloc(aac);
...@@ -934,7 +938,12 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd) ...@@ -934,7 +938,12 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd)
status = aac_hba_send(command, fib, status = aac_hba_send(command, fib,
(fib_callback) aac_tmf_callback, (fib_callback) aac_tmf_callback,
(void *) info); (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 */ /* Wait up to 15 seconds for completion */
for (count = 0; count < 15; ++count) { for (count = 0; count < 15; ++count) {
if (info->reset_state == 0) { if (info->reset_state == 0) {
...@@ -973,11 +982,11 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd) ...@@ -973,11 +982,11 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd)
info = &aac->hba_map[bus][cid]; info = &aac->hba_map[bus][cid];
if (info->devtype != AAC_DEVTYPE_NATIVE_RAW && if (!(info->devtype == AAC_DEVTYPE_NATIVE_RAW &&
info->reset_state > 0) !(info->reset_state > 0)))
return FAILED; return FAILED;
pr_err("%s: Host adapter reset request. SCSI hang ?\n", pr_err("%s: Host target reset request. SCSI hang ?\n",
AAC_DRIVERNAME); AAC_DRIVERNAME);
fib = aac_fib_alloc(aac); fib = aac_fib_alloc(aac);
...@@ -994,6 +1003,13 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd) ...@@ -994,6 +1003,13 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd)
(fib_callback) aac_tmf_callback, (fib_callback) aac_tmf_callback,
(void *) info); (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 */ /* Wait up to 15 seconds for completion */
for (count = 0; count < 15; ++count) { for (count = 0; count < 15; ++count) {
if (info->reset_state <= 0) { if (info->reset_state <= 0) {
...@@ -1046,7 +1062,7 @@ static int aac_eh_bus_reset(struct scsi_cmnd* cmd) ...@@ -1046,7 +1062,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 * Check the health of the controller
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment