-
Notifications
You must be signed in to change notification settings - Fork 132
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
Retry discovery log page on DNR #810
Conversation
The ioctl might return 0, but the NVMe status might indicate an error. In these cases we should return EPROTO to indicate that the command did not succeed. Signed-off-by: Hannes Reinecke <[email protected]>
Reading the discovery log page might result in an NVMe status, so we should evaluate the DNR bit to check if it's safe to retry the command. Signed-off-by: Hannes Reinecke <[email protected]>
Update the function documentation to reflect the change in the ioctl return values. Signed-off-by: Hannes Reinecke <[email protected]>
Modify stub functions to correctly update the return values if the ioctl succeeded but an NVMe status was returned. Signed-off-by: Hannes Reinecke <[email protected]>
All 'set features' commands have an 'result' field as the last argument, so add an alternative function nvme_set_features_timestamp2() to follow the same calling convention. Signed-off-by: Hannes Reinecke <[email protected]>
All 'set features' commands have an 'result' field as the last argument, so add an alternative function nvme_set_features_host_behavior2() to follow the same calling convention. Signed-off-by: Hannes Reinecke <[email protected]>
All 'set features' commands have an 'result' field as the last argument, so add an alternative function nvme_set_features_host_id2() to follow the same calling convention. Signed-off-by: Hannes Reinecke <[email protected]>
All 'set features' commands have an 'result' field as the last argument, so add an alternative function nvme_set_features_iocs_profile2() to follow the same calling convention. Signed-off-by: Hannes Reinecke <[email protected]>
All 'get features' commands have an 'result' field as the last argument, so add an alternative function nvme_get_features_timestamp2() to follow the same calling convention. Signed-off-by: Hannes Reinecke <[email protected]>
All 'get features' commands have an 'result' field as the last argument, so add an alternative function nvme_get_features_host_id2() to follow the same calling convention. Signed-off-by: Hannes Reinecke <[email protected]>
Documentation states that the NVMe status code should be returned, to fix up the code to actually do it. Signed-off-by: Hannes Reinecke <[email protected]>
Quite a mess with the nvme status and ioctl return values. Looks way saner now. Thanks! |
@@ -1113,6 +1122,9 @@ static struct nvmf_discovery_log *nvme_discovery_log( | |||
nvme_msg(r, LOG_INFO, | |||
"%s: discover try %d/%d failed, error %d\n", | |||
name, retries, args->max_retries, errno); | |||
if (*log_args.result && | |||
!(*log_args.result & NVME_SC_DNR)) | |||
continue; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
continue
in a do
-while
loop jumps to the while
condition: while (genctr != le64_to_cpu(log->genctr) && ++retries < args->max_retries);
. Is accessing the header valid valid if the command returned an error status? Presumably no data would have been transferred in that case.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There were some nasty surprises with this series. I've reverted the whole series for now.
The ioctl to issue an NVMe command might complete successfully, but that does not indicate that the command itself was successful. The CQE (ie the 'result' parameter) might be set to indicate the the NVMe command returned with an error.
In these cases we should not return '0' from the ioctl, but rather set 'EPROTO' to indicate that somthing has failed.
This then can be used when reading the discovery log page to check if it's safe to re-read the log page or if one should abort.