Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

nvme: do not issue warning when nvme_core module is not loaded #2250

Merged
merged 1 commit into from
Mar 19, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 18 additions & 12 deletions fabrics.c
Original file line number Diff line number Diff line change
Expand Up @@ -728,8 +728,9 @@ int nvmf_discover(const char *desc, int argc, char **argv, bool connect)
nvme_root_set_application(r, context);
ret = nvme_scan_topology(r, NULL, NULL);
if (ret < 0) {
fprintf(stderr, "Failed to scan topology: %s\n",
nvme_strerror(errno));
if (errno != ENOENT)
fprintf(stderr, "Failed to scan topology: %s\n",
nvme_strerror(errno));
Comment on lines +731 to +733
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry if I was unclear in #2241. I don't really have a problem with the warning message. The main issue is that the commands fail on nvme-cli 2.x where it succeeds on 1.x, which I don't think this change addresses. I think the correct fix is for nvme_scan_topology() not to return an error in the ENOENT case.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it would actually be preferable to keep the error message. If the command fails, the user should know why. I posted linux-nvme/libnvme#795 to avoid nvme_scan_topology() returning this error in the first place when nvme_core isn't loaded. So I think we can revert this change.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

And I think linux-nvme/libnvme#795 is just the wrong thing to do

nvme_free_tree(r);
return ret;
}
Expand Down Expand Up @@ -958,8 +959,9 @@ int nvmf_connect(const char *desc, int argc, char **argv)
nvme_root_set_application(r, context);
ret = nvme_scan_topology(r, NULL, NULL);
if (ret < 0) {
fprintf(stderr, "Failed to scan topology: %s\n",
nvme_strerror(errno));
if (errno != ENOENT)
fprintf(stderr, "Failed to scan topology: %s\n",
nvme_strerror(errno));
nvme_free_tree(r);
return ret;
}
Expand Down Expand Up @@ -1118,8 +1120,9 @@ int nvmf_disconnect(const char *desc, int argc, char **argv)
}
ret = nvme_scan_topology(r, NULL, NULL);
if (ret < 0) {
fprintf(stderr, "Failed to scan topology: %s\n",
nvme_strerror(errno));
if (errno != ENOENT)
fprintf(stderr, "Failed to scan topology: %s\n",
nvme_strerror(errno));
nvme_free_tree(r);
return ret;
}
Expand Down Expand Up @@ -1188,8 +1191,9 @@ int nvmf_disconnect_all(const char *desc, int argc, char **argv)
}
ret = nvme_scan_topology(r, NULL, NULL);
if (ret < 0) {
fprintf(stderr, "Failed to scan topology: %s\n",
nvme_strerror(errno));
if (errno != ENOENT)
fprintf(stderr, "Failed to scan topology: %s\n",
nvme_strerror(errno));
nvme_free_tree(r);
return ret;
}
Expand Down Expand Up @@ -1259,8 +1263,9 @@ int nvmf_config(const char *desc, int argc, char **argv)
if (scan_tree) {
ret = nvme_scan_topology(r, NULL, NULL);
if (ret < 0) {
fprintf(stderr, "Failed to scan topology: %s\n",
nvme_strerror(errno));
if (errno != ENOENT)
fprintf(stderr, "Failed to scan topology: %s\n",
nvme_strerror(errno));
nvme_free_tree(r);
return ret;
}
Expand Down Expand Up @@ -1412,8 +1417,9 @@ int nvmf_dim(const char *desc, int argc, char **argv)
}
ret = nvme_scan_topology(r, NULL, NULL);
if (ret < 0) {
fprintf(stderr, "Failed to scan topology: %s\n",
nvme_strerror(errno));
if (errno != ENOENT)
fprintf(stderr, "Failed to scan topology: %s\n",
nvme_strerror(errno));
nvme_free_tree(r);
return ret;
}
Expand Down
9 changes: 6 additions & 3 deletions nvme.c
Original file line number Diff line number Diff line change
Expand Up @@ -3248,7 +3248,8 @@ static int list_subsys(int argc, char **argv, struct command *cmd,

err = nvme_scan_topology(r, filter, (void *)devname);
if (err) {
nvme_show_error("Failed to scan topology: %s", nvme_strerror(errno));
if (errno != ENOENT)
nvme_show_error("Failed to scan topology: %s", nvme_strerror(errno));
goto ret;
}

Expand Down Expand Up @@ -3289,7 +3290,8 @@ static int list(int argc, char **argv, struct command *cmd, struct plugin *plugi
}
err = nvme_scan_topology(r, NULL, NULL);
if (err < 0) {
nvme_show_error("Failed to scan topology: %s", nvme_strerror(errno));
if (errno != ENOENT)
nvme_show_error("Failed to scan topology: %s", nvme_strerror(errno));
nvme_free_tree(r);
return err;
}
Expand Down Expand Up @@ -8871,7 +8873,8 @@ static int show_topology_cmd(int argc, char **argv, struct command *command, str

err = nvme_scan_topology(r, NULL, NULL);
if (err < 0) {
nvme_show_error("Failed to scan topology: %s", nvme_strerror(errno));
if (errno != ENOENT)
nvme_show_error("Failed to scan topology: %s", nvme_strerror(errno));
nvme_free_tree(r);
return err;
}
Expand Down