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