|
|
21ab4e |
From 338d491f48242ac85d4510a655fa85f642a11b8c Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: Milind Changire <mchangir@redhat.com>
|
|
|
21ab4e |
Date: Sun, 5 Mar 2017 21:39:20 +0530
|
|
|
21ab4e |
Subject: [PATCH 349/361] rpc: avoid logging success on failure
|
|
|
21ab4e |
|
|
|
21ab4e |
Avoid logging Success in the event of failure especially when errno has
|
|
|
21ab4e |
no meaningful value w.r.t. the failure. In this case the errno is set to
|
|
|
21ab4e |
zero when there's indeed a failure at the RPC level.
|
|
|
21ab4e |
|
|
|
21ab4e |
mainline:
|
|
|
21ab4e |
> BUG: 1426032
|
|
|
21ab4e |
> Reviewed-on: https://review.gluster.org/16730
|
|
|
21ab4e |
> Smoke: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> NetBSD-regression: NetBSD Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> CentOS-regression: Gluster Build System <jenkins@build.gluster.org>
|
|
|
21ab4e |
> Reviewed-by: N Balachandran <nbalacha@redhat.com>
|
|
|
21ab4e |
> Reviewed-by: Jeff Darcy <jdarcy@redhat.com>
|
|
|
21ab4e |
(cherry picked from commit b6163b90fff47f4bd31cf1d33e60118b25f920d3)
|
|
|
21ab4e |
|
|
|
21ab4e |
BUG: 1387328
|
|
|
21ab4e |
Change-Id: If2cc81aa1e590023ed22892dacbef7cac213e591
|
|
|
21ab4e |
Signed-off-by: Milind Changire <mchangir@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/101325
|
|
|
21ab4e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
---
|
|
|
21ab4e |
api/src/glfs-mgmt.c | 15 ++++++++++-----
|
|
|
21ab4e |
glusterfsd/src/glusterfsd-mgmt.c | 17 ++++++++++++++---
|
|
|
21ab4e |
rpc/rpc-lib/src/rpc-transport.h | 5 +++++
|
|
|
21ab4e |
rpc/rpc-transport/socket/src/socket.c | 2 ++
|
|
|
21ab4e |
4 files changed, 31 insertions(+), 8 deletions(-)
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/api/src/glfs-mgmt.c b/api/src/glfs-mgmt.c
|
|
|
21ab4e |
index 9a33736..0109764 100644
|
|
|
21ab4e |
--- a/api/src/glfs-mgmt.c
|
|
|
21ab4e |
+++ b/api/src/glfs-mgmt.c
|
|
|
21ab4e |
@@ -789,11 +789,16 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
|
|
|
21ab4e |
switch (event) {
|
|
|
21ab4e |
case RPC_CLNT_DISCONNECT:
|
|
|
21ab4e |
if (!ctx->active) {
|
|
|
21ab4e |
- gf_msg ("glfs-mgmt", GF_LOG_ERROR, errno,
|
|
|
21ab4e |
- API_MSG_REMOTE_HOST_CONN_FAILED,
|
|
|
21ab4e |
- "failed to connect with remote-host: %s (%s)",
|
|
|
21ab4e |
- ctx->cmd_args.volfile_server,
|
|
|
21ab4e |
- strerror (errno));
|
|
|
21ab4e |
+ if (rpc_trans->connect_failed)
|
|
|
21ab4e |
+ gf_msg ("glfs-mgmt", GF_LOG_ERROR, 0,
|
|
|
21ab4e |
+ API_MSG_REMOTE_HOST_CONN_FAILED,
|
|
|
21ab4e |
+ "failed to connect to remote-host: %s",
|
|
|
21ab4e |
+ ctx->cmd_args.volfile_server);
|
|
|
21ab4e |
+ else
|
|
|
21ab4e |
+ gf_msg ("glfs-mgmt", GF_LOG_INFO, 0,
|
|
|
21ab4e |
+ API_MSG_REMOTE_HOST_CONN_FAILED,
|
|
|
21ab4e |
+ "disconnected from remote-host: %s",
|
|
|
21ab4e |
+ ctx->cmd_args.volfile_server);
|
|
|
21ab4e |
|
|
|
21ab4e |
if (!rpc->disabled) {
|
|
|
21ab4e |
/*
|
|
|
21ab4e |
diff --git a/glusterfsd/src/glusterfsd-mgmt.c b/glusterfsd/src/glusterfsd-mgmt.c
|
|
|
21ab4e |
index 9cb8b41..1bbc5c8 100644
|
|
|
21ab4e |
--- a/glusterfsd/src/glusterfsd-mgmt.c
|
|
|
21ab4e |
+++ b/glusterfsd/src/glusterfsd-mgmt.c
|
|
|
21ab4e |
@@ -2097,9 +2097,20 @@ mgmt_rpc_notify (struct rpc_clnt *rpc, void *mydata, rpc_clnt_event_t event,
|
|
|
21ab4e |
|
|
|
21ab4e |
switch (event) {
|
|
|
21ab4e |
case RPC_CLNT_DISCONNECT:
|
|
|
21ab4e |
- GF_LOG_OCCASIONALLY (log_ctr1, "glusterfsd-mgmt", GF_LOG_ERROR,
|
|
|
21ab4e |
- "failed to connect with remote-host: %s (%s)",
|
|
|
21ab4e |
- ctx->cmd_args.volfile_server, strerror (errno));
|
|
|
21ab4e |
+ if (rpc_trans->connect_failed) {
|
|
|
21ab4e |
+ GF_LOG_OCCASIONALLY (log_ctr1, "glusterfsd-mgmt",
|
|
|
21ab4e |
+ GF_LOG_ERROR,
|
|
|
21ab4e |
+ "failed to connect to remote-"
|
|
|
21ab4e |
+ "host: %s",
|
|
|
21ab4e |
+ ctx->cmd_args.volfile_server);
|
|
|
21ab4e |
+ } else {
|
|
|
21ab4e |
+ GF_LOG_OCCASIONALLY (log_ctr1, "glusterfsd-mgmt",
|
|
|
21ab4e |
+ GF_LOG_INFO,
|
|
|
21ab4e |
+ "disconnected from remote-"
|
|
|
21ab4e |
+ "host: %s",
|
|
|
21ab4e |
+ ctx->cmd_args.volfile_server);
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
if (!rpc->disabled) {
|
|
|
21ab4e |
/*
|
|
|
21ab4e |
* Check if dnscache is exhausted for current server
|
|
|
21ab4e |
diff --git a/rpc/rpc-lib/src/rpc-transport.h b/rpc/rpc-lib/src/rpc-transport.h
|
|
|
21ab4e |
index dbfa32a..12dcfaf 100644
|
|
|
21ab4e |
--- a/rpc/rpc-lib/src/rpc-transport.h
|
|
|
21ab4e |
+++ b/rpc/rpc-lib/src/rpc-transport.h
|
|
|
21ab4e |
@@ -211,6 +211,11 @@ struct rpc_transport {
|
|
|
21ab4e |
char *ssl_name;
|
|
|
21ab4e |
dict_t *clnt_options; /* store options received from
|
|
|
21ab4e |
* client */
|
|
|
21ab4e |
+ /* connect_failed: saves the connect() syscall status as socket_t
|
|
|
21ab4e |
+ * member holding connect() status can't be accessed by higher gfapi
|
|
|
21ab4e |
+ * layer or in client management notification handler functions
|
|
|
21ab4e |
+ */
|
|
|
21ab4e |
+ gf_boolean_t connect_failed;
|
|
|
21ab4e |
};
|
|
|
21ab4e |
|
|
|
21ab4e |
struct rpc_transport_ops {
|
|
|
21ab4e |
diff --git a/rpc/rpc-transport/socket/src/socket.c b/rpc/rpc-transport/socket/src/socket.c
|
|
|
21ab4e |
index cf2f75e..ca939bb 100644
|
|
|
21ab4e |
--- a/rpc/rpc-transport/socket/src/socket.c
|
|
|
21ab4e |
+++ b/rpc/rpc-transport/socket/src/socket.c
|
|
|
21ab4e |
@@ -3148,6 +3148,7 @@ socket_connect (rpc_transport_t *this, int port)
|
|
|
21ab4e |
}
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
+ this->connect_failed = _gf_false;
|
|
|
21ab4e |
if (ign_enoent) {
|
|
|
21ab4e |
ret = connect_loop (priv->sock,
|
|
|
21ab4e |
SA (&this->peerinfo.sockaddr),
|
|
|
21ab4e |
@@ -3171,6 +3172,7 @@ socket_connect (rpc_transport_t *this, int port)
|
|
|
21ab4e |
/* TBD: What about ENOENT, we will do getsockopt there
|
|
|
21ab4e |
as well, so how is that exempt from such a problem? */
|
|
|
21ab4e |
priv->connect_failed = 1;
|
|
|
21ab4e |
+ this->connect_failed = _gf_true;
|
|
|
21ab4e |
|
|
|
21ab4e |
goto handler;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
--
|
|
|
21ab4e |
1.8.3.1
|
|
|
21ab4e |
|