From: Marian Csontos <mcsontos@redhat.com>
To: lvm-devel@redhat.com
Subject: [PATCHv2 2/4] dmeventd: Fix registration of existing thread
Date: Tue, 22 Sep 2015 13:30:03 +0200 [thread overview]
Message-ID: <56013BBB.3000301@redhat.com> (raw)
In-Reply-To: <1442920570-29969-3-git-send-email-mcsontos@redhat.com>
On 09/22/2015 01:16 PM, Marian Csontos wrote:
> The existing code is handling only new registrations correctly. Extending
> an existing registration does not register for timeout.
> ---
> If the condition should "never occur" we should either handle it or at least
> raise an internal error here as it is likely to occur one day without traces
> what happened.
>
> *TODO* Any ideas how to test this? Is explicitly messaging dmeventd required?
>
> daemons/dmeventd/dmeventd.c | 18 ++++++++++++++++--
> 1 file changed, 16 insertions(+), 2 deletions(-)
>
> diff --git a/daemons/dmeventd/dmeventd.c b/daemons/dmeventd/dmeventd.c
> index 0f67206..ff11625 100644
> --- a/daemons/dmeventd/dmeventd.c
> +++ b/daemons/dmeventd/dmeventd.c
> @@ -1031,6 +1031,7 @@ static int _register_for_event(struct message_data *message_data)
> int ret = 0;
> struct thread_status *thread, *thread_new = NULL;
> struct dso_data *dso_data;
> + enum dm_event_mask orig_events
Lost a semicolon while moving from below :-/
BTW, are we always declaring variables at the top of a function, right?
>
> if (!(dso_data = _lookup_dso(message_data)) &&
> !(dso_data = _load_dso(message_data))) {
> @@ -1087,10 +1088,23 @@ static int _register_for_event(struct message_data *message_data)
> }
>
> LINK_THREAD(thread);
> + } else {
> + /* Or event # into events bitfield. */
> + orig_events = thread->events;
> + thread->events |= message_data->events_field;
> + if ((~orig_events & thread->events & DM_EVENT_TIMEOUT)) {
> + _unlock_mutex();
> + if (!(ret = -_register_for_timeout(thread))) {
> + /* In case previous calls failed we do not
> + * force unregister event. Reset events for
> + * consistency. */
> + _lock_mutex();
> + thread->events &= ~DM_EVENT_TIMEOUT;
> + } else
> + _lock_mutex();
> + }
> }
>
> - /* Or event # into events bitfield. */
> - thread->events |= message_data->events_field;
> _unlock_mutex();
>
> out:
>
next prev parent reply other threads:[~2015-09-22 11:30 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-09-22 11:16 [PATCHv2 0/4] Fix timeout_list handling Marian Csontos
2015-09-22 11:16 ` [PATCHv2 1/4] dmeventd: Fix segfault in _timeout_thread Marian Csontos
2015-09-22 11:16 ` [PATCHv2 2/4] dmeventd: Fix registration of existing thread Marian Csontos
2015-09-22 11:30 ` Marian Csontos [this message]
2015-09-22 11:16 ` [PATCH 3/4] dmeventd: Remove an useless _lock_mutex Marian Csontos
2015-09-22 11:16 ` [PATCH 4/4] dmeventd: Allocate new thread only when needed Marian Csontos
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=56013BBB.3000301@redhat.com \
--to=mcsontos@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.