diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index 8e47ab173..2286c5b0d 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -732,30 +732,26 @@ spdk_iscsi_conn_read_data(struct spdk_iscsi_conn *conn, int bytes, if (ret > 0) { spdk_trace_record(TRACE_READ_FROM_SOCKET_DONE, conn->id, ret, 0, 0); + return ret; } if (ret < 0) { if (errno == EAGAIN || errno == EWOULDBLOCK) { return 0; - } else { - /* For connect reset issue, do not output error log */ - if (errno == ECONNRESET) { - SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "spdk_sock_recv() failed, errno %d: %s\n", - errno, spdk_strerror(errno)); - } else { - SPDK_ERRLOG("spdk_sock_recv() failed, errno %d: %s\n", - errno, spdk_strerror(errno)); - } } - return SPDK_ISCSI_CONNECTION_FATAL; + + /* For connect reset issue, do not output error log */ + if (errno == ECONNRESET) { + SPDK_DEBUGLOG(SPDK_LOG_ISCSI, "spdk_sock_recv() failed, errno %d: %s\n", + errno, spdk_strerror(errno)); + } else { + SPDK_ERRLOG("spdk_sock_recv() failed, errno %d: %s\n", + errno, spdk_strerror(errno)); + } } /* connection closed */ - if (ret == 0) { - return SPDK_ISCSI_CONNECTION_FATAL; - } - - return ret; + return SPDK_ISCSI_CONNECTION_FATAL; } void