From mboxrd@z Thu Jan 1 00:00:00 1970 From: Bamvor Jian Zhang Subject: [PATCH 2/2] call ao_how callback explicitly Date: Tue, 5 Nov 2013 17:22:11 +0800 Message-ID: <1383643331-6703-3-git-send-email-bjzhang@suse.com> References: <1383643331-6703-1-git-send-email-bjzhang@suse.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1383643331-6703-1-git-send-email-bjzhang@suse.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org To: xen-devel@lists.xen.org Cc: jfehlig@suse.com, Bamvor Jian Zhang , ian.jackson@eu.citrix.com, ian.campbell@citrix.com, stefano.stabellini@eu.citrix.com List-Id: xen-devel@lists.xenproject.org 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 --- 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