Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Step:FrontRunner
libnvme.26914
0017-tree-make-nvme_subsystem_scan_namespace-id...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0017-tree-make-nvme_subsystem_scan_namespace-idempotent.patch of Package libnvme.26914
From: Hannes Reinecke <hare@suse.de> Date: Fri, 10 Jun 2022 10:19:01 +0200 Subject: tree: make nvme_subsystem_scan_namespace() idempotent Git-commit: 70946ce055892869730f9a19a0f0e73e85fbaa13 References: git-fixes When issuing a rescan the list of namespaces is not cleared, so just blindly adding new entries might not yield the expected result. This patch clears out old entries from the subsystem namespace list before adding new ones, ensuring that we only ever have one namespace with a given name in the list of subsystem namespaces. Signed-off-by: Hannes Reinecke <hare@suse.de> Acked-by: Daniel Wagner <dwagner@suse.de> --- src/nvme/tree.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) --- a/src/nvme/tree.c +++ b/src/nvme/tree.c @@ -1910,7 +1910,7 @@ static void nvme_subsystem_set_ns_path(n static int nvme_subsystem_scan_namespace(nvme_root_t r, nvme_subsystem_t s, char *name, nvme_scan_filter_t f, void *f_args) { - struct nvme_ns *n; + struct nvme_ns *n, *_n, *__n; nvme_msg(r, LOG_DEBUG, "scan subsystem %s namespace %s\n", s->name, name); @@ -1924,6 +1924,19 @@ static int nvme_subsystem_scan_namespace __nvme_free_ns(n); return 0; } + nvme_subsystem_for_each_ns_safe(s, _n, __n) { + struct nvme_path *p, *_p; + + if (strcmp(n->name, _n->name)) + continue; + /* Detach paths */ + nvme_namespace_for_each_path_safe(_n, p, _p) { + list_del_init(&p->nentry); + p->n = NULL; + } + list_head_init(&_n->paths); + __nvme_free_ns(_n); + } n->s = s; list_add(&s->namespaces, &n->entry); nvme_subsystem_set_ns_path(s, n);
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor