]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commitdiff
nvme: consolidate common code from ->reset_work
authorChristoph Hellwig <hch@lst.de>
Sun, 29 Oct 2017 08:44:31 +0000 (10:44 +0200)
committerChristoph Hellwig <hch@lst.de>
Wed, 1 Nov 2017 15:28:06 +0000 (16:28 +0100)
No change in behavior except that the FC code cancels two work items a
little later now.

Signed-off-by: Christoph Hellwig <hch@lst.de>
Reviewed-by: Sagi Grimberg <sagi@grimberg.me>
Reviewed-by: James Smart <james.smart@broadcom.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
drivers/nvme/host/core.c
drivers/nvme/host/fc.c
drivers/nvme/host/rdma.c
drivers/nvme/target/loop.c

index d835ac05bbf7b36ea39cf4c9508916ae86affda9..4fa748c9a3f6de3c98dfaa02f65c366ed3d19eb2 100644 (file)
@@ -102,7 +102,11 @@ static void nvme_delete_ctrl_work(struct work_struct *work)
        struct nvme_ctrl *ctrl =
                container_of(work, struct nvme_ctrl, delete_work);
 
+       nvme_stop_ctrl(ctrl);
+       nvme_remove_namespaces(ctrl);
        ctrl->ops->delete_ctrl(ctrl);
+       nvme_uninit_ctrl(ctrl);
+       nvme_put_ctrl(ctrl);
 }
 
 int nvme_delete_ctrl(struct nvme_ctrl *ctrl)
index a7bdb17de29d470ff609cd2d74bfee5f46407523..e447b532b9ee85f2ffb847bec435dabd0092b3ed 100644 (file)
@@ -2640,24 +2640,11 @@ nvme_fc_delete_ctrl(struct nvme_ctrl *nctrl)
 
        cancel_work_sync(&ctrl->ctrl.reset_work);
        cancel_delayed_work_sync(&ctrl->connect_work);
-       nvme_stop_ctrl(&ctrl->ctrl);
-       nvme_remove_namespaces(&ctrl->ctrl);
        /*
         * kill the association on the link side.  this will block
         * waiting for io to terminate
         */
        nvme_fc_delete_association(ctrl);
-
-       /*
-        * tear down the controller
-        * After the last reference on the nvme ctrl is removed,
-        * the transport nvme_fc_nvme_ctrl_freed() callback will be
-        * invoked. From there, the transport will tear down it's
-        * logical queues and association.
-        */
-       nvme_uninit_ctrl(&ctrl->ctrl);
-
-       nvme_put_ctrl(&ctrl->ctrl);
 }
 
 static void
index a3521b852ea85f1fb1d6650fa2c5b8f1109116d0..ed6e05018a92259ce4e38ca140564956c50d30ec 100644 (file)
@@ -1757,11 +1757,7 @@ static void nvme_rdma_shutdown_ctrl(struct nvme_rdma_ctrl *ctrl, bool shutdown)
 
 static void nvme_rdma_delete_ctrl(struct nvme_ctrl *ctrl)
 {
-       nvme_stop_ctrl(ctrl);
-       nvme_remove_namespaces(ctrl);
        nvme_rdma_shutdown_ctrl(to_rdma_ctrl(ctrl), true);
-       nvme_uninit_ctrl(ctrl);
-       nvme_put_ctrl(ctrl);
 }
 
 static void nvme_rdma_reset_ctrl_work(struct work_struct *work)
index 7f9f3fc3fb2a8b4a0616a4677c6232bbaa84135b..bc95c6ed531af58d126d919290dcb4a108d62d2e 100644 (file)
@@ -440,11 +440,7 @@ static void nvme_loop_shutdown_ctrl(struct nvme_loop_ctrl *ctrl)
 
 static void nvme_loop_delete_ctrl_host(struct nvme_ctrl *ctrl)
 {
-       nvme_stop_ctrl(ctrl);
-       nvme_remove_namespaces(ctrl);
        nvme_loop_shutdown_ctrl(to_loop_ctrl(ctrl));
-       nvme_uninit_ctrl(ctrl);
-       nvme_put_ctrl(ctrl);
 }
 
 static void nvme_loop_delete_ctrl(struct nvmet_ctrl *nctrl)