Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:Leap:15.5:Update
libnvme.26472
0018-tree-make-nvme_ctrl_scan_namespace-idempot...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0018-tree-make-nvme_ctrl_scan_namespace-idempotent.patch of Package libnvme.26472
From: Hannes Reinecke <hare@suse.de> Date: Fri, 10 Jun 2022 10:19:01 +0200 Subject: tree: make nvme_ctrl_scan_namespace() idempotent Git-commit: 939345572149559240119c8d0fc97f5e3e906538 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 controller namespace list before adding new ones, ensuring that we only ever have one namespace with a given name in the list of controller namespaces. Signed-off-by: Hannes Reinecke <hare@suse.de> Acked-by: Daniel Wagner <dwagner@suse.de> --- src/nvme/tree.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/src/nvme/tree.c +++ b/src/nvme/tree.c @@ -1860,7 +1860,7 @@ nvme_ns_t nvme_scan_namespace(const char static int nvme_ctrl_scan_namespace(nvme_root_t r, struct nvme_ctrl *c, char *name) { - struct nvme_ns *n; + struct nvme_ns *n, *_n, *__n; nvme_msg(r, LOG_DEBUG, "scan controller %s namespace %s\n", c->name, name); @@ -1874,7 +1874,11 @@ static int nvme_ctrl_scan_namespace(nvme nvme_msg(r, LOG_DEBUG, "failed to scan namespace %s\n", name); return -1; } - + nvme_ctrl_for_each_ns_safe(c, _n, __n) { + if (strcmp(n->name, _n->name)) + continue; + __nvme_free_ns(_n); + } n->s = c->s; n->c = c; list_add(&c->namespaces, &n->entry);
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