posix: Add the socket into pending_recv list if migrated from another polling group.
When the socket is migrated from one polling group to another (e.g., iSCSI target example), we should add it into pending_recv_list Signed-off-by: Ziye Yang <ziye.yang@intel.com> Change-Id: I56d34000344ae452a25b82952c831f09e0266d66 Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1448 Tested-by: SPDK CI Jenkins <sys_sgci@intel.com> Reviewed-by: Ben Walker <benjamin.walker@intel.com> Reviewed-by: Shuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
This commit is contained in:
parent
4faa7b5837
commit
71fc81620f
@ -44,6 +44,7 @@
|
|||||||
#include "spdk/pipe.h"
|
#include "spdk/pipe.h"
|
||||||
#include "spdk/sock.h"
|
#include "spdk/sock.h"
|
||||||
#include "spdk/util.h"
|
#include "spdk/util.h"
|
||||||
|
#include "spdk/likely.h"
|
||||||
#include "spdk_internal/sock.h"
|
#include "spdk_internal/sock.h"
|
||||||
|
|
||||||
#define MAX_TMPBUF 1024
|
#define MAX_TMPBUF 1024
|
||||||
@ -1070,6 +1071,15 @@ spdk_posix_sock_group_impl_add_sock(struct spdk_sock_group_impl *_group, struct
|
|||||||
|
|
||||||
rc = kevent(group->fd, &event, 1, NULL, 0, &ts);
|
rc = kevent(group->fd, &event, 1, NULL, 0, &ts);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
/* switched from another polling group due to scheduling */
|
||||||
|
if (spdk_unlikely(sock->recv_pipe != NULL &&
|
||||||
|
(spdk_pipe_reader_bytes_available(sock->recv_pipe) > 0))) {
|
||||||
|
assert(sock->pending_recv == false);
|
||||||
|
sock->pending_recv = true;
|
||||||
|
TAILQ_INSERT_TAIL(&group->pending_recv, sock, link);
|
||||||
|
}
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1085,6 +1095,7 @@ spdk_posix_sock_group_impl_remove_sock(struct spdk_sock_group_impl *_group, stru
|
|||||||
TAILQ_REMOVE(&group->pending_recv, sock, link);
|
TAILQ_REMOVE(&group->pending_recv, sock, link);
|
||||||
sock->pending_recv = false;
|
sock->pending_recv = false;
|
||||||
}
|
}
|
||||||
|
assert(sock->pending_recv == false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#if defined(__linux__)
|
#if defined(__linux__)
|
||||||
|
Loading…
Reference in New Issue
Block a user