[SPDK] Re: Query regarding nvme_tcp_read_data() API.

松本周平 / MATSUMOTO,SHUUHE I <shuhei.matsumoto.xt at hitachi.com> Wed, 24 Nov 2021 21:05:41 +0000
Newsgroups dev.linux.lists.spdk
Message-ID <TYAPR01MB47341AA7F4331701CEBCEB95A2619@TYAPR01MB4734.jpnprd01.prod.outlook.com>
Hi Senthil,

Return value zero indicates the other peer closed the connection or requested zero byte read. It is not likely to request zero byte read. So this may not be fatal error but closing the connection is correct.

Others will correct me if I am wrong.
So you may be better to wait for more replies :)

Thanks,
Shuhei
________________________________
From: Senthil Kumar Veluswamy <Senthil.Kumar.Veluswamy(a)wdc.com>
Sent: Thursday, November 25, 2021 12:38:40 AM
To: Storage Performance Development Kit <spdk(a)lists.01.org>
Subject: [SPDK] Query regarding nvme_tcp_read_data() API.

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.
_______________________________________________
SPDK mailing list -- spdk(a)lists.01.org
To unsubscribe send an email to spdk-leave(a)lists.01.org