|
|
21ab4e |
From 7aefe6fa80cfb59d891831b8a1cb0f0055ea2801 Mon Sep 17 00:00:00 2001
|
|
|
21ab4e |
From: Gaurav Yadav <gyadav@redhat.com>
|
|
|
21ab4e |
Date: Fri, 27 Oct 2017 16:04:46 +0530
|
|
|
21ab4e |
Subject: [PATCH 631/631] glusterd: persist brickinfo's port change into
|
|
|
21ab4e |
glusterd's store
|
|
|
21ab4e |
|
|
|
21ab4e |
Problem:
|
|
|
21ab4e |
Consider a case where node reboot is performed and prior to reboot
|
|
|
21ab4e |
brick was listening to 49153. Post reboot glusterd assigned 49152
|
|
|
21ab4e |
to brick and started the brick process but the new port was never
|
|
|
21ab4e |
persisted. Now when glusterd restarts glusterd always read the port
|
|
|
21ab4e |
from its persisted store i.e 49153 however pmap signin happens with
|
|
|
21ab4e |
the correct port i.e 49152.
|
|
|
21ab4e |
|
|
|
21ab4e |
Fix:
|
|
|
21ab4e |
Make sure when glusterd_brick_start is called, glusterd_store_volinfo is
|
|
|
21ab4e |
eventually invoked.
|
|
|
21ab4e |
|
|
|
21ab4e |
>upstream mainline patch : https://review.gluster.org/#/c/18579/
|
|
|
21ab4e |
|
|
|
21ab4e |
Change-Id: Ic0efbd48c51d39729ed951a42922d0e59f7115a1
|
|
|
21ab4e |
BUG: 1505433
|
|
|
21ab4e |
Signed-off-by: Gaurav Yadav <gyadav@redhat.com>
|
|
|
21ab4e |
Reviewed-on: https://code.engineering.redhat.com/gerrit/121878
|
|
|
21ab4e |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
Tested-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
21ab4e |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
21ab4e |
---
|
|
|
21ab4e |
xlators/mgmt/glusterd/src/glusterd-handshake.c | 18 +++++++++---------
|
|
|
21ab4e |
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 9 ++++++++-
|
|
|
21ab4e |
xlators/mgmt/glusterd/src/glusterd-server-quorum.c | 16 ++++++++++++++++
|
|
|
21ab4e |
xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c | 10 ++++++++++
|
|
|
21ab4e |
xlators/mgmt/glusterd/src/glusterd-utils.c | 19 +++++++++++++++++++
|
|
|
21ab4e |
5 files changed, 62 insertions(+), 10 deletions(-)
|
|
|
21ab4e |
|
|
|
21ab4e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
|
|
|
21ab4e |
index 0cd1a29f4..a09437e82 100644
|
|
|
21ab4e |
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
|
|
|
21ab4e |
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
|
|
|
21ab4e |
@@ -626,6 +626,15 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
brickinfo->snap_status = 0;
|
|
|
21ab4e |
+ ret = glusterd_brick_start (snap_vol, brickinfo, _gf_false);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_WARNING, 0,
|
|
|
21ab4e |
+ GD_MSG_BRICK_DISCONNECTED, "starting the "
|
|
|
21ab4e |
+ "brick %s:%s for the snap %s failed",
|
|
|
21ab4e |
+ brickinfo->hostname, brickinfo->path,
|
|
|
21ab4e |
+ snap->snapname);
|
|
|
21ab4e |
+ goto out;
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
ret = glusterd_store_volinfo (snap_vol,
|
|
|
21ab4e |
GLUSTERD_VOLINFO_VER_AC_NONE);
|
|
|
21ab4e |
if (ret) {
|
|
|
21ab4e |
@@ -636,15 +645,6 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
|
|
|
21ab4e |
goto out;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
- ret = glusterd_brick_start (snap_vol, brickinfo, _gf_false);
|
|
|
21ab4e |
- if (ret) {
|
|
|
21ab4e |
- gf_msg (this->name, GF_LOG_WARNING, 0,
|
|
|
21ab4e |
- GD_MSG_BRICK_DISCONNECTED, "starting the "
|
|
|
21ab4e |
- "brick %s:%s for the snap %s failed",
|
|
|
21ab4e |
- brickinfo->hostname, brickinfo->path,
|
|
|
21ab4e |
- snap->snapname);
|
|
|
21ab4e |
- goto out;
|
|
|
21ab4e |
- }
|
|
|
21ab4e |
out:
|
|
|
21ab4e |
if (device)
|
|
|
21ab4e |
GF_FREE (device);
|
|
|
21ab4e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
21ab4e |
index 52f7505e0..2ee9af48f 100644
|
|
|
21ab4e |
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
21ab4e |
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
21ab4e |
@@ -2359,8 +2359,15 @@ glusterd_start_bricks (glusterd_volinfo_t *volinfo)
|
|
|
21ab4e |
brickinfo->path);
|
|
|
21ab4e |
goto out;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
- }
|
|
|
21ab4e |
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_NONE);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg (THIS->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_STORE_FAIL,
|
|
|
21ab4e |
+ "Failed to write volinfo for volume %s",
|
|
|
21ab4e |
+ volinfo->volname);
|
|
|
21ab4e |
+ goto out;
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
ret = 0;
|
|
|
21ab4e |
out:
|
|
|
21ab4e |
return ret;
|
|
|
21ab4e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
|
|
|
21ab4e |
index 35f6ad19f..b37f8084e 100644
|
|
|
21ab4e |
--- a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
|
|
|
21ab4e |
+++ b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
|
|
|
21ab4e |
@@ -12,6 +12,7 @@
|
|
|
21ab4e |
#include "glusterd-utils.h"
|
|
|
21ab4e |
#include "glusterd-messages.h"
|
|
|
21ab4e |
#include "glusterd-server-quorum.h"
|
|
|
21ab4e |
+#include "glusterd-store.h"
|
|
|
21ab4e |
#include "glusterd-syncop.h"
|
|
|
21ab4e |
#include "glusterd-op-sm.h"
|
|
|
21ab4e |
|
|
|
21ab4e |
@@ -299,6 +300,7 @@ void
|
|
|
21ab4e |
glusterd_do_volume_quorum_action (xlator_t *this, glusterd_volinfo_t *volinfo,
|
|
|
21ab4e |
gf_boolean_t meets_quorum)
|
|
|
21ab4e |
{
|
|
|
21ab4e |
+ int ret = -1;
|
|
|
21ab4e |
glusterd_brickinfo_t *brickinfo = NULL;
|
|
|
21ab4e |
glusterd_conf_t *conf = NULL;
|
|
|
21ab4e |
gd_quorum_status_t quorum_status = NOT_APPLICABLE_QUORUM;
|
|
|
21ab4e |
@@ -357,6 +359,20 @@ glusterd_do_volume_quorum_action (xlator_t *this, glusterd_volinfo_t *volinfo,
|
|
|
21ab4e |
glusterd_brick_start (volinfo, brickinfo, _gf_false);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
volinfo->quorum_status = quorum_status;
|
|
|
21ab4e |
+ if (quorum_status == MEETS_QUORUM) {
|
|
|
21ab4e |
+ /* bricks might have been restarted and so as the port change
|
|
|
21ab4e |
+ * might have happened
|
|
|
21ab4e |
+ */
|
|
|
21ab4e |
+ ret = glusterd_store_volinfo (volinfo,
|
|
|
21ab4e |
+ GLUSTERD_VOLINFO_VER_AC_NONE);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
21ab4e |
+ GD_MSG_VOLINFO_STORE_FAIL,
|
|
|
21ab4e |
+ "Failed to write volinfo for volume %s",
|
|
|
21ab4e |
+ volinfo->volname);
|
|
|
21ab4e |
+ goto out;
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
out:
|
|
|
21ab4e |
return;
|
|
|
21ab4e |
}
|
|
|
21ab4e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
|
|
|
21ab4e |
index e833cc98c..3fe424a6f 100644
|
|
|
21ab4e |
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
|
|
|
21ab4e |
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
|
|
|
21ab4e |
@@ -1681,6 +1681,16 @@ glusterd_import_friend_snap (dict_t *peer_data, int32_t snap_count,
|
|
|
21ab4e |
}
|
|
|
21ab4e |
if (glusterd_is_volume_started (snap_vol)) {
|
|
|
21ab4e |
(void) glusterd_start_bricks (snap_vol);
|
|
|
21ab4e |
+ ret = glusterd_store_volinfo
|
|
|
21ab4e |
+ (snap_vol,
|
|
|
21ab4e |
+ GLUSTERD_VOLINFO_VER_AC_NONE);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
21ab4e |
+ GD_MSG_VOLINFO_STORE_FAIL, "Failed to "
|
|
|
21ab4e |
+ "write volinfo for volume %s",
|
|
|
21ab4e |
+ snap_vol->volname);
|
|
|
21ab4e |
+ goto out;
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
} else {
|
|
|
21ab4e |
(void) glusterd_stop_bricks(snap_vol);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
21ab4e |
index 02ba0d637..7b57884d2 100644
|
|
|
21ab4e |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
21ab4e |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
21ab4e |
@@ -5950,6 +5950,15 @@ glusterd_restart_bricks (glusterd_conf_t *conf)
|
|
|
21ab4e |
glusterd_brick_start (volinfo, brickinfo,
|
|
|
21ab4e |
_gf_false);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
+ ret = glusterd_store_volinfo
|
|
|
21ab4e |
+ (volinfo, GLUSTERD_VOLINFO_VER_AC_NONE);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
21ab4e |
+ GD_MSG_VOLINFO_STORE_FAIL, "Failed to "
|
|
|
21ab4e |
+ "write volinfo for volume %s",
|
|
|
21ab4e |
+ volinfo->volname);
|
|
|
21ab4e |
+ goto out;
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
}
|
|
|
21ab4e |
}
|
|
|
21ab4e |
|
|
|
21ab4e |
@@ -5981,6 +5990,16 @@ glusterd_restart_bricks (glusterd_conf_t *conf)
|
|
|
21ab4e |
glusterd_brick_start (volinfo, brickinfo,
|
|
|
21ab4e |
_gf_false);
|
|
|
21ab4e |
}
|
|
|
21ab4e |
+ ret = glusterd_store_volinfo
|
|
|
21ab4e |
+ (volinfo, GLUSTERD_VOLINFO_VER_AC_NONE);
|
|
|
21ab4e |
+ if (ret) {
|
|
|
21ab4e |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
21ab4e |
+ GD_MSG_VOLINFO_STORE_FAIL, "Failed to "
|
|
|
21ab4e |
+ "write volinfo for volume %s",
|
|
|
21ab4e |
+ volinfo->volname);
|
|
|
21ab4e |
+ goto out;
|
|
|
21ab4e |
+ }
|
|
|
21ab4e |
+
|
|
|
21ab4e |
}
|
|
|
21ab4e |
}
|
|
|
21ab4e |
ret = 0;
|
|
|
21ab4e |
--
|
|
|
21ab4e |
2.13.6
|
|
|
21ab4e |
|