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