diff mbox series

[2/2] scsi: pm80xx: Add fatal error check for pm8001_lu_reset()

Message ID 20230523214127.4006891-3-pranavpp@google.com
State New
Headers show
Series scsi: pm80xx: Fatal error checks | expand

Commit Message

Pranav Prasad May 23, 2023, 9:41 p.m. UTC
From: Igor Pylypiv <ipylypiv@google.com>

This patch adds a fatal error check for pm8001_lu_reset().

Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
Signed-off-by: Pranav Prasad <pranavpp@google.com>
---
 drivers/scsi/pm8001/pm8001_sas.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

Comments

Jinpu Wang May 24, 2023, 6:37 a.m. UTC | #1
On Tue, May 23, 2023 at 11:41 PM Pranav Prasad <pranavpp@google.com> wrote:
>
> From: Igor Pylypiv <ipylypiv@google.com>
>
> This patch adds a fatal error check for pm8001_lu_reset().
>
> Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
> Signed-off-by: Pranav Prasad <pranavpp@google.com>
Acked-by: Jack Wang <jinpu.wang@ionos.com>
> ---
>  drivers/scsi/pm8001/pm8001_sas.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
>
> diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
> index b153f0966e5d..e302d5879bb7 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.c
> +++ b/drivers/scsi/pm8001/pm8001_sas.c
> @@ -918,6 +918,16 @@ int pm8001_lu_reset(struct domain_device *dev, u8 *lun)
>         struct pm8001_device *pm8001_dev = dev->lldd_dev;
>         struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev);
>         DECLARE_COMPLETION_ONSTACK(completion_setstate);
> +
> +       if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) {
> +               /* If the controller is in fatal error state,
> +                * we will not get a response from the controller
> +                */
> +               pm8001_dbg(pm8001_ha, FAIL,
> +                               "LUN reset failed due to fatal errors\n");
> +               return rc;
> +       }
> +
>         if (dev_is_sata(dev)) {
>                 struct sas_phy *phy = sas_get_local_phy(dev);
>                 sas_execute_internal_abort_dev(dev, 0, NULL);
> --
> 2.40.1.698.g37aff9b760-goog
>
Damien Le Moal May 24, 2023, 7:55 a.m. UTC | #2
On 5/24/23 06:41, Pranav Prasad wrote:
> From: Igor Pylypiv <ipylypiv@google.com>
> 
> This patch adds a fatal error check for pm8001_lu_reset().
> 
> Signed-off-by: Igor Pylypiv <ipylypiv@google.com>
> Signed-off-by: Pranav Prasad <pranavpp@google.com>
> ---
>  drivers/scsi/pm8001/pm8001_sas.c | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
> index b153f0966e5d..e302d5879bb7 100644
> --- a/drivers/scsi/pm8001/pm8001_sas.c
> +++ b/drivers/scsi/pm8001/pm8001_sas.c
> @@ -918,6 +918,16 @@ int pm8001_lu_reset(struct domain_device *dev, u8 *lun)
>  	struct pm8001_device *pm8001_dev = dev->lldd_dev;
>  	struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev);
>  	DECLARE_COMPLETION_ONSTACK(completion_setstate);
> +
> +	if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) {
> +		/* If the controller is in fatal error state,
> +		 * we will not get a response from the controller
> +		 */
> +		pm8001_dbg(pm8001_ha, FAIL,
> +				"LUN reset failed due to fatal errors\n");
> +		return rc;
> +	}
> +

Same comments as patch 1. And does this really need to be a separate patch ?
both patches touch the same file, and add a similar change to 2 functions, so I
would fold this in patch 1.

>  	if (dev_is_sata(dev)) {
>  		struct sas_phy *phy = sas_get_local_phy(dev);
>  		sas_execute_internal_abort_dev(dev, 0, NULL);
diff mbox series

Patch

diff --git a/drivers/scsi/pm8001/pm8001_sas.c b/drivers/scsi/pm8001/pm8001_sas.c
index b153f0966e5d..e302d5879bb7 100644
--- a/drivers/scsi/pm8001/pm8001_sas.c
+++ b/drivers/scsi/pm8001/pm8001_sas.c
@@ -918,6 +918,16 @@  int pm8001_lu_reset(struct domain_device *dev, u8 *lun)
 	struct pm8001_device *pm8001_dev = dev->lldd_dev;
 	struct pm8001_hba_info *pm8001_ha = pm8001_find_ha_by_dev(dev);
 	DECLARE_COMPLETION_ONSTACK(completion_setstate);
+
+	if (PM8001_CHIP_DISP->fatal_errors(pm8001_ha)) {
+		/* If the controller is in fatal error state,
+		 * we will not get a response from the controller
+		 */
+		pm8001_dbg(pm8001_ha, FAIL,
+				"LUN reset failed due to fatal errors\n");
+		return rc;
+	}
+
 	if (dev_is_sata(dev)) {
 		struct sas_phy *phy = sas_get_local_phy(dev);
 		sas_execute_internal_abort_dev(dev, 0, NULL);