Skip to content

Commit 9f35fa8

Browse files
Sumant PatroJames Bottomley
authored andcommitted
[SCSI] megaraid_sas: replace pci_alloc_consitent with dma_alloc_coherent in ioctl path
Replaced pci_alloc_consistent with dma_alloc_coherent from the ioctl path. This is to avoid situations where ioctl fails for lack of memory (when system under heavy stress). Signed-off-by: Sumant Patro <sumant.patro@lsi.com> Signed-off-by: James Bottomley <James.Bottomley@SteelEye.com>
1 parent cf62a0a commit 9f35fa8

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/scsi/megaraid/megaraid_sas.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2711,9 +2711,9 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
27112711
* For each user buffer, create a mirror buffer and copy in
27122712
*/
27132713
for (i = 0; i < ioc->sge_count; i++) {
2714-
kbuff_arr[i] = pci_alloc_consistent(instance->pdev,
2714+
kbuff_arr[i] = dma_alloc_coherent(&instance->pdev->dev,
27152715
ioc->sgl[i].iov_len,
2716-
&buf_handle);
2716+
&buf_handle, GFP_KERNEL);
27172717
if (!kbuff_arr[i]) {
27182718
printk(KERN_DEBUG "megasas: Failed to alloc "
27192719
"kernel SGL buffer for IOCTL \n");
@@ -2740,8 +2740,8 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
27402740
}
27412741

27422742
if (ioc->sense_len) {
2743-
sense = pci_alloc_consistent(instance->pdev, ioc->sense_len,
2744-
&sense_handle);
2743+
sense = dma_alloc_coherent(&instance->pdev->dev, ioc->sense_len,
2744+
&sense_handle, GFP_KERNEL);
27452745
if (!sense) {
27462746
error = -ENOMEM;
27472747
goto out;
@@ -2800,12 +2800,12 @@ megasas_mgmt_fw_ioctl(struct megasas_instance *instance,
28002800

28012801
out:
28022802
if (sense) {
2803-
pci_free_consistent(instance->pdev, ioc->sense_len,
2803+
dma_free_coherent(&instance->pdev->dev, ioc->sense_len,
28042804
sense, sense_handle);
28052805
}
28062806

28072807
for (i = 0; i < ioc->sge_count && kbuff_arr[i]; i++) {
2808-
pci_free_consistent(instance->pdev,
2808+
dma_free_coherent(&instance->pdev->dev,
28092809
kern_sge32[i].length,
28102810
kbuff_arr[i], kern_sge32[i].phys_addr);
28112811
}

0 commit comments

Comments
 (0)