[PATCH nvme-cli] fix path->nentry bugs

Chaitanya Kulkarni chaitanyak at nvidia.com
Thu Sep 9 09:19:05 PDT 2021


On 9/9/21 7:57 AM, chengjike wrote:
> The "path->nentry" is initialized after it is added to the list in "nvme_subsystem_set_path_ns" function.
> 

Overally long commit message, plz send.

> Signed-off-by: chengjike <chengjike.cheng at huawei.com>
> ---
>   src/nvme/tree.c | 2 +-
>   1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/src/nvme/tree.c b/src/nvme/tree.c
> index 49815db..293b0c0 100644
> --- a/src/nvme/tree.c
> +++ b/src/nvme/tree.c
> @@ -534,7 +534,6 @@ static int nvme_ctrl_scan_path(struct nvme_ctrl *c, char *name)
>   	p->name = strdup(name);
>   	p->sysfs_dir = path;
>   	p->ana_state = nvme_get_path_attr(p, "ana_state");
> -	nvme_subsystem_set_path_ns(c->s, p);
>   
>   	grpid = nvme_get_path_attr(p, "ana_grpid");
>   	if (grpid) {
> @@ -543,6 +542,7 @@ static int nvme_ctrl_scan_path(struct nvme_ctrl *c, char *name)
>   	}
>   
>   	list_node_init(&p->nentry);
> +	nvme_subsystem_set_path_ns(c->s, p);
>   	list_node_init(&p->entry);
>   	list_add(&c->paths, &p->entry);
>   	return 0;
> 


More information about the Linux-nvme mailing list