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

fabrics: fix incorrect access filename check #2481

Merged
merged 1 commit into from
Sep 16, 2024

Conversation

martin-gpy
Copy link
Contributor

Config JSON file handling is currently broken due to an incorrect access filename check. Fix it.

@igaw
Copy link
Collaborator

igaw commented Sep 9, 2024

Can you elaborate what you are doing. I am pretty sure I added this on purpose during my testing. So what did I miss?

@martin-gpy
Copy link
Contributor Author

Can you elaborate what you are doing. I am pretty sure I added this on purpose during my testing. So what did I miss?

Well, I was just passing the JSON config file using the -J option to the nvme connect-all command, which ended up failing:

nvme connect-all -J <filename>

Turns out access returns a zero if the filename exists & non-zero if otherwise. So this current check actually returns an ENOENT if the JSON file exists:

if (!access(filename, F_OK)) return -ENOENT;

So all one needs to do is switch the check to make this work, and that's what this patch does:

if (access(filename, F_OK)) return -ENOENT;

@igaw
Copy link
Collaborator

igaw commented Sep 16, 2024

Ah, I think I figured out why I didn't see any problem during my testing. I only tested with connect which doesn't use this function for checking if there is config. So this one makes sense.

We might also return errno; I'll update the patch accordingly.

Config JSON file handling is currently broken due to an incorrect
access filename check. Fix it.

Signed-off-by: Martin George <[email protected]>
@igaw igaw merged commit 53f2b1a into linux-nvme:master Sep 16, 2024
17 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants