test/open-direct-link: fix sporadic -EBADF failure#1621
Merged
Conversation
The test runs consecutive test iterations that chain openat_direct,
read, and close_direct operations. Some iterations, like test(1, 0, 0)
where skip_success=1, configure the openat and close operations to skip
producing CQEs upon success. As a result, the test suite only waits on
the CQE generated by the read operation before proceeding to the next
test run.
Because the previous iteration's close_direct might still be in-flight
or deferred to task_work, and all iterations were hardcoding file index
0, a race condition occurs: an asynchronous close_direct from a prior
test run can inadvertently close the newly installed file from a
subsequent test run. This causes the newly submitted read operation to
unexpectedly fail with -EBADF ("bad read -9").
Fix this by passing an incrementally unique file_idx to each test
iteration. This isolates the test iterations and prevents them from
racing over the same fixed file descriptor slot.
Signed-off-by: Florian Schmaus <florian.schmaus@codasip.com>
Contributor
Author
Owner
|
Sorry, a bit behind, vacation and still on vacation. Both those look good too, merged. |
Contributor
Author
No worries. Thanks for merging and enjoy your vacation. |
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.
The test runs consecutive test iterations that chain openat_direct, read, and close_direct operations. Some iterations, like test(1, 0, 0) where skip_success=1, configure the openat and close operations to skip producing CQEs upon success. As a result, the test suite only waits on the CQE generated by the read operation before proceeding to the next test run.
Because the previous iteration's close_direct might still be in-flight or deferred to task_work, and all iterations were hardcoding file index 0, a race condition occurs: an asynchronous close_direct from a prior test run can inadvertently close the newly installed file from a subsequent test run. This causes the newly submitted read operation to unexpectedly fail with -EBADF ("bad read -9").
Fix this by passing an incrementally unique file_idx to each test iteration. This isolates the test iterations and prevents them from racing over the same fixed file descriptor slot.