Skip to content

Commit 61263b3

Browse files
Yang Yingliangmartinkpetersen
authored andcommitted
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/[email protected] Fixes: 8f406ef ("scsi: elx: libefc: Extended link Service I/O handling") Reported-by: Hulk Robot <[email protected]> Reviewed-by: James Smart <[email protected]> Signed-off-by: Yang Yingliang <[email protected]> Signed-off-by: Martin K. Petersen <[email protected]>
1 parent e783362 commit 61263b3

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

drivers/scsi/elx/libefc/efc_els.c

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -46,18 +46,14 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen)
4646

4747
efc = node->efc;
4848

49-
spin_lock_irqsave(&node->els_ios_lock, flags);
50-
5149
if (!node->els_io_enabled) {
5250
efc_log_err(efc, "els io alloc disabled\n");
53-
spin_unlock_irqrestore(&node->els_ios_lock, flags);
5451
return NULL;
5552
}
5653

5754
els = mempool_alloc(efc->els_io_pool, GFP_ATOMIC);
5855
if (!els) {
5956
atomic_add_return(1, &efc->els_io_alloc_failed_count);
60-
spin_unlock_irqrestore(&node->els_ios_lock, flags);
6157
return NULL;
6258
}
6359

@@ -74,7 +70,6 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen)
7470
&els->io.req.phys, GFP_KERNEL);
7571
if (!els->io.req.virt) {
7672
mempool_free(els, efc->els_io_pool);
77-
spin_unlock_irqrestore(&node->els_ios_lock, flags);
7873
return NULL;
7974
}
8075

@@ -94,10 +89,11 @@ efc_els_io_alloc_size(struct efc_node *node, u32 reqlen, u32 rsplen)
9489

9590
/* add els structure to ELS IO list */
9691
INIT_LIST_HEAD(&els->list_entry);
92+
spin_lock_irqsave(&node->els_ios_lock, flags);
9793
list_add_tail(&els->list_entry, &node->els_ios_list);
94+
spin_unlock_irqrestore(&node->els_ios_lock, flags);
9895
}
9996

100-
spin_unlock_irqrestore(&node->els_ios_lock, flags);
10197
return els;
10298
}
10399

0 commit comments

Comments
 (0)