summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSanju Rakonde <srakonde@redhat.com>2020-08-26 20:05:35 +0530
committerMOHIT AGRAWAL <moagrawa@redhat.com>2020-09-29 13:15:21 +0000
commita0effc34aff418d6ecd4760c77587f5da25ca8cf (patch)
treebeb8722676a5ee18c2022ccbaa4570d80111587f
parent14a1e346c0b33328c892ec8cdf6e0931566e8381 (diff)
glusterd: start the brick on a different port
Problem: brick fails to start when the port provided by glusterd is in use by any other process Solution: glusterd should check errno set by runner_run() and if it is set to EADDRINUSE, it should allocate a new port to the brick and try to start it again. Previously ret value is checked instead of errno, so the retry part never executed. Now, we initialize errno to 0 before calling runner framework. and afterwards store the errno into ret to avoid modification of errno in subsequent function calls. fixes: #1101 Change-Id: I1aa048a77c5f8b035dece36976d60602d9753b1a Signed-off-by: Sanju Rakonde <srakonde@redhat.com> Signed-off-by: nik-redhat <nladha@redhat.com>
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c3
1 files changed, 3 insertions, 0 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index d0e72e0..90ef2cf 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -2220,7 +2220,10 @@ retry:
if (wait) {
synclock_unlock(&priv->big_lock);
+ errno = 0;
ret = runner_run(&runner);
+ if (errno != 0)
+ ret = errno;
synclock_lock(&priv->big_lock);
if (ret == EADDRINUSE) {