Improve error propagation in tree scan code and handle ENOENT and EACCES gracefully#3166
Merged
igaw merged 5 commits intolinux-nvme:masterfrom Mar 11, 2026
Merged
Improve error propagation in tree scan code and handle ENOENT and EACCES gracefully#3166igaw merged 5 commits intolinux-nvme:masterfrom
igaw merged 5 commits intolinux-nvme:masterfrom
Conversation
nvme_ns_get_transport_handle is creating a handle on demand, which can fail. Thus we need to propagate this error case and not blindly access the handle later and cause a NULL pointer access. Signed-off-by: Daniel Wagner <wagi@kernel.org>
The scanning can fail due to missing permissions etc. Thus propagate this error code instead creating invalid objects. Signed-off-by: Daniel Wagner <wagi@kernel.org>
Replace nvme_scan with nvme_scan_topology and ignore any ENOENT and EACCES. Either the nvme module is not loaded/present or the current user might now have permissions to access the device. Signed-off-by: Daniel Wagner <wagi@kernel.org>
7334674 to
efe57a4
Compare
The problem with this function is that it does several things at once which prevents fine grained error handling. And almost every user of this function was not interested in reading a config file. Thus open code this and handle the ENOENT and EACCES case. For the Python binding we just ignore any nvme_scan_topology and nvme_read_config error because this happens inside the global context constructor Signed-off-by: Daniel Wagner <wagi@kernel.org>
The scan helpers should also return the error code instead the generic -1. Fixes: f4c6eee ("rrc: return error codes directly") Signed-off-by: Daniel Wagner <wagi@kernel.org>
Collaborator
Author
|
So this version is no passing a test package build: https://build.opensuse.org/package/show/home:wagi:branches:Base:System/nvme-cli |
This was referenced Mar 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When running the test suite on machine under normal user context, the test might fail because of not enough permissions. While improving the error propagation in the scan code, take the opertunity to handle these errors more gracefully in the tests suites.
Fixes: #3160 #3159 #3155