Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[SCSI] fnic: fix incorrect use of SLAB_CACHE_DMA flag

Driver was incorrectly using the SLAB_CACHE_DMA flag when creating a cache
for SGLs. fnic device does not have 24-bit DMA restrictions. Remove the flag
and allocations from ZONE_DMA.

Thanks to Roland Dreier and David Rientjes for pointing out the bug.

Signed-off-by: Abhijeet Joglekar <abjoglek@cisco.com>
Signed-off-by: James Bottomley <JBottomley@Parallels.com>

authored by

Abhijeet Joglekar and committed by
James Bottomley
0c79c742 7bb66fc0

+6 -19
+1 -1
drivers/scsi/fnic/fnic.h
··· 37 37 38 38 #define DRV_NAME "fnic" 39 39 #define DRV_DESCRIPTION "Cisco FCoE HBA Driver" 40 - #define DRV_VERSION "1.5.0.1" 40 + #define DRV_VERSION "1.5.0.2" 41 41 #define PFX DRV_NAME ": " 42 42 #define DFX DRV_NAME "%d: " 43 43
+4 -17
drivers/scsi/fnic/fnic_main.c
··· 388 388 iounmap(fnic->bar0.vaddr); 389 389 } 390 390 391 - /* 392 - * Allocate element for mempools requiring GFP_DMA flag. 393 - * Otherwise, checks in kmem_flagcheck() hit BUG_ON(). 394 - */ 395 - static void *fnic_alloc_slab_dma(gfp_t gfp_mask, void *pool_data) 396 - { 397 - struct kmem_cache *mem = pool_data; 398 - 399 - return kmem_cache_alloc(mem, gfp_mask | GFP_ATOMIC | GFP_DMA); 400 - } 401 - 402 391 /** 403 392 * fnic_get_mac() - get assigned data MAC address for FIP code. 404 393 * @lport: local port. ··· 592 603 if (!fnic->io_req_pool) 593 604 goto err_out_free_resources; 594 605 595 - pool = mempool_create(2, fnic_alloc_slab_dma, mempool_free_slab, 596 - fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]); 606 + pool = mempool_create_slab_pool(2, fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]); 597 607 if (!pool) 598 608 goto err_out_free_ioreq_pool; 599 609 fnic->io_sgl_pool[FNIC_SGL_CACHE_DFLT] = pool; 600 610 601 - pool = mempool_create(2, fnic_alloc_slab_dma, mempool_free_slab, 602 - fnic_sgl_cache[FNIC_SGL_CACHE_MAX]); 611 + pool = mempool_create_slab_pool(2, fnic_sgl_cache[FNIC_SGL_CACHE_MAX]); 603 612 if (!pool) 604 613 goto err_out_free_dflt_pool; 605 614 fnic->io_sgl_pool[FNIC_SGL_CACHE_MAX] = pool; ··· 863 876 len = sizeof(struct fnic_dflt_sgl_list); 864 877 fnic_sgl_cache[FNIC_SGL_CACHE_DFLT] = kmem_cache_create 865 878 ("fnic_sgl_dflt", len + FNIC_SG_DESC_ALIGN, FNIC_SG_DESC_ALIGN, 866 - SLAB_HWCACHE_ALIGN | SLAB_CACHE_DMA, 879 + SLAB_HWCACHE_ALIGN, 867 880 NULL); 868 881 if (!fnic_sgl_cache[FNIC_SGL_CACHE_DFLT]) { 869 882 printk(KERN_ERR PFX "failed to create fnic dflt sgl slab\n"); ··· 875 888 len = sizeof(struct fnic_sgl_list); 876 889 fnic_sgl_cache[FNIC_SGL_CACHE_MAX] = kmem_cache_create 877 890 ("fnic_sgl_max", len + FNIC_SG_DESC_ALIGN, FNIC_SG_DESC_ALIGN, 878 - SLAB_HWCACHE_ALIGN | SLAB_CACHE_DMA, 891 + SLAB_HWCACHE_ALIGN, 879 892 NULL); 880 893 if (!fnic_sgl_cache[FNIC_SGL_CACHE_MAX]) { 881 894 printk(KERN_ERR PFX "failed to create fnic max sgl slab\n");
+1 -1
drivers/scsi/fnic/fnic_scsi.c
··· 406 406 if (sg_count) { 407 407 io_req->sgl_list = 408 408 mempool_alloc(fnic->io_sgl_pool[io_req->sgl_type], 409 - GFP_ATOMIC | GFP_DMA); 409 + GFP_ATOMIC); 410 410 if (!io_req->sgl_list) { 411 411 ret = SCSI_MLQUEUE_HOST_BUSY; 412 412 scsi_dma_unmap(sc);