]> www.infradead.org Git - users/sagi/libnvme.git/commitdiff
fix path->nentry bugs
authorchengjike <chengjike.cheng@huawei.com>
Thu, 9 Sep 2021 14:57:09 +0000 (22:57 +0800)
committerKeith Busch <kbusch@kernel.org>
Thu, 9 Sep 2021 16:45:45 +0000 (09:45 -0700)
The "path->nentry" is initialized after it is added to the list in
"nvme_subsystem_set_path_ns" function.

Signed-off-by: chengjike <chengjike.cheng@huawei.com>
src/nvme/tree.c

index 49815dba2e28985514ed4e2e0fe35d706945d829..293b0c0a2b086a163f2bd9134034eecef9c759c4 100644 (file)
@@ -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;