Commit b3911ab3 authored by Sreekanth Reddy's avatar Sreekanth Reddy Committed by Martin K. Petersen

scsi: mpi3mr: Fix cmnd getting marked as in use forever

When a driver command which requires the driver to issue a follow up
command using the same command frame is outstanding and a soft reset
operation occurs, then that driver command frame is getting marked as in
use permanently and won't be reused again.

Clear the driver command frames while flushing out the outstanding commands
and avoid issuing any new requests using these command frames while soft
reset is going on.

Link: https://lore.kernel.org/r/20220210095817.22828-6-sreekanth.reddy@broadcom.comSigned-off-by: default avatarSreekanth Reddy <sreekanth.reddy@broadcom.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 191a3ef5
......@@ -1583,6 +1583,9 @@ static void mpi3mr_dev_rmhs_complete_iou(struct mpi3mr_ioc *mrioc,
u16 cmd_idx = drv_cmd->host_tag - MPI3MR_HOSTTAG_DEVRMCMD_MIN;
struct delayed_dev_rmhs_node *delayed_dev_rmhs = NULL;
if (drv_cmd->state & MPI3MR_CMD_RESET)
goto clear_drv_cmd;
ioc_info(mrioc,
"%s :dev_rmhs_iouctrl_complete:handle(0x%04x), ioc_status(0x%04x), loginfo(0x%08x)\n",
__func__, drv_cmd->dev_handle, drv_cmd->ioc_status,
......@@ -1623,6 +1626,8 @@ static void mpi3mr_dev_rmhs_complete_iou(struct mpi3mr_ioc *mrioc,
kfree(delayed_dev_rmhs);
return;
}
clear_drv_cmd:
drv_cmd->state = MPI3MR_CMD_NOTUSED;
drv_cmd->callback = NULL;
drv_cmd->retry_count = 0;
......@@ -1649,6 +1654,9 @@ static void mpi3mr_dev_rmhs_complete_tm(struct mpi3mr_ioc *mrioc,
struct mpi3_scsi_task_mgmt_reply *tm_reply = NULL;
int retval;
if (drv_cmd->state & MPI3MR_CMD_RESET)
goto clear_drv_cmd;
if (drv_cmd->state & MPI3MR_CMD_REPLY_VALID)
tm_reply = (struct mpi3_scsi_task_mgmt_reply *)drv_cmd->reply;
......@@ -1677,11 +1685,11 @@ static void mpi3mr_dev_rmhs_complete_tm(struct mpi3mr_ioc *mrioc,
if (retval) {
pr_err(IOCNAME "Issue DevRmHsTMIOUCTL: Admin post failed\n",
mrioc->name);
goto out_failed;
goto clear_drv_cmd;
}
return;
out_failed:
clear_drv_cmd:
drv_cmd->state = MPI3MR_CMD_NOTUSED;
drv_cmd->callback = NULL;
drv_cmd->dev_handle = MPI3MR_INVALID_DEV_HANDLE;
......@@ -1796,6 +1804,9 @@ static void mpi3mr_complete_evt_ack(struct mpi3mr_ioc *mrioc,
u16 cmd_idx = drv_cmd->host_tag - MPI3MR_HOSTTAG_EVTACKCMD_MIN;
struct delayed_evt_ack_node *delayed_evtack = NULL;
if (drv_cmd->state & MPI3MR_CMD_RESET)
goto clear_drv_cmd;
if (drv_cmd->ioc_status != MPI3_IOCSTATUS_SUCCESS) {
dprint_event_th(mrioc,
"immediate event ack failed with ioc_status(0x%04x) log_info(0x%08x)\n",
......@@ -1813,6 +1824,7 @@ static void mpi3mr_complete_evt_ack(struct mpi3mr_ioc *mrioc,
kfree(delayed_evtack);
return;
}
clear_drv_cmd:
drv_cmd->state = MPI3MR_CMD_NOTUSED;
drv_cmd->callback = NULL;
clear_bit(cmd_idx, mrioc->evtack_cmds_bitmap);
......
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