Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
home:dirkmueller:acdc:as_python3_module
nvme-cli.26591
0012-fabrics-Avoid-nvme_scan_ctrl-when-disconne...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0012-fabrics-Avoid-nvme_scan_ctrl-when-disconnecting.patch of Package nvme-cli.26591
From: Daniel Wagner <dwagner@suse.de> Date: Tue, 19 Jul 2022 11:53:12 +0200 Subject: fabrics: Avoid nvme_scan_ctrl when disconnecting Git-commit: 40d7cc0050d0c0dd06ac76880c2a81ecf25eb796 References: git-fixes In certain corner cases, the kernel will not populate a nvme subsystem but only create a nvme controller. nvme_scan_ctrl will fail in such scenarios to find the controller object. Let's do the lookup based on the ctrl name only. Signed-off-by: Daniel Wagner <dwagner@suse.de> --- fabrics.c | 22 +++++++++++++++++++--- 1 file changed, 19 insertions(+), 3 deletions(-) --- a/fabrics.c +++ b/fabrics.c @@ -902,6 +902,23 @@ int nvmf_connect(const char *desc, int a return errno; } +static nvme_ctrl_t lookup_nvme_ctrl(nvme_root_t r, const char *name) +{ + nvme_host_t h; + nvme_subsystem_t s; + nvme_ctrl_t c; + + nvme_for_each_host(r, h) { + nvme_for_each_subsystem(h, s) { + nvme_subsystem_for_each_ctrl(s, c) { + if (!strcmp(nvme_ctrl_get_name(c), name)) + return c; + } + } + } + return NULL; +} + int nvmf_disconnect(const char *desc, int argc, char **argv) { const char *device = "nvme device handle"; @@ -979,11 +996,10 @@ int nvmf_disconnect(const char *desc, in while ((p = strsep(&d, ",")) != NULL) { if (!strncmp(p, "/dev/", 5)) p += 5; - c = nvme_scan_ctrl(r, p); + c = lookup_nvme_ctrl(r, p); if (!c) { fprintf(stderr, - "Did not find device %s: %s\n", - p, nvme_strerror(errno)); + "Did not find device %s\n", p); nvme_free_tree(r); return errno; }
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