Ignore sync barrier msgs if sync doesn't started

On start of corosync, we can receive sync barrier message. If so,
our sync_ring_id is set to NULL, and memcpy of message ring_id will
segfault. Instead of that, sync barrier message is ignored if
sync_ring_id is NULL.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
If failed_to_recv is set, consensus can be empty

If failed_to_recv is set (node detect itself not able to receive
message), we can end up with assert, because my_failed_list and
my_member_list are same list. This is happening because we are not
following specification and we allow to mark node itself as failed.
Because if failed_to_recv is set and we reached consensus across nodes,
single node membership is created (ignoring both fail list and
member_list), we can skip assert.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
(cherry picked from commit d4db2ea5353c8eedb64a88ae413c04e0757378c9)
Fix minor errors in man page documentation for corosync.conf

* Correct 'See Also' reference to corosync.conf(5) in corosync(8) man page
* Update path to default config (now /etc/corosync/corosync.conf)

Signed-off-by: Zane Bitter <zane.bitter@gmail.com>
Reviewed-by: Steven Dake <sdake@redhat.com>
(cherry picked from commit 230352512595462ea01dfa27bc8c7e81e5adbff3)
manpages: Fix typo in evs* manpages

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
manpages: Add links for referenced confdb calls

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
manpages: Add confdb_key_get man page

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Add link to confdb_keys in corosync-objctl mpage

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Track changes for confdb logging object

This makes possible to track changes in logging object (and it's
sub objects) for changes, so reload is no longer needed.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Don't call reload on corosync-objctl actions

confdb reload is used only for reloading of file, not for triggering
changes.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Fix problem with sync operations under very rare circumstances

This patch creates a special message queue for synchronization messages.
This prevents a situation in which messages are queued in the
new_message_queue but have not yet been originated from corrupting the
synchronization process.

Signed-off-by: Steven Dake <sdake@redhat.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
(backport from needle)
Handle segfault in backlog_get

If instance->memb_state is not OPERATION or RECOVERY, we was passing
NULL to cs_queue_used call.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
(backport from needle)
Add waiting_trans_ack also to fragmentation layer

Patch for support waiting_trans_ack may fail if there is synchronization
happening between delivery of fragmented message. In such situation,
fragmentation layer is waiting for message with correct number, but it
will never arrive.

Solution is to handle (callback) change of waiting_trans_ack and use
different queue.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
(backported from neddle)
objdb: Don't read uninitialized memory in inc/dec

When object_key_increment or _decrement is called on [u]int16 value,
uninitialized value is read as result value.

Solution is to read really only 16-bits.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
log: Handle race in printf_to_logs and format_set

When logsys_format_set is called, it can set format to NULL and if
logsys thread is actually reading it, corosync can segfault (NULL
pointer access).

Solution is to lock format in log_printf_to_logs function.

Signed-off-by: jason <huzhijiang@gmail.com>
Reviewed-by: Jan Friesse <jfriesse@redhat.com>
log: Avoid deadlock caused by previous commit

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
coroipc: Don't spin when waiting on semaphore

Set timeout correctly before each call of sem_timedwait.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
On places with POLLERR check also POLLNVAL

POLLNVAL is returned on invalid FD. We must also check it.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
Check socket_recv error code in ipc_dispatch_get

Also do not assert on error.

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>
coroipc: Handle pfd.revents as bit-field

Signed-off-by: Jan Friesse <jfriesse@redhat.com>
Reviewed-by: Fabio M. Di Nitto <fdinitto@redhat.com>