diff options
author | Kaleb S. KEITHLEY <kkeithle@redhat.com> | 2012-08-16 13:27:00 -0400 |
---|---|---|
committer | Anand Avati <avati@redhat.com> | 2012-08-19 09:28:53 -0700 |
commit | 623dbe5afc1cfd1e22064a4e60750289b2ef6b0e (patch) | |
tree | 5760e5be6e7d94d28ef649e72ce9134c125460f0 /rpc/rpc-transport/socket | |
parent | 6930c6950f7b7a8186ebfcdf9ebcad11e90740c0 (diff) |
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>
Diffstat (limited to 'rpc/rpc-transport/socket')
-rw-r--r-- | rpc/rpc-transport/socket/src/socket.c | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c index f2db84d342d..f5c6bffa208 100644 --- a/rpc/rpc-transport/socket/src/socket.c +++ b/rpc/rpc-transport/socket/src/socket.c @@ -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) |