From: Fabio M. Di Nitto <fdinitto@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCH] clvmd-corosync: use libquorum callbacks instead of polling
Date: Tue, 07 Feb 2012 09:55:10 +0100 [thread overview]
Message-ID: <4F30E6EE.5080102@redhat.com> (raw)
In-Reply-To: <1328539700-909-1-git-send-email-fdinitto@redhat.com>
Please disregard this patch, it?s not correct.
Fabio
On 2/6/2012 3:48 PM, Fabio M. Di Nitto wrote:
> From: "Fabio M. Di Nitto" <fdinitto@redhat.com>
>
> clvmd polls for quorum status every minute (from the main loop).
> With the new libquorum, this is unnecessary since clvmd can receive
> quorum updates via callbacks.
>
> Signed-off-by: Fabio M. Di Nitto <fdinitto@redhat.com>
> ---
> daemons/clvmd/clvmd-corosync.c | 42 +++++++++++++++++++++++++++++++++++++++-
> 1 files changed, 41 insertions(+), 1 deletions(-)
>
> diff --git a/daemons/clvmd/clvmd-corosync.c b/daemons/clvmd/clvmd-corosync.c
> index d85ec1e..eaab023 100644
> --- a/daemons/clvmd/clvmd-corosync.c
> +++ b/daemons/clvmd/clvmd-corosync.c
> @@ -83,9 +83,24 @@ cpg_callbacks_t corosync_cpg_callbacks = {
> .cpg_confchg_fn = corosync_cpg_confchg_callback,
> };
>
> +static int quorate = 0;
> +
> +#ifdef QUORUM_SET
> +static void quorum_notification_callback(
> + quorum_handle_t handle,
> + uint32_t quorate,
> + uint64_t ring_id,
> + uint32_t view_list_entries,
> + uint32_t *view_list);
> +
> +quorum_callbacks_t quorum_callbacks = {
> + .quorum_notify_fn = quorum_notification_callback
> +};
> +#else
> quorum_callbacks_t quorum_callbacks = {
> .quorum_notify_fn = NULL,
> };
> +#endif
>
> struct node_info
> {
> @@ -307,6 +322,14 @@ static int _init_cluster(void)
> DEBUGLOG("Corosync quorum service is not configured");
> return EINVAL;
> }
> +
> + /* Initiliaze quorate status before callbacks */
> + if (quorum_getquorate(quorum_handle, &quorate) != CS_OK) {
> + syslog(LOG_ERR, "Unable to determine quorate status for this node");
> + DEBUGLOG("Unable to determine quorate status for this node\n");
> + quorate = 0;
> + }
> + DEBUGLOG("Initial quorate status: %u\n", quorate);
> #else
> err = quorum_initialize(&quorum_handle,
> &quorum_callbacks);
> @@ -528,14 +551,31 @@ static int _unlock_resource(const char *resource, int lockid)
> return 0;
> }
>
> +#ifdef QUORUM_SET
> +static void quorum_notification_callback(
> + quorum_handle_t handle,
> + uint32_t quorate_status,
> + uint64_t ring_id,
> + uint32_t view_list_entries,
> + uint32_t *view_list)
> +{
> + DEBUGLOG("quorum_notification_callback. quorate: %u", quorate_status);
> + quorate = quorate_status;
> +}
> +
> +static int _is_quorate()
> +{
> + return quorate;
> +}
> +#else
> static int _is_quorate()
> {
> - int quorate;
> if (quorum_getquorate(quorum_handle, &quorate) == CS_OK)
> return quorate;
> else
> return 0;
> }
> +#endif
>
> static int _get_main_cluster_fd(void)
> {
prev parent reply other threads:[~2012-02-07 8:55 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-02-06 14:48 [PATCH] clvmd-corosync: use libquorum callbacks instead of polling Fabio M. Di Nitto
2012-02-07 8:55 ` Fabio M. Di Nitto [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=4F30E6EE.5080102@redhat.com \
--to=fdinitto@redhat.com \
--cc=lvm-devel@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.