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