Message ID | 20220729131627.15019-16-sreekanth.reddy@broadcom.com (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | mpi3mr: Added Support for SAS Transport | expand |
> On Jul 29, 2022, at 6:16 AM, Sreekanth Reddy <sreekanth.reddy@broadcom.com> wrote: > > Block the IOs on the target devices until corresponding > target device's target dev objects are refreshed as part > of post controller reset operation. > > Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> > --- > drivers/scsi/mpi3mr/mpi3mr_os.c | 25 +++++++++++++++---------- > 1 file changed, 15 insertions(+), 10 deletions(-) > > diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c > index d4f37b1..c7d9e46 100644 > --- a/drivers/scsi/mpi3mr/mpi3mr_os.c > +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c > @@ -424,6 +424,8 @@ void mpi3mr_invalidate_devhandles(struct mpi3mr_ioc *mrioc) > tgt_priv->io_throttle_enabled = 0; > tgt_priv->io_divert = 0; > tgt_priv->throttle_group = NULL; > + if (tgtdev->host_exposed) > + atomic_set(&tgt_priv->block_io, 1); > } > } > } > @@ -835,6 +837,7 @@ void mpi3mr_remove_tgtdev_from_host(struct mpi3mr_ioc *mrioc, > __func__, tgtdev->dev_handle, (unsigned long long)tgtdev->wwid); > if (tgtdev->starget && tgtdev->starget->hostdata) { > tgt_priv = tgtdev->starget->hostdata; > + atomic_set(&tgt_priv->block_io, 0); > tgt_priv->dev_handle = MPI3MR_INVALID_DEV_HANDLE; > } > > @@ -1077,6 +1080,8 @@ static void mpi3mr_update_tgtdev(struct mpi3mr_ioc *mrioc, > scsi_tgt_priv_data->dev_type = tgtdev->dev_type; > scsi_tgt_priv_data->io_throttle_enabled = > tgtdev->io_throttle_enabled; > + if (is_added == true) > + atomic_set(&scsi_tgt_priv_data->block_io, 0); > } > > switch (dev_pg0->access_status) { > @@ -4576,6 +4581,16 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost, > > stgt_priv_data = sdev_priv_data->tgt_priv_data; > > + if (atomic_read(&stgt_priv_data->block_io)) { > + if (mrioc->stop_drv_processing) { > + scmd->result = DID_NO_CONNECT << 16; > + scsi_done(scmd); > + goto out; > + } > + retval = SCSI_MLQUEUE_DEVICE_BUSY; > + goto out; > + } > + > dev_handle = stgt_priv_data->dev_handle; > if (dev_handle == MPI3MR_INVALID_DEV_HANDLE) { > scmd->result = DID_NO_CONNECT << 16; > @@ -4588,16 +4603,6 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost, > goto out; > } > > - if (atomic_read(&stgt_priv_data->block_io)) { > - if (mrioc->stop_drv_processing) { > - scmd->result = DID_NO_CONNECT << 16; > - scsi_done(scmd); > - goto out; > - } > - retval = SCSI_MLQUEUE_DEVICE_BUSY; > - goto out; > - } > - > if (stgt_priv_data->dev_type == MPI3_DEVICE_DEVFORM_PCIE) > is_pcie_dev = 1; > if ((scmd->cmnd[0] == UNMAP) && is_pcie_dev && > -- > 2.27.0 > Reviewed-by: Himanshu Madhani <himanshu.madhani@oracle.com> -- Himanshu Madhani Oracle Linux Engineering
diff --git a/drivers/scsi/mpi3mr/mpi3mr_os.c b/drivers/scsi/mpi3mr/mpi3mr_os.c index d4f37b1..c7d9e46 100644 --- a/drivers/scsi/mpi3mr/mpi3mr_os.c +++ b/drivers/scsi/mpi3mr/mpi3mr_os.c @@ -424,6 +424,8 @@ void mpi3mr_invalidate_devhandles(struct mpi3mr_ioc *mrioc) tgt_priv->io_throttle_enabled = 0; tgt_priv->io_divert = 0; tgt_priv->throttle_group = NULL; + if (tgtdev->host_exposed) + atomic_set(&tgt_priv->block_io, 1); } } } @@ -835,6 +837,7 @@ void mpi3mr_remove_tgtdev_from_host(struct mpi3mr_ioc *mrioc, __func__, tgtdev->dev_handle, (unsigned long long)tgtdev->wwid); if (tgtdev->starget && tgtdev->starget->hostdata) { tgt_priv = tgtdev->starget->hostdata; + atomic_set(&tgt_priv->block_io, 0); tgt_priv->dev_handle = MPI3MR_INVALID_DEV_HANDLE; } @@ -1077,6 +1080,8 @@ static void mpi3mr_update_tgtdev(struct mpi3mr_ioc *mrioc, scsi_tgt_priv_data->dev_type = tgtdev->dev_type; scsi_tgt_priv_data->io_throttle_enabled = tgtdev->io_throttle_enabled; + if (is_added == true) + atomic_set(&scsi_tgt_priv_data->block_io, 0); } switch (dev_pg0->access_status) { @@ -4576,6 +4581,16 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost, stgt_priv_data = sdev_priv_data->tgt_priv_data; + if (atomic_read(&stgt_priv_data->block_io)) { + if (mrioc->stop_drv_processing) { + scmd->result = DID_NO_CONNECT << 16; + scsi_done(scmd); + goto out; + } + retval = SCSI_MLQUEUE_DEVICE_BUSY; + goto out; + } + dev_handle = stgt_priv_data->dev_handle; if (dev_handle == MPI3MR_INVALID_DEV_HANDLE) { scmd->result = DID_NO_CONNECT << 16; @@ -4588,16 +4603,6 @@ static int mpi3mr_qcmd(struct Scsi_Host *shost, goto out; } - if (atomic_read(&stgt_priv_data->block_io)) { - if (mrioc->stop_drv_processing) { - scmd->result = DID_NO_CONNECT << 16; - scsi_done(scmd); - goto out; - } - retval = SCSI_MLQUEUE_DEVICE_BUSY; - goto out; - } - if (stgt_priv_data->dev_type == MPI3_DEVICE_DEVFORM_PCIE) is_pcie_dev = 1; if ((scmd->cmnd[0] == UNMAP) && is_pcie_dev &&
Block the IOs on the target devices until corresponding target device's target dev objects are refreshed as part of post controller reset operation. Signed-off-by: Sreekanth Reddy <sreekanth.reddy@broadcom.com> --- drivers/scsi/mpi3mr/mpi3mr_os.c | 25 +++++++++++++++---------- 1 file changed, 15 insertions(+), 10 deletions(-)