[SPDK] Query regarding nvme_tcp_read_data() API.
Senthil Kumar Veluswamy <Senthil.Kumar.Veluswamy at wdc.com> Wed, 24 Nov 2021 15:38:40 +0000
| Newsgroups | dev.linux.lists.spdk |
|---|---|
| Message-ID | <[email protected]> |
Hi,
In the SPDKv20.07, I’ve query on the below code.
In this nvme_tcp_read_data(), if spdk_sock_recv() return “0” i.e. ret = 0, then it treats that condition as FATAL and the caller of nvme_tcp_read_data() i.e. nvmf_tcp_sock_process(), disconnects the connection.
So, would like to know why this condition is treated as FATAL condition and disconnect is issued [as readv() can return ZERO bytes]?
static int
nvme_tcp_read_data(struct spdk_sock *sock, int bytes,
void *buf)
{
int ret;
ret = spdk_sock_recv(sock, buf, bytes);
if (ret > 0) {
return ret;
}
if (ret < 0) {
if (errno == EAGAIN || errno == EWOULDBLOCK) {
return 0;
}
/* For connect reset issue, do not output error log */
if (errno != ECONNRESET) {
SPDK_ERRLOG("spdk_sock_recv() failed, errno %d: %s\n",
errno, spdk_strerror(errno));
}
}
/* connection closed */
return NVME_TCP_CONNECTION_FATAL;
}
Thanks,
Senthil Kumar V.