[PATCH] megaraid_mm: moved pci_pool_alloc() from critical section to outward

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi
This patch moved call of pci_pool_alloc from critical section to outward.
It seems like that original code behavior schedule-in without unlock.

Note
This patch is not tested because I don't have this device.

Thanks.
Hirofumi Nakagawa

Signed-off-by: Hirofumi Nakagawa <hnakagawa@xxxxxxxxxxxxxxxx>
---
 drivers/scsi/megaraid/megaraid_mm.c |   13 ++++++++-----
 1 files changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/scsi/megaraid/megaraid_mm.c b/drivers/scsi/megaraid/megaraid_mm.c
index f680561..4d70906 100644
--- a/drivers/scsi/megaraid/megaraid_mm.c
+++ b/drivers/scsi/megaraid/megaraid_mm.c
@@ -499,6 +499,7 @@ mraid_mm_attach_buf(mraid_mmadp_t *adp, uioc_t *kioc, int xferlen)
 	int		right_pool = -1;
 	unsigned long	flags;
 	int		i;
+	void *t;

 	kioc->pool_index	= -1;
 	kioc->buf_vaddr		= NULL;
@@ -549,17 +550,19 @@ mraid_mm_attach_buf(mraid_mmadp_t *adp, uioc_t *kioc, int xferlen)
 	 * to allocate one new buffer. NOTE: This is a blocking call.
 	 */
 	pool = &adp->dma_pool_list[right_pool];
+	t = pci_pool_alloc(pool->handle, GFP_KERNEL,
+							&kioc->buf_paddr);
+
+	if (!t)
+		return -ENOMEM;

 	spin_lock_irqsave(&pool->lock, flags);

 	kioc->pool_index	= right_pool;
 	kioc->free_buf		= 1;
-	kioc->buf_vaddr 	= pci_pool_alloc(pool->handle, GFP_KERNEL,
-							&kioc->buf_paddr);
-	spin_unlock_irqrestore(&pool->lock, flags);
+	kioc->buf_vaddr 	= t;

-	if (!kioc->buf_vaddr)
-		return -ENOMEM;
+	spin_unlock_irqrestore(&pool->lock, flags);

 	return 0;
 }
-- 

--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [SCSI Target Devel]     [Linux SCSI Target Infrastructure]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Linux IIO]     [Samba]     [Device Mapper]
  Powered by Linux