On Fri, May 05, 2017 at 06:19:55PM +0800, Fam Zheng wrote: > On Fri, 05/05 11:02, Stefan Hajnoczi wrote: > > diff --git a/include/block/aio.h b/include/block/aio.h > > index 406e323..b3d6f76 100644 > > --- a/include/block/aio.h > > +++ b/include/block/aio.h > > @@ -454,8 +454,14 @@ static inline void aio_disable_external(AioContext > > *ctx) > > */ > > static inline void aio_enable_external(AioContext *ctx) > > { > > - assert(ctx->external_disable_cnt > 0); > > - atomic_dec(&ctx->external_disable_cnt); > > + int old; > > + > > + old = atomic_dec_fetch(&ctx->external_disable_cnt); > > Did you mean atomic_fetch_dec? atomic_dec_fetch is new, not old.
Yes :(. Will send another revision. It's good to have both semantics available but clearer naming would help, e.g. atomic_dec_then_fetch() or atomic_dec_before_fetch(). Glad you spotted the bug! Stefan
signature.asc
Description: PGP signature