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

Re: [Xen-devel] [PATCH v2 for-4.6 3/3] tools/libxl: Only continue stream operations if the stream is still in progress



Andrew Cooper writes ("[PATCH v2 for-4.6 3/3] tools/libxl: Only continue stream 
operations if the stream is still in progress"):
> Part of the callback contract with check_all_finished() is that each
> running parallel task shall call it exactly once.
...
> @@ -738,14 +738,16 @@ void libxl__xc_domain_restore_done(libxl__egc *egc, 
> void *dcs_void,
>          goto err;
>      }
>  
> -    /*
> -     * Libxc has indicated that it is done with the stream.  Resume reading
> -     * libxl records from it.
> -     */
> -    stream_continue(egc, stream);
> -
>   err:
>      check_all_finished(egc, stream, rc);
> +
> +    if (libxl__stream_read_inuse(stream)) {
> +        /*
> +         * Libxc has indicated that it is done with the stream.  Resume re\
ading
> +         * libxl records from it.
> +         */
> +        stream_continue(egc, stream);
> +    }

This doesn't look convincing to me.  (Also, wrap damage in the
comment.)  It may be possible to prove that it's not buggy, but it's
certainly confusing.  In general the the which sets up the next
callback should be at the end of functions, because that way
reentrancy hazards are more easily seen to be avoided.

Why not just do this:

       /*
        * Libxc has indicated that it is done with the stream.  Resume reading
        * libxl records from it.
        */
       stream_continue(egc, stream);
  +    return;

    err:
       check_all_finished(egc, stream, rc);

?

And the same in the next one.

Ian.

_______________________________________________
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®.