read_fd_message: distinguish prints of log message

When VM shutdown there will be an error message 'VHOST_CONFIG: recvmsg failed' printed.
The return value of recvmsg will be 0 when the peer has performed an orderly shutdown,
or -1 if an error occurred. So adding logs to distinguish these two different situations
to avoid confusing and to hint accurately.

Signed-off-by: Dayu Liu <liu.dayu@zte.com.cn>
Change-Id: Ia4b806a11d3c6ddf076c61d1caad4fa7b16fb9b5
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/2557
Community-CI: Mellanox Build Bot
Reviewed-by: Changpeng Liu <changpeng.liu@intel.com>
Reviewed-by: Aleksey Marchuk <alexeymar@mellanox.com>
Reviewed-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>
Tested-by: SPDK CI Jenkins <sys_sgci@intel.com>
This commit is contained in:
Dayu Liu 2020-05-21 09:22:00 +08:00 committed by Tomasz Zawadzki
parent a9430856b6
commit b8ac3e8acd

View File

@ -137,7 +137,10 @@ read_fd_message(int sockfd, char *buf, int buflen, int *fds, int fd_num)
ret = recvmsg(sockfd, &msgh, 0);
if (ret <= 0) {
RTE_LOG(ERR, VHOST_CONFIG, "recvmsg failed\n");
if (ret)
RTE_LOG(ERR, VHOST_CONFIG, "recvmsg failed, %s\n", strerror(errno));
else
RTE_LOG(INFO, VHOST_CONFIG, "peer closed\n");
return ret;
}