diff options
author | Max Gurtovoy <maxg@mellanox.com> | 2019-03-28 06:54:03 -0400 |
---|---|---|
committer | Christoph Hellwig <hch@lst.de> | 2019-03-28 13:15:03 -0400 |
commit | a536b49785759bf99465fdf6e248d34322123fcd (patch) | |
tree | 530e42e14e8bc687563cd3f9743026eaa58fecd5 | |
parent | 02db99548d3608a625cf481cff2bb7b626829b3f (diff) |
nvmet: fix error flow during ns enable
In case we fail to enable p2pmem on the current namespace, disable the
backing store device before exiting.
Cc: Stephen Bates <sbates@raithlin.com>
Signed-off-by: Max Gurtovoy <maxg@mellanox.com>
Signed-off-by: Christoph Hellwig <hch@lst.de>
-rw-r--r-- | drivers/nvme/target/core.c | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/drivers/nvme/target/core.c b/drivers/nvme/target/core.c index 2d73b66e3686..b3e765a95af8 100644 --- a/drivers/nvme/target/core.c +++ b/drivers/nvme/target/core.c | |||
@@ -509,7 +509,7 @@ int nvmet_ns_enable(struct nvmet_ns *ns) | |||
509 | 509 | ||
510 | ret = nvmet_p2pmem_ns_enable(ns); | 510 | ret = nvmet_p2pmem_ns_enable(ns); |
511 | if (ret) | 511 | if (ret) |
512 | goto out_unlock; | 512 | goto out_dev_disable; |
513 | 513 | ||
514 | list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) | 514 | list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) |
515 | nvmet_p2pmem_ns_add_p2p(ctrl, ns); | 515 | nvmet_p2pmem_ns_add_p2p(ctrl, ns); |
@@ -550,7 +550,7 @@ out_unlock: | |||
550 | out_dev_put: | 550 | out_dev_put: |
551 | list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) | 551 | list_for_each_entry(ctrl, &subsys->ctrls, subsys_entry) |
552 | pci_dev_put(radix_tree_delete(&ctrl->p2p_ns_map, ns->nsid)); | 552 | pci_dev_put(radix_tree_delete(&ctrl->p2p_ns_map, ns->nsid)); |
553 | 553 | out_dev_disable: | |
554 | nvmet_ns_dev_disable(ns); | 554 | nvmet_ns_dev_disable(ns); |
555 | goto out_unlock; | 555 | goto out_unlock; |
556 | } | 556 | } |