Nvme over fabrics controller reset issue

Sagi Grimberg sagi at grimberg.me
Thu Mar 22 12:08:44 PDT 2018


> Hi All,
> 
> I found a strange behaviour when I used NVMe Fabrics target.  From
> Host I sent a Set property command to make CC.EN=0. And then again I
> made CC.EN=1. I was expecting all the transport and nvme queus will be
> deleted. But didn't happen, rather queus are retained connection is
> still active.
> 
>   Isn't violation of NVMe spec. Is there any reason for implementing this way?

No good reason, just an oversight I guess..

Does this (untested) patch get it right?
--
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c
index fa2a02c6f0c6..c01490c924bd 100644
--- a/drivers/nvme/target/core.c
+++ b/drivers/nvme/target/core.c
@@ -637,9 +637,11 @@ static void nvmet_clear_ctrl(struct nvmet_ctrl *ctrl)
  {
         lockdep_assert_held(&ctrl->lock);

-       /* XXX: tear down queues? */
         ctrl->csts &= ~NVME_CSTS_RDY;
         ctrl->cc = 0;
+
+       /* tear down controller queues (or what's left of them) */
+       ctrl->ops->delete_ctrl(ctrl);
  }

  void nvmet_update_cc(struct nvmet_ctrl *ctrl, u32 new)
--



More information about the Linux-nvme mailing list