[PATCH] nvmet-rdma: recheck queue state is LIVE in state lock in recv done
Ruozhu Li
david.li at jaguarmicro.com
Thu Feb 13 02:06:48 PST 2025
On 2025/02/13 6:20 UTC, Christoph Hellwig wrote:
> > +++ b/drivers/nvme/target/rdma.c
> > @@ -1042,12 +1042,16 @@ static void nvmet_rdma_recv_done(struct ib_cq *cq, struct ib_wc *wc)
> > unsigned long flags;
> >
> > spin_lock_irqsave(&queue->state_lock, flags);
> > - if (queue->state == NVMET_RDMA_Q_CONNECTING)
> > - list_add_tail(&rsp->wait_list, &queue->rsp_wait_list);
> > - else
> > - nvmet_rdma_put_rsp(rsp);
> > + if (queue->state != NVMET_RDMA_Q_LIVE) {
>
> You'll want a comment based on the commit message that the first live check is racy.
Okay, I will add a comment in next version.
>
> > + if (queue->state == NVMET_RDMA_Q_CONNECTING)
> > + list_add_tail(&rsp->wait_list, &queue->rsp_wait_list);
> > + else
> > + nvmet_rdma_put_rsp(rsp);
> > +
> > + spin_unlock_irqrestore(&queue->state_lock, flags);
> > + return;
>
> This gets a bit messy now. What about a struture like this instead?
Looks good to me, I will retest it and send another version soon.
Thanks.
More information about the Linux-nvme
mailing list