Commit 71fc8162 authored by Ziye Yang's avatar Ziye Yang Committed by Tomasz Zawadzki
Browse files

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: default avatarZiye Yang <ziye.yang@intel.com>
Change-Id: I56d34000344ae452a25b82952c831f09e0266d66
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/1448


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
parent 4faa7b58
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
#include "spdk/pipe.h"
#include "spdk/sock.h"
#include "spdk/util.h"
#include "spdk/likely.h"
#include "spdk_internal/sock.h"

#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);
#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;
}

@@ -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);
			sock->pending_recv = false;
		}
		assert(sock->pending_recv == false);
	}

#if defined(__linux__)