Commit Graph

757 Commits

Author SHA1 Message Date
Fabio M. Di Nitto
f04d6a561c Remove duplicate code and use the right library call into logsys
that also cover cases that were not handled at all.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1729 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-01-15 12:06:40 +00:00
Fabio M. Di Nitto
dbca1c61b2 Fix small memory leak on config reload operations
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1728 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-01-15 11:33:47 +00:00
Fabio M. Di Nitto
b2836a0fd4 Fix logsys write to file crash.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1727 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-01-14 11:00:23 +00:00
Christine Caulfield
205ea1d44b If there was a quorum {} section in corosync.conf but no provider specified
then  we would always report inquorate.

This was wrong, if no provider is specified then we are always quorate.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1722 fd59a12c-fef9-0310-b244-a6a79926bd2f
2009-01-08 11:12:10 +00:00
Angus Salkeld
c049f8bf21 Fix coverity bug ID 4: remove unused code & fix compile error
In evs_dispatch()  the local ignore_dispatch is not used.
So I have removed this code.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1717 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-12-28 09:25:17 +00:00
Angus Salkeld
aec3b38cde Fix coverity bug ID 1: overused local variable
coverity says that in exec/objdb.c: 1075 the found is always == 1
therefore the code is dead.  But this is just a case of an overused
local variable. "found" is used for two different searches.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1716 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-12-28 09:05:05 +00:00
Angus Salkeld
e58f29f578 Fix coverity bug ID 7: add NULL pointer check
Here coverity checks that if in a function a pointer is checked
for NULL then it is checked through out the function.

So below I have just add some more checks for NULL.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1715 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-12-28 09:01:35 +00:00
Angus Salkeld
2998d698ad Fix coverity bug ID 5
In poll_timer_add() if you pass in a NULL for the callback function
the pointer will be dereferenced.

I have moved the check for the NULL up.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1714 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-12-28 08:55:57 +00:00
Christine Caulfield
795e573c20 If there is no quorum provider specified, then always return quorate.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1713 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-12-19 16:08:25 +00:00
Christine Caulfield
91458d92fa If we exit with an error, set the returned status code for the shell.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1712 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-12-18 08:28:46 +00:00
Angus Salkeld
7750827be8 Don't segfault if the ais group is not found.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1711 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-12-17 17:44:50 +00:00
Christine Caulfield
f5467e33b7 Add config reload support for logsys
If objdb is reloaded, then we re-parse the logging options.

This allows logging options to be changed/enabled/disabled without 
restarting corosync




