nvmet-rdma: drain the queue-pair just before freeing it
authorSagi Grimberg <sagi@grimberg.me>
Sun, 6 Nov 2016 09:03:59 +0000 (11:03 +0200)
committerSagi Grimberg <sagi@grimberg.me>
Mon, 14 Nov 2016 00:08:53 +0000 (02:08 +0200)
draining the qp right after disconnect might not suffice because
the nvmet sq is not fully drained (in nvmet_sq_destroy) and we might
see completions after the drain. Instead, drain right before the
qp destroy which comes after the sq destruction and we can be sure
that no posts come after the drain.

Tested-by: Steve Wise <swise@opengridcomputing.com>
Signed-off-by: Sagi Grimberg <sagi@grimberg.me>
drivers/nvme/target/rdma.c

index 8c06675c230597374cce222621763a30d61deddf..005ef5d17a191101b3b2da09a0a1c702f5a6c400 100644 (file)
@@ -951,6 +951,7 @@ err_destroy_cq:
 
 static void nvmet_rdma_destroy_queue_ib(struct nvmet_rdma_queue *queue)
 {
+       ib_drain_qp(queue->cm_id->qp);
        rdma_destroy_qp(queue->cm_id);
        ib_free_cq(queue->cq);
 }
@@ -1245,7 +1246,6 @@ static void __nvmet_rdma_queue_disconnect(struct nvmet_rdma_queue *queue)
 
        if (disconnect) {
                rdma_disconnect(queue->cm_id);
-               ib_drain_qp(queue->cm_id->qp);
                schedule_work(&queue->release_work);
        }
 }