]> git.baikalelectronics.ru Git - kernel.git/commitdiff
scsi: megaraid_sas: Update max supported LD IDs to 240
authorChandrakanth Patil <chandrakanth.patil@broadcom.com>
Thu, 2 Mar 2023 10:53:40 +0000 (16:23 +0530)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 17 Mar 2023 07:32:51 +0000 (08:32 +0100)
[ Upstream commit bfa659177dcba48cf13f2bd88c1972f12a60bf1c ]

The firmware only supports Logical Disk IDs up to 240 and LD ID 255 (0xFF)
is reserved for deleted LDs. However, in some cases, firmware was assigning
LD ID 254 (0xFE) to deleted LDs and this was causing the driver to mark the
wrong disk as deleted. This in turn caused the wrong disk device to be
taken offline by the SCSI midlayer.

To address this issue, limit the LD ID range from 255 to 240. This ensures
the deleted LD ID is properly identified and removed by the driver without
accidently deleting any valid LDs.

Fixes: 4d5cbca6306a ("scsi: megaraid_sas: Early detection of VD deletion through RaidMap update")
Reported-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Chandrakanth Patil <chandrakanth.patil@broadcom.com>
Signed-off-by: Sumit Saxena <sumit.saxena@broadcom.com>
Link: https://lore.kernel.org/r/20230302105342.34933-2-chandrakanth.patil@broadcom.com
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/scsi/megaraid/megaraid_sas.h
drivers/scsi/megaraid/megaraid_sas_fp.c

index aa62cc8ffd0af66c9b3e3dad3b47ce2d7de7e899..ce0c36fa26bf749c380d980faf2c4e7376e64d57 100644 (file)
@@ -1515,6 +1515,8 @@ struct megasas_ctrl_info {
 #define MEGASAS_MAX_LD_IDS                     (MEGASAS_MAX_LD_CHANNELS * \
                                                MEGASAS_MAX_DEV_PER_CHANNEL)
 
+#define MEGASAS_MAX_SUPPORTED_LD_IDS           240
+
 #define MEGASAS_MAX_SECTORS                    (2*1024)
 #define MEGASAS_MAX_SECTORS_IEEE               (2*128)
 #define MEGASAS_DBG_LVL                                1
index 8bfb46dbbed3ab67b61933e428eb1512d9d15d49..ff20f47090810a882ce2ba1ccaf21eefcadcd81a 100644 (file)
@@ -359,7 +359,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance, u64 map_id)
                ld = MR_TargetIdToLdGet(i, drv_map);
 
                /* For non existing VDs, iterate to next VD*/
-               if (ld >= (MAX_LOGICAL_DRIVES_EXT - 1))
+               if (ld >= MEGASAS_MAX_SUPPORTED_LD_IDS)
                        continue;
 
                raid = MR_LdRaidGet(ld, drv_map);