|
|
a3470f |
From 548895f0333a0706ec9475efc3b28456d591f093 Mon Sep 17 00:00:00 2001
|
|
|
a3470f |
From: Gaurav Yadav <gyadav@redhat.com>
|
|
|
a3470f |
Date: Fri, 27 Oct 2017 16:04:46 +0530
|
|
|
a3470f |
Subject: [PATCH 41/74] glusterd: persist brickinfo's port change into
|
|
|
a3470f |
glusterd's store
|
|
|
a3470f |
|
|
|
a3470f |
Problem:
|
|
|
a3470f |
Consider a case where node reboot is performed and prior to reboot
|
|
|
a3470f |
brick was listening to 49153. Post reboot glusterd assigned 49152
|
|
|
a3470f |
to brick and started the brick process but the new port was never
|
|
|
a3470f |
persisted. Now when glusterd restarts glusterd always read the port
|
|
|
a3470f |
from its persisted store i.e 49153 however pmap signin happens with
|
|
|
a3470f |
the correct port i.e 49152.
|
|
|
a3470f |
|
|
|
a3470f |
Fix:
|
|
|
a3470f |
Make sure when glusterd_brick_start is called, glusterd_store_volinfo is
|
|
|
a3470f |
eventually invoked.
|
|
|
a3470f |
|
|
|
a3470f |
>upstream mainline patch : https://review.gluster.org/#/c/18579/
|
|
|
a3470f |
|
|
|
a3470f |
Change-Id: Ic0efbd48c51d39729ed951a42922d0e59f7115a1
|
|
|
a3470f |
Signed-off-by: Gaurav Yadav <gyadav@redhat.com>
|
|
|
a3470f |
Reviewed-on: https://code.engineering.redhat.com/gerrit/121878
|
|
|
a3470f |
Reviewed-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
a3470f |
Tested-by: Atin Mukherjee <amukherj@redhat.com>
|
|
|
a3470f |
Tested-by: RHGS Build Bot <nigelb@redhat.com>
|
|
|
a3470f |
---
|
|
|
a3470f |
xlators/mgmt/glusterd/src/glusterd-handshake.c | 18 +++++++++---------
|
|
|
a3470f |
xlators/mgmt/glusterd/src/glusterd-op-sm.c | 9 ++++++++-
|
|
|
a3470f |
xlators/mgmt/glusterd/src/glusterd-server-quorum.c | 16 ++++++++++++++++
|
|
|
a3470f |
xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c | 10 ++++++++++
|
|
|
a3470f |
xlators/mgmt/glusterd/src/glusterd-utils.c | 19 +++++++++++++++++++
|
|
|
a3470f |
5 files changed, 62 insertions(+), 10 deletions(-)
|
|
|
a3470f |
|
|
|
a3470f |
diff --git a/xlators/mgmt/glusterd/src/glusterd-handshake.c b/xlators/mgmt/glusterd/src/glusterd-handshake.c
|
|
|
a3470f |
index c7e419c..8dfb528 100644
|
|
|
a3470f |
--- a/xlators/mgmt/glusterd/src/glusterd-handshake.c
|
|
|
a3470f |
+++ b/xlators/mgmt/glusterd/src/glusterd-handshake.c
|
|
|
a3470f |
@@ -658,6 +658,15 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
|
|
|
a3470f |
}
|
|
|
a3470f |
|
|
|
a3470f |
brickinfo->snap_status = 0;
|
|
|
a3470f |
+ ret = glusterd_brick_start (snap_vol, brickinfo, _gf_false);
|
|
|
a3470f |
+ if (ret) {
|
|
|
a3470f |
+ gf_msg (this->name, GF_LOG_WARNING, 0,
|
|
|
a3470f |
+ GD_MSG_BRICK_DISCONNECTED, "starting the "
|
|
|
a3470f |
+ "brick %s:%s for the snap %s failed",
|
|
|
a3470f |
+ brickinfo->hostname, brickinfo->path,
|
|
|
a3470f |
+ snap->snapname);
|
|
|
a3470f |
+ goto out;
|
|
|
a3470f |
+ }
|
|
|
a3470f |
ret = glusterd_store_volinfo (snap_vol,
|
|
|
a3470f |
GLUSTERD_VOLINFO_VER_AC_NONE);
|
|
|
a3470f |
if (ret) {
|
|
|
a3470f |
@@ -668,15 +677,6 @@ glusterd_create_missed_snap (glusterd_missed_snap_info *missed_snapinfo,
|
|
|
a3470f |
goto out;
|
|
|
a3470f |
}
|
|
|
a3470f |
|
|
|
a3470f |
- ret = glusterd_brick_start (snap_vol, brickinfo, _gf_false);
|
|
|
a3470f |
- if (ret) {
|
|
|
a3470f |
- gf_msg (this->name, GF_LOG_WARNING, 0,
|
|
|
a3470f |
- GD_MSG_BRICK_DISCONNECTED, "starting the "
|
|
|
a3470f |
- "brick %s:%s for the snap %s failed",
|
|
|
a3470f |
- brickinfo->hostname, brickinfo->path,
|
|
|
a3470f |
- snap->snapname);
|
|
|
a3470f |
- goto out;
|
|
|
a3470f |
- }
|
|
|
a3470f |
out:
|
|
|
a3470f |
if (device)
|
|
|
a3470f |
GF_FREE (device);
|
|
|
a3470f |
diff --git a/xlators/mgmt/glusterd/src/glusterd-op-sm.c b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
a3470f |
index 96e0860..9641b4f 100644
|
|
|
a3470f |
--- a/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
a3470f |
+++ b/xlators/mgmt/glusterd/src/glusterd-op-sm.c
|
|
|
a3470f |
@@ -2415,8 +2415,15 @@ glusterd_start_bricks (glusterd_volinfo_t *volinfo)
|
|
|
a3470f |
brickinfo->path);
|
|
|
a3470f |
goto out;
|
|
|
a3470f |
}
|
|
|
a3470f |
- }
|
|
|
a3470f |
|
|
|
a3470f |
+ }
|
|
|
a3470f |
+ ret = glusterd_store_volinfo (volinfo, GLUSTERD_VOLINFO_VER_AC_NONE);
|
|
|
a3470f |
+ if (ret) {
|
|
|
a3470f |
+ gf_msg (THIS->name, GF_LOG_ERROR, 0, GD_MSG_VOLINFO_STORE_FAIL,
|
|
|
a3470f |
+ "Failed to write volinfo for volume %s",
|
|
|
a3470f |
+ volinfo->volname);
|
|
|
a3470f |
+ goto out;
|
|
|
a3470f |
+ }
|
|
|
a3470f |
ret = 0;
|
|
|
a3470f |
out:
|
|
|
a3470f |
return ret;
|
|
|
a3470f |
diff --git a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
|
|
|
a3470f |
index a4637f8..659ff9d 100644
|
|
|
a3470f |
--- a/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
|
|
|
a3470f |
+++ b/xlators/mgmt/glusterd/src/glusterd-server-quorum.c
|
|
|
a3470f |
@@ -12,6 +12,7 @@
|
|
|
a3470f |
#include "glusterd-utils.h"
|
|
|
a3470f |
#include "glusterd-messages.h"
|
|
|
a3470f |
#include "glusterd-server-quorum.h"
|
|
|
a3470f |
+#include "glusterd-store.h"
|
|
|
a3470f |
#include "glusterd-syncop.h"
|
|
|
a3470f |
#include "glusterd-op-sm.h"
|
|
|
a3470f |
|
|
|
a3470f |
@@ -309,6 +310,7 @@ void
|
|
|
a3470f |
glusterd_do_volume_quorum_action (xlator_t *this, glusterd_volinfo_t *volinfo,
|
|
|
a3470f |
gf_boolean_t meets_quorum)
|
|
|
a3470f |
{
|
|
|
a3470f |
+ int ret = -1;
|
|
|
a3470f |
glusterd_brickinfo_t *brickinfo = NULL;
|
|
|
a3470f |
gd_quorum_status_t quorum_status = NOT_APPLICABLE_QUORUM;
|
|
|
a3470f |
gf_boolean_t follows_quorum = _gf_false;
|
|
|
a3470f |
@@ -365,6 +367,20 @@ glusterd_do_volume_quorum_action (xlator_t *this, glusterd_volinfo_t *volinfo,
|
|
|
a3470f |
glusterd_brick_start (volinfo, brickinfo, _gf_false);
|
|
|
a3470f |
}
|
|
|
a3470f |
volinfo->quorum_status = quorum_status;
|
|
|
a3470f |
+ if (quorum_status == MEETS_QUORUM) {
|
|
|
a3470f |
+ /* bricks might have been restarted and so as the port change
|
|
|
a3470f |
+ * might have happened
|
|
|
a3470f |
+ */
|
|
|
a3470f |
+ ret = glusterd_store_volinfo (volinfo,
|
|
|
a3470f |
+ GLUSTERD_VOLINFO_VER_AC_NONE);
|
|
|
a3470f |
+ if (ret) {
|
|
|
a3470f |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
a3470f |
+ GD_MSG_VOLINFO_STORE_FAIL,
|
|
|
a3470f |
+ "Failed to write volinfo for volume %s",
|
|
|
a3470f |
+ volinfo->volname);
|
|
|
a3470f |
+ goto out;
|
|
|
a3470f |
+ }
|
|
|
a3470f |
+ }
|
|
|
a3470f |
out:
|
|
|
a3470f |
return;
|
|
|
a3470f |
}
|
|
|
a3470f |
diff --git a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
|
|
|
a3470f |
index 6fb49c3..4cbade1 100644
|
|
|
a3470f |
--- a/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
|
|
|
a3470f |
+++ b/xlators/mgmt/glusterd/src/glusterd-snapshot-utils.c
|
|
|
a3470f |
@@ -1680,6 +1680,16 @@ glusterd_import_friend_snap (dict_t *peer_data, int32_t snap_count,
|
|
|
a3470f |
}
|
|
|
a3470f |
if (glusterd_is_volume_started (snap_vol)) {
|
|
|
a3470f |
(void) glusterd_start_bricks (snap_vol);
|
|
|
a3470f |
+ ret = glusterd_store_volinfo
|
|
|
a3470f |
+ (snap_vol,
|
|
|
a3470f |
+ GLUSTERD_VOLINFO_VER_AC_NONE);
|
|
|
a3470f |
+ if (ret) {
|
|
|
a3470f |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
a3470f |
+ GD_MSG_VOLINFO_STORE_FAIL, "Failed to "
|
|
|
a3470f |
+ "write volinfo for volume %s",
|
|
|
a3470f |
+ snap_vol->volname);
|
|
|
a3470f |
+ goto out;
|
|
|
a3470f |
+ }
|
|
|
a3470f |
} else {
|
|
|
a3470f |
(void) glusterd_stop_bricks(snap_vol);
|
|
|
a3470f |
}
|
|
|
a3470f |
diff --git a/xlators/mgmt/glusterd/src/glusterd-utils.c b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
a3470f |
index f34e218..bb236df 100644
|
|
|
a3470f |
--- a/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
a3470f |
+++ b/xlators/mgmt/glusterd/src/glusterd-utils.c
|
|
|
a3470f |
@@ -6003,6 +6003,15 @@ glusterd_restart_bricks (glusterd_conf_t *conf)
|
|
|
a3470f |
glusterd_brick_start (volinfo, brickinfo,
|
|
|
a3470f |
_gf_false);
|
|
|
a3470f |
}
|
|
|
a3470f |
+ ret = glusterd_store_volinfo
|
|
|
a3470f |
+ (volinfo, GLUSTERD_VOLINFO_VER_AC_NONE);
|
|
|
a3470f |
+ if (ret) {
|
|
|
a3470f |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
a3470f |
+ GD_MSG_VOLINFO_STORE_FAIL, "Failed to "
|
|
|
a3470f |
+ "write volinfo for volume %s",
|
|
|
a3470f |
+ volinfo->volname);
|
|
|
a3470f |
+ goto out;
|
|
|
a3470f |
+ }
|
|
|
a3470f |
}
|
|
|
a3470f |
}
|
|
|
a3470f |
|
|
|
a3470f |
@@ -6034,6 +6043,16 @@ glusterd_restart_bricks (glusterd_conf_t *conf)
|
|
|
a3470f |
glusterd_brick_start (volinfo, brickinfo,
|
|
|
a3470f |
_gf_false);
|
|
|
a3470f |
}
|
|
|
a3470f |
+ ret = glusterd_store_volinfo
|
|
|
a3470f |
+ (volinfo, GLUSTERD_VOLINFO_VER_AC_NONE);
|
|
|
a3470f |
+ if (ret) {
|
|
|
a3470f |
+ gf_msg (this->name, GF_LOG_ERROR, 0,
|
|
|
a3470f |
+ GD_MSG_VOLINFO_STORE_FAIL, "Failed to "
|
|
|
a3470f |
+ "write volinfo for volume %s",
|
|
|
a3470f |
+ volinfo->volname);
|
|
|
a3470f |
+ goto out;
|
|
|
a3470f |
+ }
|
|
|
a3470f |
+
|
|
|
a3470f |
}
|
|
|
a3470f |
}
|
|
|
a3470f |
ret = 0;
|
|
|
a3470f |
--
|
|
|
a3470f |
1.8.3.1
|
|
|
a3470f |
|