From: Vaios Papadimitriou Date: Tue, 8 May 2012 22:01:27 +0000 (-0500) Subject: Fixed system panic when extents enabled with large number of small blocks (CR 128010) X-Git-Tag: v2.6.39-400.9.0~423^2~123^2~3 X-Git-Url: https://www.infradead.org/git/?a=commitdiff_plain;h=961af346d84d948e207a3d53b5a139a1fa9bdc2a;p=users%2Fjedix%2Flinux-maple.git Fixed system panic when extents enabled with large number of small blocks (CR 128010) When LPe16000 port extents are enable with 24 extents of small blocks, the system will crash at driver load time. This is because the total number of sgls posted was not calculated correctly commit id: 25090d398e97309931f87682174f377cf0ac1131 Signed-off-by: Maxim Uvarov --- diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index ee02dc21245b5..8d64b5846b0c2 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -13260,7 +13260,7 @@ lpfc_sli4_post_els_sgl_list_ext(struct lpfc_hba *phba) LPFC_MBOXQ_t *mbox; uint32_t reqlen, alloclen, index; uint32_t mbox_tmo; - uint16_t rsrc_start, rsrc_size, els_xri_cnt; + uint16_t rsrc_start, rsrc_size, els_xri_cnt, post_els_xri_cnt; uint16_t xritag_start = 0, lxri = 0; struct lpfc_rsrc_blks *rsrc_blk; int cnt, ttl_cnt, rc = 0; @@ -13282,6 +13282,7 @@ lpfc_sli4_post_els_sgl_list_ext(struct lpfc_hba *phba) cnt = 0; ttl_cnt = 0; + post_els_xri_cnt = els_xri_cnt; list_for_each_entry(rsrc_blk, &phba->sli4_hba.lpfc_xri_blk_list, list) { rsrc_start = rsrc_blk->rsrc_start; @@ -13291,11 +13292,12 @@ lpfc_sli4_post_els_sgl_list_ext(struct lpfc_hba *phba) "3014 Working ELS Extent start %d, cnt %d\n", rsrc_start, rsrc_size); - loop_cnt = min(els_xri_cnt, rsrc_size); - if (ttl_cnt + loop_cnt >= els_xri_cnt) { - loop_cnt = els_xri_cnt - ttl_cnt; - ttl_cnt = els_xri_cnt; - } + loop_cnt = min(post_els_xri_cnt, rsrc_size); + if (loop_cnt < post_els_xri_cnt) { + post_els_xri_cnt -= loop_cnt; + ttl_cnt += loop_cnt; + } else + ttl_cnt += post_els_xri_cnt; mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL); if (!mbox)