From: Bamvor Jian Zhang <bjzhang@suse.com>
To: xen-devel@lists.xen.org
Cc: jfehlig@suse.com, Bamvor Jian Zhang <bjzhang@suse.com>,
ian.jackson@eu.citrix.com, ian.campbell@citrix.com,
stefano.stabellini@eu.citrix.com
Subject: [PATCH 2/2] call ao_how callback explicitly
Date: Tue, 5 Nov 2013 17:22:11 +0800 [thread overview]
Message-ID: <1383643331-6703-3-git-send-email-bjzhang@suse.com> (raw)
In-Reply-To: <1383643331-6703-1-git-send-email-bjzhang@suse.com>
ao_how callback is not called after inserted into list.
in my test, i directly call it in
libxl__ao_complete_check_progress_reports. i know it should not
work like this. Could you give some suggestion about it?
Signed-off-by: Bamvor Jian Zhang <bjzhang@suse.com>
---
tools/libxl/libxl_event.c | 18 ++++++++++++++++++
tools/libxl/libxl_internal.h | 1 +
2 files changed, 19 insertions(+)
diff --git a/tools/libxl/libxl_event.c b/tools/libxl/libxl_event.c
index 0fe4428..8320547 100644
--- a/tools/libxl/libxl_event.c
+++ b/tools/libxl/libxl_event.c
@@ -1578,6 +1578,23 @@ void libxl__ao_complete(libxl__egc *egc, libxl__ao *ao, int rc)
libxl__ao_complete_check_progress_reports(egc, ao);
}
+void libxl__ao_occurred(libxl__egc *egc)
+{
+ EGC_GC;
+ libxl__ao *ao, *ao_tmp;
+ LIBXL_TAILQ_FOREACH_SAFE(ao, &egc->aos_for_callback,
+ entry_for_callback, ao_tmp) {
+ LIBXL_TAILQ_REMOVE(&egc->aos_for_callback, ao, entry_for_callback);
+ LOG(DEBUG,"ao %p: completion callback", ao);
+ ao->how.callback(CTX, ao->rc, ao->how.u.for_callback);
+ CTX_LOCK;
+ ao->notified = 1;
+ if (!ao->in_initiator)
+ libxl__ao__destroy(CTX, ao);
+ CTX_UNLOCK;
+ }
+}
+
void libxl__ao_complete_check_progress_reports(libxl__egc *egc, libxl__ao *ao)
{
/*
@@ -1601,6 +1618,7 @@ void libxl__ao_complete_check_progress_reports(libxl__egc *egc, libxl__ao *ao)
} else if (ao->how.callback) {
LIBXL__LOG(ctx, XTL_DEBUG, "ao %p: complete for callback",ao);
LIBXL_TAILQ_INSERT_TAIL(&egc->aos_for_callback, ao, entry_for_callback);
+ libxl__ao_occurred(egc);
} else {
libxl_event *ev;
ev = NEW_EVENT(egc, OPERATION_COMPLETE, ao->domid, ao->how.u.for_event);
diff --git a/tools/libxl/libxl_internal.h b/tools/libxl/libxl_internal.h
index 4f92522..bed775d 100644
--- a/tools/libxl/libxl_internal.h
+++ b/tools/libxl/libxl_internal.h
@@ -1760,6 +1760,7 @@ _hidden int libxl__ao_inprogress(libxl__ao *ao,
const char *file, int line, const char *func); /* temporarily unlocks */
_hidden void libxl__ao_abort(libxl__ao *ao);
_hidden void libxl__ao_complete(libxl__egc *egc, libxl__ao *ao, int rc);
+_hidden void libxl__ao_occurred(libxl__egc *egc);
_hidden libxl__gc *libxl__ao_inprogress_gc(libxl__ao *ao);
/* Can be called at any time. Use is essential for any aop user. */
--
1.8.1.4
next prev parent reply other threads:[~2013-11-05 9:22 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-11-05 9:22 [PATCH 0/2] question on libxl ao Bamvor Jian Zhang
2013-11-05 9:22 ` [PATCH 1/2] expose child fd in order to handle child exit in libvirt Bamvor Jian Zhang
2013-11-05 16:05 ` [PATCH 0/2] question on libxl ao [and 1 more messages] Ian Jackson
2013-11-05 19:19 ` [PATCH 0/3] libxl: event system: SIGCHLD related fixes Ian Jackson
2013-11-05 19:19 ` [PATCH 1/3] libxl: event system: pass gc, not just ctx, to internal sigchld manipulators Ian Jackson
2013-11-06 10:30 ` Ian Campbell
2013-11-05 19:19 ` [PATCH 2/3] libxl: event system: Make libxl_sigchld_owner_libxl_always work Ian Jackson
2013-11-06 10:34 ` Ian Campbell
2013-11-05 19:19 ` [PATCH 3/3] libxl: event system: properly register the SIGCHLD self-pipe Ian Jackson
2013-11-06 10:36 ` Ian Campbell
2013-11-06 10:38 ` [PATCH 0/3] libxl: event system: SIGCHLD related fixes Ian Campbell
2013-11-06 12:08 ` Ian Jackson
2013-11-12 18:27 ` [PATCH v2 " Ian Jackson
2013-11-12 18:27 ` [PATCH 1/3] libxl: event system: pass gc, not just ctx, to internal sigchld manipulators Ian Jackson
2013-11-12 18:27 ` [PATCH 2/3] libxl: event system: Make libxl_sigchld_owner_libxl_always work Ian Jackson
2013-11-12 18:27 ` [PATCH 3/3] libxl: event system: properly register the SIGCHLD self-pipe Ian Jackson
2013-11-13 10:02 ` [PATCH v2 0/3] libxl: event system: SIGCHLD related fixes Ian Campbell
2013-11-21 18:49 ` Ian Jackson
2013-11-20 4:28 ` Jim Fehlig
2013-11-20 15:22 ` 答复: " Bamvor Jian Zhang
2013-11-20 16:40 ` 答复: Re: [PAT CH " Ian Jackson
2013-11-07 3:00 ` [PATCH 0/2] question on libxl ao [and 1 more messages] Bamvor Jian Zhang
2013-11-05 19:23 ` [PATCH 0/2] question on libxl ao [and 1 more messages] " Ian Jackson
2013-11-05 9:22 ` Bamvor Jian Zhang [this message]
2013-11-05 15:51 ` [PATCH 2/2] call ao_how callback explicitly Ian Jackson
2013-11-07 14:51 ` Bamvor Jian Zhang
2013-11-07 17:03 ` Ian Jackson
2013-11-08 13:17 ` Bamvor Jian Zhang
2013-11-08 16:07 ` Ian Jackson
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=1383643331-6703-3-git-send-email-bjzhang@suse.com \
--to=bjzhang@suse.com \
--cc=ian.campbell@citrix.com \
--cc=ian.jackson@eu.citrix.com \
--cc=jfehlig@suse.com \
--cc=stefano.stabellini@eu.citrix.com \
--cc=xen-devel@lists.xen.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).