Re: [Qemu-devel] [PATCH v2 for-2.11] block: Make bdrv_next() keep strong references

2017-11-17 Thread Max Reitz
On 2017-11-10 18:25, Max Reitz wrote: > On one hand, it is a good idea for bdrv_next() to return a strong > reference because ideally nearly every pointer should be refcounted. > This fixes intermittent failure of iotest 194. > > On the other, it is absolutely necessary for bdrv_next() itself to k

Re: [Qemu-devel] [PATCH v2 for-2.11] block: Make bdrv_next() keep strong references

2017-11-13 Thread Max Reitz
On 2017-11-11 01:08, Paolo Bonzini wrote: > On 10/11/2017 18:25, Max Reitz wrote: >> if (bs) { >> +bdrv_ref(bs); >> +bdrv_unref(old_bs); >> return bs; >> } > > Maybe instead goto... > >> it->phase = BDRV_NEXT_MONITOR_OWNED; >> +}

Re: [Qemu-devel] [PATCH v2 for-2.11] block: Make bdrv_next() keep strong references

2017-11-13 Thread Stefan Hajnoczi
On Fri, Nov 10, 2017 at 06:25:45PM +0100, Max Reitz wrote: > On one hand, it is a good idea for bdrv_next() to return a strong > reference because ideally nearly every pointer should be refcounted. > This fixes intermittent failure of iotest 194. > > On the other, it is absolutely necessary for bd

Re: [Qemu-devel] [PATCH v2 for-2.11] block: Make bdrv_next() keep strong references

2017-11-10 Thread Paolo Bonzini
On 10/11/2017 18:25, Max Reitz wrote: > if (bs) { > +bdrv_ref(bs); > +bdrv_unref(old_bs); > return bs; > } Maybe instead goto... > it->phase = BDRV_NEXT_MONITOR_OWNED; > +} else { > +old_bs = it->bs; > } > > /

[Qemu-devel] [PATCH v2 for-2.11] block: Make bdrv_next() keep strong references

2017-11-10 Thread Max Reitz
On one hand, it is a good idea for bdrv_next() to return a strong reference because ideally nearly every pointer should be refcounted. This fixes intermittent failure of iotest 194. On the other, it is absolutely necessary for bdrv_next() itself to keep a strong reference to both the BB (in its fi