]> www.infradead.org Git - users/jedix/linux-maple.git/commitdiff
scsi: megaraid_sas: In validate raid map, raid capability is not converted to cpu...
authorShivasharan S <shivasharan.srikanteshwara@broadcom.com>
Fri, 10 Feb 2017 08:59:18 +0000 (00:59 -0800)
committerChuck Anderson <chuck.anderson@oracle.com>
Thu, 1 Jun 2017 21:06:04 +0000 (14:06 -0700)
Orabug: 26096381

On a host, if an ld is deleted there is a hole in the ld array returned
by the FW. But in MR_ValidateMapInfo we are not accounting for holes in
the ld array and traverse only upto index num_lds.  This patch takes
care of converting the capability field of all the valid lds in the ld
raid map.

Signed-off-by: Shivasharan S <shivasharan.srikanteshwara@broadcom.com>
Signed-off-by: Kashyap Desai <kashyap.desai@broadcom.com>
Reviewed-by: Hannes Reinecke <hare@suse.com>
Reviewed-by: Tomas Henzl <thenzl@redhat.com>
Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
(cherry picked from commit a09454ce5dd11184c5040ed536d323e2a302a579)
Signed-off-by: Somasundaram Krishnasamy <somasundaram.krishnasamy@oracle.com>
Signed-off-by: Kirtikar Kashyap <kirtikar.kashyap@oracle.com>
Reviewed-by: Dhaval Giani <dhaval.giani@oracle.com>
drivers/scsi/megaraid/megaraid_sas_fp.c

index bd3c41b2044d9992f629fd047875830c872d7e61..b16ca88fdf643cb8f35404007ef2981b4e055f2b 100644 (file)
@@ -447,7 +447,7 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance)
        struct LD_LOAD_BALANCE_INFO *lbInfo;
        PLD_SPAN_INFO ldSpanInfo;
        struct MR_LD_RAID         *raid;
-       u16 ldCount, num_lds;
+       u16 num_lds, i;
        u16 ld;
        u32 expected_size;
 
@@ -490,10 +490,17 @@ u8 MR_ValidateMapInfo(struct megasas_instance *instance)
        num_lds = le16_to_cpu(drv_map->raidMap.ldCount);
 
        /*Convert Raid capability values to CPU arch */
-       for (ldCount = 0; ldCount < num_lds; ldCount++) {
-               ld = MR_TargetIdToLdGet(ldCount, drv_map);
+       for (i = 0; (num_lds > 0) && (i < MAX_LOGICAL_DRIVES_EXT); i++) {
+               ld = MR_TargetIdToLdGet(i, drv_map);
+
+               /* For non existing VDs, iterate to next VD*/
+               if (ld >= (MAX_LOGICAL_DRIVES_EXT - 1))
+                       continue;
+
                raid = MR_LdRaidGet(ld, drv_map);
                le32_to_cpus((u32 *)&raid->capability);
+
+               num_lds--;
        }
 
        return 1;