Backport IPCS fix from master
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
This commit is contained in:
parent
625451f43f
commit
8fbedd4f31
@ -17,11 +17,12 @@
|
||||
Name: corosync
|
||||
Summary: The Corosync Cluster Engine and Application Programming Interfaces
|
||||
Version: 2.0.0
|
||||
Release: 1%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}
|
||||
Release: 2%{?numcomm:.%{numcomm}}%{?alphatag:.%{alphatag}}%{?dirty:.%{dirty}}%{?dist}
|
||||
License: BSD
|
||||
Group: System Environment/Base
|
||||
URL: http://ftp.corosync.org
|
||||
Source0: ftp://ftp:user@ftp.corosync.org/downloads/%{name}-%{version}/%{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}.tar.gz
|
||||
Patch0: ipcs_allow_connections_only_after_all_services_are_ready.patch
|
||||
|
||||
# Runtime bits
|
||||
Requires: corosynclib = %{version}-%{release}
|
||||
@ -61,6 +62,7 @@ BuildRoot: %(mktemp -ud %{_tmppath}/%{name}-%{version}-%{release}-XXXXXX)
|
||||
|
||||
%prep
|
||||
%setup -q -n %{name}-%{version}%{?numcomm:.%{numcomm}}%{?alphatag:-%{alphatag}}%{?dirty:-%{dirty}}
|
||||
%patch0 -p1
|
||||
|
||||
%build
|
||||
%if %{buildtrunk}
|
||||
@ -291,6 +293,9 @@ The Corosync Cluster Engine APIs.
|
||||
%{_mandir}/man8/quorum_overview.8*
|
||||
|
||||
%changelog
|
||||
* Tue Apr 17 2012 Fabio M. Di Nitto <fdinitto@redhat.com> - 2.0.0-2
|
||||
- Backport IPCS fix from master (ack by Steven)
|
||||
|
||||
* Tue Apr 10 2012 Jan Friesse <jfriesse@redhat.com> - 2.0.0-1
|
||||
- New upstream release
|
||||
|
||||
|
@ -0,0 +1,77 @@
|
||||
commit b34c1e28704fef38fb3f5eb1a0b418c84a2f0863
|
||||
Author: Fabio M. Di Nitto <fdinitto@redhat.com>
|
||||
Date: Mon Apr 16 13:39:03 2012 +0200
|
||||
|
||||
ipcs: allow connections only after all services are ready
|
||||
|
||||
this fixes a rather annoying race condition at startup where a client
|
||||
connects to corosync "too fast" before the service is ready to operate
|
||||
and client gets some random data during initialization phase.
|
||||
|
||||
With this fix, we allow connections to ipc only after the main engine
|
||||
is operational and configured (and after the first totem transition).
|
||||
|
||||
Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
|
||||
Reviewed-by: Angus Salkeld <asalkeld@redhat.com>
|
||||
|
||||
diff --git a/exec/ipc_glue.c b/exec/ipc_glue.c
|
||||
index c1d6034..592f9f6 100644
|
||||
--- a/exec/ipc_glue.c
|
||||
+++ b/exec/ipc_glue.c
|
||||
@@ -69,6 +69,7 @@ static int32_t ipc_not_enough_fds_left = 0;
|
||||
static int32_t ipc_fc_is_quorate; /* boolean */
|
||||
static int32_t ipc_fc_totem_queue_level; /* percentage used */
|
||||
static int32_t ipc_fc_sync_in_process; /* boolean */
|
||||
+static int32_t ipc_allow_connections = 0; /* boolean */
|
||||
|
||||
struct cs_ipcs_mapper {
|
||||
int32_t id;
|
||||
@@ -149,6 +150,11 @@ static const char* cs_ipcs_serv_short_name(int32_t service_id)
|
||||
return name;
|
||||
}
|
||||
|
||||
+void cs_ipc_allow_connections(int32_t allow)
|
||||
+{
|
||||
+ ipc_allow_connections = allow;
|
||||
+}
|
||||
+
|
||||
int32_t cs_ipcs_service_destroy(int32_t service_id)
|
||||
{
|
||||
if (ipcs_mapper[service_id].inst) {
|
||||
@@ -164,6 +170,11 @@ static int32_t cs_ipcs_connection_accept (qb_ipcs_connection_t *c, uid_t euid, g
|
||||
uint8_t u8;
|
||||
char key_name[ICMAP_KEYNAME_MAXLEN];
|
||||
|
||||
+ if (!ipc_allow_connections) {
|
||||
+ log_printf(LOGSYS_LEVEL_DEBUG, "Denied connection, corosync is not ready");
|
||||
+ return -EAGAIN;
|
||||
+ }
|
||||
+
|
||||
if (corosync_service[service] == NULL ||
|
||||
corosync_service_exiting[service] ||
|
||||
ipcs_mapper[service].inst == NULL) {
|
||||
diff --git a/exec/main.c b/exec/main.c
|
||||
index 474e0c2..2f3d242 100644
|
||||
--- a/exec/main.c
|
||||
+++ b/exec/main.c
|
||||
@@ -252,6 +252,7 @@ static void corosync_sync_completed (void)
|
||||
sync_in_process = 0;
|
||||
|
||||
cs_ipcs_sync_state_changed(sync_in_process);
|
||||
+ cs_ipc_allow_connections(1);
|
||||
}
|
||||
|
||||
static int corosync_sync_callbacks_retrieve (
|
||||
diff --git a/exec/main.h b/exec/main.h
|
||||
index 9d27670..13b7e12 100644
|
||||
--- a/exec/main.h
|
||||
+++ b/exec/main.h
|
||||
@@ -119,6 +119,8 @@ extern void cs_ipc_refcnt_inc(void *conn);
|
||||
|
||||
extern void cs_ipc_refcnt_dec(void *conn);
|
||||
|
||||
+extern void cs_ipc_allow_connections(int32_t allow);
|
||||
+
|
||||
int coroparse_configparse (const char **error_string);
|
||||
|
||||
#endif /* MAIN_H_DEFINED */
|
Loading…
Reference in New Issue
Block a user