git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1710 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-12-17 08:34:26 +00:00
Christine Caulfield
bd646b6c39 This patch adds this capability for a limited number of totem keys using
the existing reload mechanism.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1709 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-12-12 11:27:27 +00:00
Christine Caulfield
1fc2f37ba0 Add some missing files, sorry
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1706 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-12-09 13:48:47 +00:00
Christine Caulfield
cfc7da3573 quorum is now an optional loadable module (though I've put it into the
defaults in services.c) and can load another module to do the quorum
work (eg YKD which I've made more compliant too). All the quorum code
has been removed from sync.c. quorum.c is simply a shim later for the
coroapi, the main module is in vsf_quorum.c

There are coroapi calls to query quorate status and also to get
notifications when it changes.

I've included the testquorum.lcrso module in this patch because I think
it's really helpful for testing. It sets the quorum state based on an 
objdb variable, this can be set or cleared using corosync-cfgtool



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1704 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-12-08 15:55:41 +00:00
Steven Dake
6124b2a29a Fix deadlock in logsys during startup.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1703 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-12-02 15:51:03 +00:00
Andrew Beekhof
a3571b016b Correctly compare local addresses with bindnetaddr
This patch allows whitetank/corosync to behave correctly when the supplied value of bindnetaddr has more precision than the netmask, but is not a full IPv4 address.

For example, currently, if the netmask is /16 but the user specifies 192.168.1.0, then OpenAIS is unable to determine the correct address and uses the loopback address instead.

The following patch allows OpenAIS to correctly determine which interface/address to use.


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1702 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-12-02 14:50:51 +00:00
Angus Salkeld
f2f20533fd change get node_id() to return an unsigned int
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1701 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-12-01 18:44:55 +00:00
Christine Caulfield
ccef86ebb9 Don't crash if we get a message for a service that isn't loaded.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1699 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-11-13 09:54:34 +00:00
Christine Caulfield
476bc5e291 Make the port numbers into Network Byte Order.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1698 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-11-13 09:54:09 +00:00
Angus Salkeld
17c0625160 LINT: fix "Assignment of ssize_t to int" warnings
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1696 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-11-11 18:13:47 +00:00
Angus Salkeld
efb280c511 LINT: rename the overlay struct so they are uniq.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1694 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-11-11 17:26:58 +00:00
Angus Salkeld
fd25950970 LINT: fix or ignore unchecked return values.
If we don't care about the return value then typecase the return
value to void.
Else do something useful with the return value.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1693 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-11-11 17:25:22 +00:00
Steven Dake
69b80c7126 Fix missing message in delivery of messages under certain circumstances.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1692 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-11-10 08:58:12 +00:00
Steven Dake
6df910fb4e Fix received_flg to contain proper values.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1691 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-11-10 08:57:50 +00:00
Angus Salkeld
56eaee9561 cleanup the last of the SAF headers and types
This includes the rename of identifiers from corosync to cs.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1689 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-11-06 21:49:07 +00:00
Steven Dake
0db9db340b Make width of service 6 bytes instead of 5.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1688 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-11-06 00:17:19 +00:00
Steven Dake
418739f8f0 Null terminate string which resulted in failure of confdb during logging.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1687 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-11-06 00:17:01 +00:00
Angus Salkeld
bb57c27e56 Add a top level "make lint"
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1684 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-11-01 08:19:18 +00:00
Steven Dake
6198080084 performance loading service engine first implementation.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1682 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-10-30 22:41:34 +00:00
Steven Dake
0c631e24fc Logsys flight recorder.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1681 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-10-30 22:25:56 +00:00
Angus Salkeld
3bc868eb54 Fix a memory violation in objdb (caught by valgrind)
If the new length is larger then memory will be overwritten.

I could make this ">=" but we can save memory if the new size is smaller by using "!=".



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1680 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-10-30 19:32:23 +00:00
Christine Caulfield
44eaef35e0 Currently if a reload operation fails, any subsystems listening for
notifications will get a RELOAD_NOTIFY_START callback but not a
RELOAD_NOTIFY_END callback.

This patch adds a RELOAD_NOTIFY_FAILED callback so that interested
parties will know when the reload has finished and that it failed.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1678 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-10-27 08:25:53 +00:00
Angus Salkeld
301a730dd1 remove some new warnings from corosync
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1677 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-10-21 21:44:29 +00:00
Christine Caulfield
5bb7ca5da5 This is an initial pass at a top-level quorum system. As it stands, this
module doesn't provide quorum itself, merely a framework for setting and
querying it. I envisage YKD plugging into this rather than straight into
sync() eventually.

I've plugged this into the sync() routines rather than replacing them so
that quorum is itself a VSF, rather than a replacement - I'm not sure if
that is best or not. Opinions are welcome.

I've added an extra enum member to the service_handler so that we can
send IPC messages when the cluster isn't quorate. This will default to
NO (as now) but allows us to query and set quorum when we don't have it
.. a useful feature !



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1674 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-10-13 14:27:41 +00:00
Christine Caulfield
f1764d1f56 Add locking around objdb calls so that reloads and writes are atomic.
Also add a notification callback for reload. Both the start and the stop
are notified so that the user can decide what to do with the flurry of 
updates that occur.

Note than the reload callback notification MUST be registered against
OBJECT_PARENT_HANDLE. Registering it lower down the hierarchy makes no sense.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1673 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-10-06 12:14:40 +00:00
Angus Salkeld
f9609f3217 Propagate the flow control state between AIS exec and library
This patch causes the flow control state in the library to be set
properly when the flow control is turned off (disabled).  Then it can be
read properly by the flow control apis.
This also fixes the case where the application is no longer sending
messages and it has already dispatched all its received messages
before flow control is disabled.

Also, CPG response messages with a TRY_AGAIN error did NOT contain
a valid flow control state value. This meant the library could get
stuck with flow control enabled (flow control was never enabled
for the EXEC, so no disable event occurred).
This case was hit when a new node was joining - sync_in_process()
resulted in a TRY_AGAIN for error cpg_mcast_joined).

Also, in message_handler_req_exec_cpg_mcast() the state passed
back to the library defaulted to disabled for messages received
from another node (even if flow control was still enabled)
- this meant if multiple nodes were sending CPG messages,
  then the library flow control state flip-flopped between
  enabled and disabled.

Author: Steven Dake <sdake@redhat.com> &
        Tim Beale <tim.beale@alliedtelesis.co.nz>




git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1667 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-09-17 19:15:00 +00:00
Angus Salkeld
531bd3adec Add support for AMF (sync_request)
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1666 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-09-17 19:04:19 +00:00
Angus Salkeld
9655fa2fea If syslog() blocked, node-leave events were incorrectly reported
In some cases, the syslog() call may block. If this happened, the AIS worker
thread would block waiting on the syslog() call. However, the worker thread
is still holding a logsys mutex, which is needed to enqueue any more log
messages from the other AIS threads. So the main AIS thread blocks waiting
on the logsys mutex. This can then cause aisexec on other nodes to detect
the node as leaving the cluster.

