[PATCH] nvme-rdma: flush async events before freeing qe
Sagi Grimberg
sagi at grimberg.me
Mon Aug 31 16:52:20 EDT 2020
> Flush async event workqueue in case async event has been
> queued up before freeing qe and setting ctrl->async_event_sqe.data
> to NULL. Otherwise, we can get into a state were nvme_rdma_submit_
> async_event() runs with sqe->data set to NULL leading to crash.
>
> Signed-off-by: David Milburn <dmilburn at redhat.com>
> ---
> drivers/nvme/host/rdma.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/drivers/nvme/host/rdma.c b/drivers/nvme/host/rdma.c
> index 8e5ffe2f117d..76f117462d5b 100644
> --- a/drivers/nvme/host/rdma.c
> +++ b/drivers/nvme/host/rdma.c
> @@ -835,6 +835,7 @@ static void nvme_rdma_destroy_admin_queue(struct nvme_rdma_ctrl *ctrl,
> blk_mq_free_tag_set(ctrl->ctrl.admin_tagset);
> }
> if (ctrl->async_event_sqe.data) {
> + flush_work(&ctrl->ctrl.async_event_work);
> nvme_rdma_free_qe(ctrl->device->dev, &ctrl->async_event_sqe,
> sizeof(struct nvme_command), DMA_TO_DEVICE);
> ctrl->async_event_sqe.data = NULL;
Why not cancel the work?
I also think that we will want to have this in nvme-core, not
specifically to nvme-rdma?
More information about the Linux-nvme
mailing list