[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Xen-devel] [tools/libxl]: Possible bug in ao_cancel



Hi Ian,

 

I spotted a possible bug in ao_cancel (libxl_event.c) and wanted to run it through you.

In the ao_cancel(), we mark the parent->cancelling = 1 so that subsequence cancel calls don’t get entertained and mess things up. However, in my view, setting this should be after we check for “parent->cancellables”.

 

This is because, if someones invokes libxl_ao_cancel(), while there are no cancellables registered, then further calls to libxl_ao_cancel() should not be rejected – as the first call actually didn’t do anything.

I hope I am making myself clear.

 

index a5a2762..515e0bd 100644

--- a/tools/libxl/libxl_event.c

+++ b/tools/libxl/libxl_event.c

@@ -2032,8 +2032,6 @@ static int ao__cancel(libxl_ctx *ctx, libxl__ao *parent)

         goto out;

     }

 

-    parent->cancelling = 1;

-

     if (LIBXL_LIST_EMPTY(&parent->cancellables)) {

         LIBXL__LOG(ctx, XTL_DEBUG,

                    "ao %p: cancellation requested, but not not implemented",

@@ -2042,6 +2040,8 @@ static int ao__cancel(libxl_ctx *ctx, libxl__ao *parent)

         goto out;

     }

 

+    parent->cancelling = 1;

+

     /* We keep calling cancellation hooks until there are none left */

     while (!LIBXL_LIST_EMPTY(&parent->cancellables)) {

         libxl__egc egc;

 

Regards,

Koushik Chakravarty

https://gotomeet.me/koushikchakravarty

 

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
http://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.