misleading/wrong keep-alive error message in log

Gluster NFS and brick logs contain the following log entries:

[2012-08-16 09:23:39.498998] W [socket.c:410:__socket_keepalive] 0-socket: failed to set keep idle on socket 8
[2012-08-16 09:23:39.499049] W [socket.c:1876:socket_server_event_handler] 0-socket.glusterfsd: Failed to set keep-alive: Operation not supported
[2012-08-16 09:23:42.673756] I [client-handshake.c:1636:select_server_supported_

Stepping through the code though, setting keep-alive did actually work,
it's the keep-idle that failed.

The actual problem is setting keep-idle on non-AF_INET sockets results
in the spurious error message in the log.

BUG: 848882
Change-Id: I3a54c96aea0642307f17a7945cca9f9438543243
Signed-off-by: Kaleb S. KEITHLEY <kkeithle@redhat.com>
Reviewed-on: http://review.gluster.com/3823
Reviewed-by: Amar Tumballi <amarts@redhat.com>
Tested-by: Gluster Build System <jenkins@build.gluster.com>
Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
Reviewed-by: Anand Avati <avati@redhat.com>
This commit is contained in:
Kaleb S. KEITHLEY 2012-08-16 13:27:00 -04:00 committed by Anand Avati
parent 6930c6950f
commit 623dbe5afc

View File

@ -594,7 +594,7 @@ __socket_nodelay (int fd)
static int
__socket_keepalive (int fd, int keepalive_intvl, int keepalive_idle)
__socket_keepalive (int fd, int family, int keepalive_intvl, int keepalive_idle)
{
int on = 1;
int ret = -1;
@ -623,18 +623,23 @@ __socket_keepalive (int fd, int keepalive_intvl, int keepalive_idle)
goto err;
}
#else
if (family != AF_INET)
goto done;
ret = setsockopt (fd, IPPROTO_TCP, TCP_KEEPIDLE, &keepalive_idle,
sizeof (keepalive_intvl));
if (ret == -1) {
gf_log ("socket", GF_LOG_WARNING,
"failed to set keep idle on socket %d", fd);
"failed to set keep idle %d on socket %d, %s",
keepalive_idle, fd, strerror(errno));
goto err;
}
ret = setsockopt (fd, IPPROTO_TCP, TCP_KEEPINTVL, &keepalive_intvl,
ret = setsockopt (fd, IPPROTO_TCP , TCP_KEEPINTVL, &keepalive_intvl,
sizeof (keepalive_intvl));
if (ret == -1) {
gf_log ("socket", GF_LOG_WARNING,
"failed to set keep alive interval on socket %d", fd);
"failed to set keep interval %d on socket %d, %s",
keepalive_intvl, fd, strerror(errno));
goto err;
}
#endif
@ -2266,6 +2271,7 @@ socket_server_event_handler (int fd, int idx, void *data,
if (priv->keepalive) {
ret = __socket_keepalive (new_sock,
new_sockaddr.ss_family,
priv->keepaliveintvl,
priv->keepaliveidle);
if (ret == -1)
@ -2537,6 +2543,7 @@ socket_connect (rpc_transport_t *this, int port)
if (priv->keepalive) {
ret = __socket_keepalive (priv->sock,
sa_family,
priv->keepaliveintvl,
priv->keepaliveidle);
if (ret == -1)