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