]> www.infradead.org Git - nvme.git/commitdiff
nvme-rdma: do not try to stop unallocated queues
authorMaurizio Lombardi <mlombard@redhat.com>
Mon, 31 Jul 2023 10:37:58 +0000 (12:37 +0200)
committerKeith Busch <kbusch@kernel.org>
Thu, 5 Oct 2023 16:37:41 +0000 (09:37 -0700)
Trying to stop a queue which hasn't been allocated will result
in a warning due to calling mutex_lock() against an uninitialized mutex.

 DEBUG_LOCKS_WARN_ON(lock->magic != lock)
 WARNING: CPU: 4 PID: 104150 at kernel/locking/mutex.c:579

 Call trace:
  RIP: 0010:__mutex_lock+0x1173/0x14a0
  nvme_rdma_stop_queue+0x1b/0xa0 [nvme_rdma]
  nvme_rdma_teardown_io_queues.part.0+0xb0/0x1d0 [nvme_rdma]
  nvme_rdma_delete_ctrl+0x50/0x100 [nvme_rdma]
  nvme_do_delete_ctrl+0x149/0x158 [nvme_core]

Signed-off-by: Maurizio Lombardi <mlombard@redhat.com>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Tested-by: Yi Zhang <yi.zhang@redhat.com>
Signed-off-by: Keith Busch <kbusch@kernel.org>
drivers/nvme/host/rdma.c

index 337a624a537ce14f764667e02a55607b54ca0e66..a7fea4cbacd753cfdf59b2a71c1420c7499b561e 100644 (file)
@@ -638,6 +638,9 @@ static void __nvme_rdma_stop_queue(struct nvme_rdma_queue *queue)
 
 static void nvme_rdma_stop_queue(struct nvme_rdma_queue *queue)
 {
+       if (!test_bit(NVME_RDMA_Q_ALLOCATED, &queue->flags))
+               return;
+
        mutex_lock(&queue->queue_lock);
        if (test_and_clear_bit(NVME_RDMA_Q_LIVE, &queue->flags))
                __nvme_rdma_stop_queue(queue);