b7d4d7
From 1b24bc4319203128a9ff7f97fe14f4b3622c4eec Mon Sep 17 00:00:00 2001
b7d4d7
From: Sanju Rakonde <srakonde@redhat.com>
b7d4d7
Date: Wed, 26 Aug 2020 20:05:35 +0530
b7d4d7
Subject: [PATCH 494/511] glusterd: start the brick on a different port
b7d4d7
b7d4d7
Problem: brick fails to start when the port provided by
b7d4d7
glusterd is in use by any other process
b7d4d7
b7d4d7
Solution: glusterd should check errno set by runner_run()
b7d4d7
and if it is set to EADDRINUSE, it should allocate a new
b7d4d7
port to the brick and try to start it again.
b7d4d7
b7d4d7
Previously ret value is checked instead of errno, so the
b7d4d7
retry part never executed. Now, we initialize errno to 0
b7d4d7
before calling runner framework. and afterwards store the
b7d4d7
errno into ret to avoid modification of errno in subsequent
b7d4d7
function calls.
b7d4d7
b7d4d7
>fixes: #1101
b7d4d7
b7d4d7
>Change-Id: I1aa048a77c5f8b035dece36976d60602d9753b1a
b7d4d7
>Signed-off-by: Sanju Rakonde <srakonde@redhat.com>
b7d4d7
>Signed-off-by: nik-redhat <nladha@redhat.com>
b7d4d7
b7d4d7
Upstream patch: https://review.gluster.org/c/glusterfs/+/24923/
b7d4d7
b7d4d7
BUG: 1865796
b7d4d7
Change-Id: I1aa048a77c5f8b035dece36976d60602d9753b1a
b7d4d7
Signed-off-by: nik-redhat <nladha@redhat.com>
b7d4d7
Reviewed-on: https://code.engineering.redhat.com/gerrit/220541
b7d4d7
Tested-by: RHGS Build Bot <nigelb@redhat.com>
b7d4d7
Reviewed-by: Sunil Kumar Heggodu Gopala Acharya <sheggodu@redhat.com>
b7d4d7
---
b7d4d7
 xlators/mgmt/glusterd/src/glusterd-utils.c | 3 +++
b7d4d7
 1 file changed, 3 insertions(+)
b7d4d7
b7d4d7
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
b7d4d7
index b343eee..f7030fb 100644
b7d4d7
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
b7d4d7
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
b7d4d7
@@ -2289,7 +2289,10 @@ retry:
b7d4d7
 
b7d4d7
     if (wait) {
b7d4d7
         synclock_unlock(&priv->big_lock);
b7d4d7
+        errno = 0;
b7d4d7
         ret = runner_run(&runner);
b7d4d7
+        if (errno != 0)
b7d4d7
+            ret = errno;
b7d4d7
         synclock_lock(&priv->big_lock);
b7d4d7
 
b7d4d7
         if (ret == EADDRINUSE) {
b7d4d7
-- 
b7d4d7
1.8.3.1
b7d4d7