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