mirror of
https://github.com/torvalds/linux.git
synced 2026-09-22 20:54:03 +02:00
nvme: fix context analysis warning in rdma.c
After adding Clang lock context annotations in rdma.c, Clang reports the following warning when context analysis is enabled: drivers/nvme/host/rdma.c:972:24: warning: passing pointer to variable 'list' requires holding mutex 'nvme_rdma_ctrl_mutex' [-Wthread-safety-pointer] 972 | if (list_empty(&ctrl->list)) | ^ The warning is triggered because ctrl->list is annotated as being protected by nvme_rdma_ctrl_mutex, but list_empty(&ctrl->list) is invoked without holding that mutex. Replace list_empty() with list_empty_careful(), which is intended for lockless inspection of list heads during teardown when no concurrent list modifications are expected. This suppresses the corresponding context analysis warning while preserving the existing behavior. Reviewed-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Nilay Shroff <nilay@linux.ibm.com> Signed-off-by: Keith Busch <kbusch@kernel.org>
This commit is contained in:
parent
5de3b73cea
commit
e906dc2a33
|
|
@ -1000,7 +1000,7 @@ static void nvme_rdma_free_ctrl(struct nvme_ctrl *nctrl)
|
|||
{
|
||||
struct nvme_rdma_ctrl *ctrl = to_rdma_ctrl(nctrl);
|
||||
|
||||
if (list_empty(&ctrl->list))
|
||||
if (list_empty_careful(&ctrl->list))
|
||||
goto free_ctrl;
|
||||
|
||||
mutex_lock(&nvme_rdma_ctrl_mutex);
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user