summaryrefslogtreecommitdiffstats
path: root/xlators
diff options
context:
space:
mode:
Diffstat (limited to 'xlators')
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-messages.h11
-rw-r--r--xlators/mgmt/glusterd/src/glusterd-utils.c22
-rw-r--r--xlators/protocol/server/src/server.c3
3 files changed, 34 insertions, 2 deletions
diff --git a/xlators/mgmt/glusterd/src/glusterd-messages.h b/xlators/mgmt/glusterd/src/glusterd-messages.h
index cfcd114749b..83e3e16fd20 100644
--- a/xlators/mgmt/glusterd/src/glusterd-messages.h
+++ b/xlators/mgmt/glusterd/src/glusterd-messages.h
@@ -46,7 +46,7 @@
#define GLUSTERD_COMP_BASE GLFS_MSGID_GLUSTERD
-#define GLFS_NUM_MESSAGES 573
+#define GLFS_NUM_MESSAGES 575
#define GLFS_MSGID_END (GLUSTERD_COMP_BASE + GLFS_NUM_MESSAGES + 1)
/* Messaged with message IDs */
@@ -4646,6 +4646,15 @@
*/
#define GD_MSG_FILE_NOT_FOUND (GLUSTERD_COMP_BASE + 574)
+/*!
+ * @messageid 106575
+ * @diagnosis Brick failed to start with given port, hence it gets a fresh port
+ * on its own and try to restart the brick with a new port
+ * @recommendedaction Ensure the new port is not blocked by firewall
+ */
+
+#define GD_MSG_RETRY_WITH_NEW_PORT (GLUSTERD_COMP_BASE + 575)
+
/*------------*/
#define glfs_msg_end_x GLFS_MSGID_END, "Invalid: End of messages"
#endif /* !_GLUSTERD_MESSAGES_H_ */
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
index 7d9333feb7a..43a4898536b 100644
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
@@ -1745,6 +1745,8 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo,
writing the valgrind log to the same file.
*/
GLUSTERD_REMOVE_SLASH_FROM_PATH (brickinfo->path, exp_path);
+
+retry:
runinit (&runner);
if (priv->valgrind) {
@@ -1836,6 +1838,26 @@ glusterd_volume_start_glusterfs (glusterd_volinfo_t *volinfo,
ret = runner_run (&runner);
synclock_lock (&priv->big_lock);
+ if (ret == -EADDRINUSE) {
+ /* retry after getting a new port */
+ gf_msg (this->name, GF_LOG_WARNING, -ret,
+ GD_MSG_SRC_BRICK_PORT_UNAVAIL,
+ "Port %d is used by other process", port);
+
+ port = pmap_registry_alloc (this);
+ if (!port) {
+ gf_msg (this->name, GF_LOG_CRITICAL, 0,
+ GD_MSG_NO_FREE_PORTS,
+ "Couldn't allocate a port");
+ ret = -1;
+ goto out;
+ }
+ gf_msg (this->name, GF_LOG_NOTICE, 0,
+ GD_MSG_RETRY_WITH_NEW_PORT,
+ "Retrying to start brick %s with new port %d",
+ brickinfo->path, port);
+ goto retry;
+ }
} else {
ret = runner_run_nowait (&runner);
}
diff --git a/xlators/protocol/server/src/server.c b/xlators/protocol/server/src/server.c
index 347a5fb5814..3d0440e7167 100644
--- a/xlators/protocol/server/src/server.c
+++ b/xlators/protocol/server/src/server.c
@@ -1072,7 +1072,8 @@ init (xlator_t *this)
gf_msg (this->name, GF_LOG_WARNING, 0,
PS_MSG_RPCSVC_LISTENER_CREATE_FAILED,
"creation of listener failed");
- ret = -1;
+ if (ret != -EADDRINUSE)
+ ret = -1;
goto out;
} else if (ret < total_transport) {
gf_msg (this->name, GF_LOG_ERROR, 0,