diff options
Diffstat (limited to 'drivers/nvme/host/core.c')
-rw-r--r-- | drivers/nvme/host/core.c | 14 |
1 files changed, 3 insertions, 11 deletions
diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index 0fe7ea35c221..7aeca5db7916 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c | |||
@@ -2844,7 +2844,7 @@ out: | |||
2844 | } | 2844 | } |
2845 | 2845 | ||
2846 | static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid, | 2846 | static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid, |
2847 | struct nvme_id_ns *id, bool *new) | 2847 | struct nvme_id_ns *id) |
2848 | { | 2848 | { |
2849 | struct nvme_ctrl *ctrl = ns->ctrl; | 2849 | struct nvme_ctrl *ctrl = ns->ctrl; |
2850 | bool is_shared = id->nmic & (1 << 0); | 2850 | bool is_shared = id->nmic & (1 << 0); |
@@ -2860,8 +2860,6 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid, | |||
2860 | ret = PTR_ERR(head); | 2860 | ret = PTR_ERR(head); |
2861 | goto out_unlock; | 2861 | goto out_unlock; |
2862 | } | 2862 | } |
2863 | |||
2864 | *new = true; | ||
2865 | } else { | 2863 | } else { |
2866 | struct nvme_ns_ids ids; | 2864 | struct nvme_ns_ids ids; |
2867 | 2865 | ||
@@ -2873,8 +2871,6 @@ static int nvme_init_ns_head(struct nvme_ns *ns, unsigned nsid, | |||
2873 | ret = -EINVAL; | 2871 | ret = -EINVAL; |
2874 | goto out_unlock; | 2872 | goto out_unlock; |
2875 | } | 2873 | } |
2876 | |||
2877 | *new = false; | ||
2878 | } | 2874 | } |
2879 | 2875 | ||
2880 | list_add_tail(&ns->siblings, &head->list); | 2876 | list_add_tail(&ns->siblings, &head->list); |
@@ -2945,7 +2941,6 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) | |||
2945 | struct nvme_id_ns *id; | 2941 | struct nvme_id_ns *id; |
2946 | char disk_name[DISK_NAME_LEN]; | 2942 | char disk_name[DISK_NAME_LEN]; |
2947 | int node = dev_to_node(ctrl->dev), flags = GENHD_FL_EXT_DEVT; | 2943 | int node = dev_to_node(ctrl->dev), flags = GENHD_FL_EXT_DEVT; |
2948 | bool new = true; | ||
2949 | 2944 | ||
2950 | ns = kzalloc_node(sizeof(*ns), GFP_KERNEL, node); | 2945 | ns = kzalloc_node(sizeof(*ns), GFP_KERNEL, node); |
2951 | if (!ns) | 2946 | if (!ns) |
@@ -2971,7 +2966,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) | |||
2971 | if (id->ncap == 0) | 2966 | if (id->ncap == 0) |
2972 | goto out_free_id; | 2967 | goto out_free_id; |
2973 | 2968 | ||
2974 | if (nvme_init_ns_head(ns, nsid, id, &new)) | 2969 | if (nvme_init_ns_head(ns, nsid, id)) |
2975 | goto out_free_id; | 2970 | goto out_free_id; |
2976 | nvme_setup_streams_ns(ctrl, ns); | 2971 | nvme_setup_streams_ns(ctrl, ns); |
2977 | 2972 | ||
@@ -3037,9 +3032,7 @@ static void nvme_alloc_ns(struct nvme_ctrl *ctrl, unsigned nsid) | |||
3037 | pr_warn("%s: failed to register lightnvm sysfs group for identification\n", | 3032 | pr_warn("%s: failed to register lightnvm sysfs group for identification\n", |
3038 | ns->disk->disk_name); | 3033 | ns->disk->disk_name); |
3039 | 3034 | ||
3040 | if (new) | 3035 | nvme_mpath_add_disk(ns->head); |
3041 | nvme_mpath_add_disk(ns->head); | ||
3042 | nvme_mpath_add_disk_links(ns); | ||
3043 | return; | 3036 | return; |
3044 | out_unlink_ns: | 3037 | out_unlink_ns: |
3045 | mutex_lock(&ctrl->subsys->lock); | 3038 | mutex_lock(&ctrl->subsys->lock); |
@@ -3059,7 +3052,6 @@ static void nvme_ns_remove(struct nvme_ns *ns) | |||
3059 | return; | 3052 | return; |
3060 | 3053 | ||
3061 | if (ns->disk && ns->disk->flags & GENHD_FL_UP) { | 3054 | if (ns->disk && ns->disk->flags & GENHD_FL_UP) { |
3062 | nvme_mpath_remove_disk_links(ns); | ||
3063 | sysfs_remove_group(&disk_to_dev(ns->disk)->kobj, | 3055 | sysfs_remove_group(&disk_to_dev(ns->disk)->kobj, |
3064 | &nvme_ns_id_attr_group); | 3056 | &nvme_ns_id_attr_group); |
3065 | if (ns->ndev) | 3057 | if (ns->ndev) |