|
|
b51a1f |
From 9b19d4841fc3002d30ec3e44c85ec37682c11bfb Mon Sep 17 00:00:00 2001
|
|
|
b51a1f |
From: schaffung <ssivakum@redhat.com>
|
|
|
b51a1f |
Date: Thu, 22 Oct 2020 13:07:09 +0530
|
|
|
b51a1f |
Subject: [PATCH 486/511] glusterd: brick sock file deleted, log error (#1560)
|
|
|
b51a1f |
|
|
|
b51a1f |
Issue: The satus of the brick as tracked by glusterd is
|
|
|
b51a1f |
stopped if the socket file corresponding to a running
|
|
|
b51a1f |
brick process is absent in /var/run/gluster. The glusterd
|
|
|
b51a1f |
keeps on trying to reconnect ( rpc layer ) but it fails.
|
|
|
b51a1f |
|
|
|
b51a1f |
Code change: Rather than registering the rpc connection
|
|
|
b51a1f |
with the help of the given sockfilepath which is not
|
|
|
b51a1f |
even present as it keeps on reconnecting, why not log
|
|
|
b51a1f |
this as an error and not try to reconnect using the
|
|
|
b51a1f |
non-existing sock file path.
|
|
|
b51a1f |
|
|
|
b51a1f |
>Fixes: #1526
|
|
|
b51a1f |
>Change-Id: I6c81691ab1624c66dec74f5ffcc6c383201ac757
|
|
|
b51a1f |
>Signed-off-by: srijan-sivakumar <ssivakumar@redhat.com>
|
|
|
b51a1f |
Upstream Patch : https://github.com/gluster/glusterfs/pull/1560
|
|
|
b51a1f |
|
|
|
b51a1f |
BUG: 1882923
|
|
|
b51a1f |
Change-Id: I6c81691ab1624c66dec74f5ffcc6c383201ac757
|
|
|
b51a1f |
Signed-off-by: Srijan Sivakumar <ssivakum@redhat.com>
|
|
|
b51a1f |
Reviewed-on: https://code.engineering.redhat.com/gerrit/220376
|
|
|
b51a1f |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
b51a1f |
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
|
|
|
b51a1f |
---
|
|
|
b51a1f |
xlators/mgmt/glusterd/src/glusterd-utils.c | 27 +++++++++++++++++++++++++--
|
|
|
b51a1f |
1 file changed, 25 insertions(+), 2 deletions(-)
|
|
|
b51a1f |
|
|
|
b51a1f |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
b51a1f |
index d25fc8a..a72c494 100644
|
|
|
b51a1f |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
b51a1f |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
b51a1f |
@@ -6310,7 +6310,7 @@ find_compatible_brick(glusterd_conf_t *conf, glusterd_volinfo_t *volinfo,
|
|
|
b51a1f |
check if passed pid is match with running glusterfs process
|
|
|
b51a1f |
*/
|
|
|
b51a1f |
|
|
|
b51a1f |
-int
|
|
|
b51a1f |
+static int
|
|
|
b51a1f |
glusterd_get_sock_from_brick_pid(int pid, char *sockpath, size_t len)
|
|
|
b51a1f |
{
|
|
|
b51a1f |
char fname[128] = "";
|
|
|
b51a1f |
@@ -6383,7 +6383,17 @@ glusterd_get_sock_from_brick_pid(int pid, char *sockpath, size_t len)
|
|
|
b51a1f |
|
|
|
b51a1f |
if (tmpsockpath[0]) {
|
|
|
b51a1f |
strncpy(sockpath, tmpsockpath, i);
|
|
|
b51a1f |
- ret = 0;
|
|
|
b51a1f |
+ /*
|
|
|
b51a1f |
+ * Condition to check if the brick socket file is present
|
|
|
b51a1f |
+ * in the stated path or not. This helps in preventing
|
|
|
b51a1f |
+ * constant re-connect triggered in the RPC layer and also
|
|
|
b51a1f |
+ * a log message would help out the user.
|
|
|
b51a1f |
+ */
|
|
|
b51a1f |
+ ret = sys_access(sockpath, F_OK);
|
|
|
b51a1f |
+ if (ret) {
|
|
|
b51a1f |
+ gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_FILE_NOT_FOUND,
|
|
|
b51a1f |
+ "%s not found", sockpath, NULL);
|
|
|
b51a1f |
+ }
|
|
|
b51a1f |
}
|
|
|
b51a1f |
|
|
|
b51a1f |
return ret;
|
|
|
b51a1f |
@@ -6581,7 +6591,20 @@ glusterd_brick_start(glusterd_volinfo_t *volinfo,
|
|
|
b51a1f |
if (!is_brick_mx_enabled()) {
|
|
|
b51a1f |
glusterd_set_brick_socket_filepath(
|
|
|
b51a1f |
volinfo, brickinfo, socketpath, sizeof(socketpath));
|
|
|
b51a1f |
+ /*
|
|
|
b51a1f |
+ * Condition to check if the brick socket file is present
|
|
|
b51a1f |
+ * in the stated path or not. This helps in preventing
|
|
|
b51a1f |
+ * constant re-connect triggered in the RPC layer and also
|
|
|
b51a1f |
+ * a log message would help out the user.
|
|
|
b51a1f |
+ */
|
|
|
b51a1f |
+ ret = sys_access(socketpath, F_OK);
|
|
|
b51a1f |
+ if (ret) {
|
|
|
b51a1f |
+ gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_FILE_NOT_FOUND,
|
|
|
b51a1f |
+ "%s not found", socketpath, NULL);
|
|
|
b51a1f |
+ goto out;
|
|
|
b51a1f |
+ }
|
|
|
b51a1f |
}
|
|
|
b51a1f |
+
|
|
|
b51a1f |
gf_log(this->name, GF_LOG_DEBUG,
|
|
|
b51a1f |
"Using %s as sockfile for brick %s of volume %s ",
|
|
|
b51a1f |
socketpath, brickinfo->path, volinfo->volname);
|
|
|
b51a1f |
--
|
|
|
b51a1f |
1.8.3.1
|
|
|
b51a1f |
|