Commit 61263b3a authored by Yang Yingliang's avatar Yang Yingliang Committed by Martin K. Petersen

scsi: elx: efct: Don't use GFP_KERNEL under spin lock

GFP_KERNEL/GFP_DMA can't be used under a spin lock. According the comment,
els_ios_lock is used to protect els ios list so we can move down the spin
lock to avoid using this flag under the lock.

Link: https://lore.kernel.org/r/20220111012441.3232527-1-yangyingliang@huawei.com
Fixes: 8f406ef7 ("scsi: elx: libefc: Extended link Service I/O handling")
Reported-by: default avatarHulk Robot <hulkci@huawei.com>
Reviewed-by: default avatarJames Smart <jsmart2021@gmail.com>
Signed-off-by: default avatarYang Yingliang <yangyingliang@huawei.com>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent e783362e
...@@ -46,18 +46,14 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen) ...@@ -46,18 +46,14 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen)
efc = node->efc; efc = node->efc;
spin_lock_irqsave(&node->els_ios_lock, flags);
if (!node->els_io_enabled) { if (!node->els_io_enabled) {
efc_log_err(efc, "els io alloc disabled\n"); efc_log_err(efc, "els io alloc disabled\n");
spin_unlock_irqrestore(&node->els_ios_lock, flags);
return NULL; return NULL;
} }
els = mempool_alloc(efc->els_io_pool, GFP_ATOMIC); els = mempool_alloc(efc->els_io_pool, GFP_ATOMIC);
if (!els) { if (!els) {
atomic_add_return(1, &efc->els_io_alloc_failed_count); atomic_add_return(1, &efc->els_io_alloc_failed_count);
spin_unlock_irqrestore(&node->els_ios_lock, flags);
return NULL; return NULL;
} }
...@@ -74,7 +70,6 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen) ...@@ -74,7 +70,6 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen)
&els->io.req.phys, GFP_KERNEL); &els->io.req.phys, GFP_KERNEL);
if (!els->io.req.virt) { if (!els->io.req.virt) {
mempool_free(els, efc->els_io_pool); mempool_free(els, efc->els_io_pool);
spin_unlock_irqrestore(&node->els_ios_lock, flags);
return NULL; return NULL;
} }
...@@ -94,10 +89,11 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen) ...@@ -94,10 +89,11 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen)
/* add els structure to ELS IO list */ /* add els structure to ELS IO list */
INIT_LIST_HEAD(&els->list_entry); INIT_LIST_HEAD(&els->list_entry);
spin_lock_irqsave(&node->els_ios_lock, flags);
list_add_tail(&els->list_entry, &node->els_ios_list); list_add_tail(&els->list_entry, &node->els_ios_list);
spin_unlock_irqrestore(&node->els_ios_lock, flags);
} }
spin_unlock_irqrestore(&node->els_ios_lock, flags);
return els; return els;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment