Commit c66275c0 authored by Jeffry Molanus's avatar Jeffry Molanus Committed by Tomasz Zawadzki
Browse files

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: default avatarJeffry Molanus <jeffry.molanus@gmail.com>
Change-Id: Ieeeed4fbecd827d0da815456b57fbe81495fe54d
Reviewed-on: https://review.spdk.io/gerrit/c/spdk/spdk/+/4129


Tested-by: default avatarSPDK CI Jenkins <sys_sgci@intel.com>
Reviewed-by: default avatarBen Walker <benjamin.walker@intel.com>
Reviewed-by: default avatarShuhei Matsumoto <shuhei.matsumoto.xt@hitachi.com>
Reviewed-by: default avatarJim Harris <james.r.harris@intel.com>
Reviewed-by: default avatarAleksey Marchuk <alexeymar@mellanox.com>
parent e4ff3a5b
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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;