summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/glusterd.vol1
-rw-r--r--rpc/rpc-transport/socket/src/socket.c35
-rw-r--r--rpc/rpc-transport/socket/src/socket.h1
3 files changed, 29 insertions, 8 deletions
diff --git a/doc/glusterd.vol b/doc/glusterd.vol
index 4518e8d65c3..809042cbdd9 100644
--- a/doc/glusterd.vol
+++ b/doc/glusterd.vol
@@ -4,4 +4,5 @@ volume management
option transport-type socket,rdma
option transport.socket.keepalive-time 10
option transport.socket.keepalive-interval 2
+ option transport.socket.read-fail-log off
end-volume
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
index 674259e5f18..9937dc4a6e6 100644
--- a/rpc/rpc-transport/socket/src/socket.c
+++ b/rpc/rpc-transport/socket/src/socket.c
@@ -43,7 +43,6 @@
#include <errno.h>
#include <netinet/tcp.h>
#include <rpc/xdr.h>
-
#define GF_LOG_ERRNO(errno) ((errno == ENOTCONN) ? GF_LOG_DEBUG : GF_LOG_ERROR)
#define SA(ptr) ((struct sockaddr *)ptr)
@@ -1486,12 +1485,14 @@ __socket_proto_state_machine (rpc_transport_t *this,
&priv->incoming.pending_count,
NULL);
if (ret == -1) {
- gf_log (this->name,
- ((priv->connected == 1) ?
- GF_LOG_WARNING : GF_LOG_DEBUG),
- "reading from socket failed. Error (%s)"
- ", peer (%s)", strerror (errno),
- this->peerinfo.identifier);
+ if (priv->read_fail_log == 1) {
+ gf_log (this->name,
+ ((priv->connected == 1) ?
+ GF_LOG_WARNING : GF_LOG_DEBUG),
+ "reading from socket failed. Error (%s)"
+ ", peer (%s)", strerror (errno),
+ this->peerinfo.identifier);
+ }
goto out;
}
@@ -2536,7 +2537,6 @@ socket_init (rpc_transport_t *this)
priv->nodelay = 1;
priv->bio = 0;
priv->windowsize = GF_DEFAULT_SOCKET_WINDOW_SIZE;
-
INIT_LIST_HEAD (&priv->ioq);
/* All the below section needs 'this->options' to be present */
@@ -2629,6 +2629,22 @@ socket_init (rpc_transport_t *this)
priv->backlog = backlog;
}
+ optstr = NULL;
+
+ /* Check if socket read failures are to be logged */
+ priv->read_fail_log = 1;
+ if (dict_get (this->options, "transport.socket.read-fail-log")) {
+ optstr = data_to_str (dict_get (this->options, "transport.socket.read-fail-log"));
+ if (gf_string2boolean (optstr, &tmp_bool) == -1) {
+ gf_log (this->name, GF_LOG_WARNING,
+ "'transport.socket.read-fail-log' takes only "
+ "boolean options; logging socket read fails");
+ }
+ else if (tmp_bool == _gf_false) {
+ priv->read_fail_log = 0;
+ }
+ }
+
priv->windowsize = (int)windowsize;
out:
this->private = priv;
@@ -2734,5 +2750,8 @@ struct volume_options options[] = {
{ .key = {"transport.socket.listen-backlog"},
.type = GF_OPTION_TYPE_INT
},
+ { .key = {"transport.socket.read-fail-log"},
+ .type = GF_OPTION_TYPE_BOOL
+ },
{ .key = {NULL} }
};
diff --git a/rpc/rpc-transport/socket/src/socket.h b/rpc/rpc-transport/socket/src/socket.h
index 4acecab2a61..c52026cc829 100644
--- a/rpc/rpc-transport/socket/src/socket.h
+++ b/rpc/rpc-transport/socket/src/socket.h
@@ -193,6 +193,7 @@ typedef struct {
int keepaliveidle;
int keepaliveintvl;
uint32_t backlog;
+ gf_boolean_t read_fail_log;
} socket_private_t;