From c66275c0755520052162ac7065e80a552222e15b Mon Sep 17 00:00:00 2001 From: Jeffry Molanus Date: Wed, 9 Sep 2020 12:41:01 +0200 Subject: [PATCH] lib/sock: do not fail spdk_sock_flush() on ENOBUFS When net.core.optmem_max is not set high enough, a call to sendmsg() might fail with ENOBUFS. Currently this is treated as an error. When we have no more buffer space left, we should continue to process any completions and by doing so, free up the auxiliary buffers we ran out of. With this change I was able to run perf against the spdk target with a purposely set to a low, value of optmem_max, where previously it would fail. This fixes github issue #1592 Signed-off-by: Jeffry Molanus Change-Id: Ieeeed4fbecd827d0da815456b57fbe81495fe54d Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4129 Tested-by: SPDK CI Jenkins Reviewed-by: Ben Walker Reviewed-by: Shuhei Matsumoto Reviewed-by: Jim Harris Reviewed-by: Aleksey Marchuk --- module/sock/posix/posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/module/sock/posix/posix.c b/module/sock/posix/posix.c index 0db20dd27..78a146cc7 100644 --- a/module/sock/posix/posix.c +++ b/module/sock/posix/posix.c @@ -801,7 +801,7 @@ _sock_flush(struct spdk_sock *sock) } rc = sendmsg(psock->fd, &msg, flags); if (rc <= 0) { - if (errno == EAGAIN || errno == EWOULDBLOCK) { + if (errno == EAGAIN || errno == EWOULDBLOCK || (errno == ENOBUFS && psock->zcopy)) { return 0; } return rc;