aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/nvme/host/core.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index a3771c5729f5..2cbc378bc0d6 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -99,6 +99,7 @@ static struct class *nvme_subsys_class;
99 99
100static void nvme_ns_remove(struct nvme_ns *ns); 100static void nvme_ns_remove(struct nvme_ns *ns);
101static int nvme_revalidate_disk(struct gendisk *disk); 101static int nvme_revalidate_disk(struct gendisk *disk);
102static void nvme_put_subsystem(struct nvme_subsystem *subsys);
102 103
103int nvme_reset_ctrl(struct nvme_ctrl *ctrl) 104int nvme_reset_ctrl(struct nvme_ctrl *ctrl)
104{ 105{
@@ -350,6 +351,7 @@ static void nvme_free_ns_head(struct kref *ref)
350 ida_simple_remove(&head->subsys->ns_ida, head->instance); 351 ida_simple_remove(&head->subsys->ns_ida, head->instance);
351 list_del_init(&head->entry); 352 list_del_init(&head->entry);
352 cleanup_srcu_struct(&head->srcu); 353 cleanup_srcu_struct(&head->srcu);
354 nvme_put_subsystem(head->subsys);
353 kfree(head); 355 kfree(head);
354} 356}
355 357
@@ -2861,6 +2863,9 @@ static struct nvme_ns_head *nvme_alloc_ns_head(struct nvme_ctrl *ctrl,
2861 goto out_cleanup_srcu; 2863 goto out_cleanup_srcu;
2862 2864
2863 list_add_tail(&head->entry, &ctrl->subsys->nsheads); 2865 list_add_tail(&head->entry, &ctrl->subsys->nsheads);
2866
2867 kref_get(&ctrl->subsys->ref);
2868
2864 return head; 2869 return head;
2865out_cleanup_srcu: 2870out_cleanup_srcu:
2866 cleanup_srcu_struct(&head->srcu); 2871 cleanup_srcu_struct(&head->srcu);