Author: Tim Beale <tim.beale@alliedtelesis.co.nz>


git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1665 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-09-17 18:22:58 +00:00
Fabien Thomas
781946258a use getifaddrs to enumerate interface on FreeBSD and Darwin (patch from Mathieu Virbel)
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1664 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-09-16 15:35:09 +00:00
Christine Caulfield
a7885395d2 Reinstate key_iter_reset that got removed by mistake in 1660
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1663 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-09-03 10:01:31 +00:00
Christine Caulfield
1d2d771f99 This patch adds key_increment and key_decrement calls to the objdb and
confdb subsystems.

This is useful to provide atomic counters (ag handle numbers) for
long-running (though not persistent) connections. It's not currently
possible via confdb to atomically get a new number from objdb due to the
lack of locking. Doing it via increment operations in the IPC thread
provides enough atomicity to make it useful. Fabio has already
identified a use for these calls.

It could also provide some form of basic co-operative locking mechanism
for IPC-using processes (not direct objdb calls).



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1662 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-09-03 07:58:08 +00:00
Christine Caulfield
2bab5b36cc Remove the disliked *_from calls from the objdb and recast
the confdb library to use the new find_create/find_next/find_destroy API
calls instead.

I've kept the libcondfb API the same as before with the single change of
adding a confdb_object_find_destroy to tidy up the find handle after
use. If you don't call this then libcondfb will do it for you when
confdb_finalize is called.



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1660 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-08-26 07:34:22 +00:00
Angus Salkeld
b56ce92fab Zero out unused totemsrp my_proc_list entries
When making my_proc_list smaller, ensure that the
now non-used entries are zero-ed out. There are some suspect
assert's that assume that there is always 2 entries in the list.
These fail when my_proc_list is reduced to 1 entry (and the
valid [0] entry is the same as the 'unused' [1] entry).

Author: Mark Wutzke <mark.wutzke@alliedtelesis.co.nz>



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1659 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-08-20 01:07:29 +00:00
Angus Salkeld
5828bee144 aisexec crash on exit
Cause:
As part of its exit procedure, ais cancels its worker thread then manually
processes any outstanding items that were still in the worker thread's queue.
The worker thread has a low priority so normally it does not execute any
further before ais finishes exiting, but if the main thread's exiting is
delayed for any reason, there is a chance the worker thread could execute and
try to process items which have already been processed and freed by the main
thread - often leading to the worker thread seeing NULL data and ultimately
causing a segmentation fault.

Fix:
Modified worker_thread_group_exit() so it does a pthread_join() after the
pthread_cancel() call, so that the worker thread always shuts down cleanly
before the main thread does its cleanup.

Author: Author: Mark McKinstry <mark.mckinstry@alliedtelesis.co.nz>




git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1658 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-08-20 01:02:43 +00:00
Angus Salkeld
280ef18d61 Fix to display strings safely in debug messages.
Display strings safely, even if they are invalid, e.g. data in a received
message was corrupted.

Author: Tim Beale <tim.beale@alliedtelesis.co.nz>



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1657 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-08-20 01:00:44 +00:00
Angus Salkeld
31aa88aefb Provide a way to configure (at compile time) message and queue sizes.
This patch makes it possible to override the following #defines:
MESSAGE_SIZE_MAX
MESSAGE_QUEUE_MAX
SIZEQUEUE
FLOW_CONTROL_ENTRIES_ENABLE

If MESSAGE_SIZE_MAX is defined as 1024*64 (64K) and
MESSAGE_QUEUE_MAX defined as 512 you can change corosync's
memory footprint from ~48M to ~8M

So if you define MESSAGE_QUEUE_MAX, the queue size will
not be based on the message size any more.

To use this define the defines on the command line:
make CFLAGS="-DMESSAGE_SIZE_MAX=1024*64 -DMESSAGE_QUEUE_MAX=512"



git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1656 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-08-20 00:57:40 +00:00
Steven Dake
01b8bc6ab2 Finish the renaming of openais to corosync in the tree.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1646 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-08-15 06:15:26 +00:00
Steven Dake
dd3991c0bb Proper rename of openais usage to corosync throughout tree.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1637 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-08-14 16:54:46 +00:00
Steven Dake
e1f531380a Revert patch 1633 which breaks build.
git-svn-id: http://svn.fedorahosted.org/svn/corosync/trunk@1636 fd59a12c-fef9-0310-b244-a6a79926bd2f
2008-08-14 16:44:26 +00:00