summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorschaffung <ssivakum@redhat.com>2020-10-22 13:07:09 +0530
committerGitHub <noreply@github.com>2020-10-22 13:07:09 +0530
commit2675b811782a139bd5620ed9277a4bf0b935d2bc (patch)
tree73cc12fbe8cabed3a7edde84abd5d12891306233
parente85e7bc3ac888339f96a57b8290a69f349164c23 (diff)
downloadglusterfs-2675b811782a139bd5620ed9277a4bf0b935d2bc.tar.gz
glusterfs-2675b811782a139bd5620ed9277a4bf0b935d2bc.tar.xz
glusterfs-2675b811782a139bd5620ed9277a4bf0b935d2bc.zip
glusterd: brick sock file deleted, log error (#1560)
Issue: The satus of the brick as tracked by glusterd is stopped if the socket file corresponding to a running brick process is absent in /var/run/gluster. The glusterd keeps on trying to reconnect ( rpc layer ) but it fails. Code change: Rather than registering the rpc connection with the help of the given sockfilepath which is not even present as it keeps on reconnecting, why not log this as an error and not try to reconnect using the non-existing sock file path. Fixes: #1526 Change-Id: I6c81691ab1624c66dec74f5ffcc6c383201ac757 Signed-off-by: srijan-sivakumar <ssivakumar@redhat.com> Co-authored-by: srijan-sivakumar <ssivakumar@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c27
1 files changed, 25 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 3257224301..2f38a253ac 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -6453,7 +6453,7 @@ find_compatible_brick(glusterd_conf_t *conf, glusterd_volinfo_t *volinfo,
check if passed pid is match with running glusterfs process
*/
-int
+static int
glusterd_get_sock_from_brick_pid(int pid, char *sockpath, size_t len)
{
char buf[1024] = "";
@@ -6542,7 +6542,17 @@ glusterd_get_sock_from_brick_pid(int pid, char *sockpath, size_t len)
if (tmpsockpath[0]) {
strncpy(sockpath, tmpsockpath, i);
- ret = 0;
+ /*
+ * Condition to check if the brick socket file is present
+ * in the stated path or not. This helps in preventing
+ * constant re-connect triggered in the RPC layer and also
+ * a log message would help out the user.
+ */
+ ret = sys_access(sockpath, F_OK);
+ if (ret) {
+ gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_FILE_NOT_FOUND,
+ "%s not found", sockpath, NULL);
+ }
}
return ret;
@@ -6780,7 +6790,20 @@ glusterd_brick_start(glusterd_volinfo_t *volinfo,
if (!is_brick_mx_enabled()) {
glusterd_set_brick_socket_filepath(
volinfo, brickinfo, socketpath, sizeof(socketpath));
+ /*
+ * Condition to check if the brick socket file is present
+ * in the stated path or not. This helps in preventing
+ * constant re-connect triggered in the RPC layer and also
+ * a log message would help out the user.
+ */
+ ret = sys_access(socketpath, F_OK);
+ if (ret) {
+ gf_smsg(this->name, GF_LOG_ERROR, 0, GD_MSG_FILE_NOT_FOUND,
+ "%s not found", socketpath, NULL);
+ goto out;
+ }
}
+
gf_log(this->name, GF_LOG_DEBUG,
"Using %s as sockfile for brick %s of volume %s ",
socketpath, brickinfo->path, volinfo->volname);