When fd_type is fd_normal, pollfd needs to be replaced with the actual fd instead of the index#1730
Open
kaolamall wants to merge 1 commit into
Open
When fd_type is fd_normal, pollfd needs to be replaced with the actual fd instead of the index#1730kaolamall wants to merge 1 commit into
kaolamall wants to merge 1 commit into
Conversation
9786441 to
85e37d7
Compare
Member
|
This PR should include only commits which you should merge, so please rebase your PR to the latest master branch and force push result to this pull request. Thanks |
When using rdma-core's preload library, the poll function needs to correctly distinguish between rsocket-managed fds and normal fds. This change ensures that pollfd structures are properly prepared and the call is routed to either the native poll or rpoll based on the actual fd type. Signed-off-by: zhangwenge <zhangwengege@126.com>
shefty
reviewed
May 28, 2026
|
|
||
| ret = rpoll(rfds, nfds, timeout); | ||
| if (!has_rsocket) | ||
| ret = real.poll(rfds, nfds, timeout); |
Contributor
There was a problem hiding this comment.
The existing code does check for a normal fd and calls real.poll() if there are no rsocket fd's. The commit message does not indicate what the error is in the current flow.
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.
In the socket function, when in fork_support mode, a normal socket is created, and the return value is the index, not the socket fd. When polling, the fd passed in the pollfd parameter must be the index, not the actual socket fd. Before calling real.poll, the fd in pollfd is not replaced with the actual socket fd, so real.poll cannot poll for the correct event.
In the socket function:
if (fork_support && (domain == PF_INET || domain == PF_INET6) &&
(type == SOCK_STREAM) && (!protocol || protocol == IPPROTO_TCP)) {
ret = real.socket(domain, type, protocol);
if (ret < 0)
return ret;
fd_store(index, ret, fd_normal, fd_fork);
return index; //Here return the index, not real socket fd.
}
In the poll function:
for (i = 0; i < nfds; i++) {
if (fd_gett(fds[i].fd) == fd_rsocket) // If only fd_normal is present in fds, real.poll will be called, and the fd in fds is not a real socket fd
goto use_rpoll;
}
return real.poll(fds, nfds, timeout);