scsi: efct: don't use GFP_KERNEL under spin lock
Subsystems (3)
PATCH v2 1/1 scsi: efct: don't use GFP_KERNEL under spin lock
GFP_KERNEL/GFP_DMA can't be used under a spin lock, according the comment of els_ios_lock, it's used to protect els ios list, so we can move down the spin lock to avoid using this flag under the lock.
---
v2:
move up unlock to just protect list_add_tail()
--- drivers/scsi/elx/libefc/efc_els.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
drivers/scsi/elx/libefc/efc_els.c +2 -6
@@ -46,18 +46,14 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen) efc = node->efc; -spin_lock_irqsave (&node->els_ios_lock, flags); -if (!node->els_io_enabled) {efc_log_err (efc,"els io alloc disabled\n" ); -spin_unlock_irqrestore (&node->els_ios_lock, flags);return NULL ; } els =mempool_alloc (efc->els_io_pool,GFP_ATOMIC );if (!els) {atomic_add_return (1 , &efc->els_io_alloc_failed_count); -spin_unlock_irqrestore (&node->els_ios_lock, flags);return NULL ; }
@@ -74,7 +70,6 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen) &els->io.req.phys, GFP_KERNEL);if (!els->io.req.virt) {mempool_free (els, efc->els_io_pool); -spin_unlock_irqrestore (&node->els_ios_lock, flags);return NULL ; }
@@ -94,10 +89,11 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen)/* add els structure to ELS IO list */ INIT_LIST_HEAD (&els->list_entry); +spin_lock_irqsave (&node->els_ios_lock, flags);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; }
Signature · 1 line
2.25.1
Quoted 7 lines · Yang Yingliang
GFP_KERNEL/GFP_DMA can't be used under a spin lock, according the comment of
els_ios_lock, it's used to protect els ios list, so we can move down the spin lock to avoid using this flag under the lock.Reported-by Hulk Robot <[email protected]>Fixes 8f406ef72859 ("scsi: elx: libefc: Extended link Service I/O handling")Signed-off-by Yang Yingliang <[email protected]>
Quoted 7 lines
---
v2:
move up unlock to just protectlist_add_tail()--- drivers/scsi/elx/libefc/efc_els.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-)
Looks fine.
-- james
Martin K. Petersen
AppliedYang,
Quoted 3 lines
GFP_KERNEL/GFP_DMA can't be used under a spin lock, according the comment of
els_ios_lock, it's used to protect els ios list, so we can move down the spin lock to avoid using this flag under the lock.
Applied to 5.17/scsi-staging, thanks!
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering
Martin K. Petersen
AppliedQuoted 5 lines · Yang Yingliang
GFP_KERNEL/GFP_DMA can't be used under a spin lock, according the comment of
els_ios_lock, it's used to protect els ios list, so we can move down the spin lock to avoid using this flag under the lock.
Applied to 5.17/scsi-fixes, thanks!
[1/1] scsi: efct: don't use GFP_KERNEL under spin lock
https://git.kernel.org/mkp/scsi/c/61263b3a11a2
Signature · 1 line
Martin K. Petersen Oracle Linux Engineering