Re: [Qemu-devel] [PATCH for-2.11] block: Keep strong reference when draining all BDS

2017-11-10 Thread Max Reitz
On 2017-11-10 17:22, Kevin Wolf wrote: > Am 10.11.2017 um 17:13 hat Max Reitz geschrieben: >> On 2017-11-10 17:05, Kevin Wolf wrote: >>> Am 10.11.2017 um 16:23 hat Max Reitz geschrieben: On 2017-11-10 14:32, Fam Zheng wrote: > On Fri, 11/10 14:17, Kevin Wolf wrote: >> Do you actually

Re: [Qemu-devel] [PATCH for-2.11] block: Keep strong reference when draining all BDS

2017-11-10 Thread Kevin Wolf
Am 10.11.2017 um 17:13 hat Max Reitz geschrieben: > On 2017-11-10 17:05, Kevin Wolf wrote: > > Am 10.11.2017 um 16:23 hat Max Reitz geschrieben: > >> On 2017-11-10 14:32, Fam Zheng wrote: > >>> On Fri, 11/10 14:17, Kevin Wolf wrote: > Do you actually need to keep references to all BDSes in

Re: [Qemu-devel] [PATCH for-2.11] block: Keep strong reference when draining all BDS

2017-11-10 Thread Max Reitz
On 2017-11-10 17:05, Kevin Wolf wrote: > Am 10.11.2017 um 16:23 hat Max Reitz geschrieben: >> On 2017-11-10 14:32, Fam Zheng wrote: >>> On Fri, 11/10 14:17, Kevin Wolf wrote: Do you actually need to keep references to all BDSes in the whole list while using the iterator or would it be

Re: [Qemu-devel] [PATCH for-2.11] block: Keep strong reference when draining all BDS

2017-11-10 Thread Kevin Wolf
Am 10.11.2017 um 16:23 hat Max Reitz geschrieben: > On 2017-11-10 14:32, Fam Zheng wrote: > > On Fri, 11/10 14:17, Kevin Wolf wrote: > >> Do you actually need to keep references to all BDSes in the whole list > >> while using the iterator or would it be enough to just keep a reference > >> to the

Re: [Qemu-devel] [PATCH for-2.11] block: Keep strong reference when draining all BDS

2017-11-10 Thread Fam Zheng
On Fri, 11/10 16:23, Max Reitz wrote: > But bdrv_unref() is safe only in the main loop. Without having checked, > I'm not sure whether all callers of bdrv_next() are running in the main > loop. They must be. The reasoning is simple: 1) one needs to acquire the ctx of all the BDSes for safe

Re: [Qemu-devel] [PATCH for-2.11] block: Keep strong reference when draining all BDS

2017-11-10 Thread Max Reitz
On 2017-11-10 14:32, Fam Zheng wrote: > On Fri, 11/10 14:17, Kevin Wolf wrote: >> Am 10.11.2017 um 03:45 hat Fam Zheng geschrieben: >>> On Thu, 11/09 21:43, Max Reitz wrote: Draining a BDS may lead to graph modifications, which in turn may result in it and other BDS being stripped of

Re: [Qemu-devel] [PATCH for-2.11] block: Keep strong reference when draining all BDS

2017-11-10 Thread Max Reitz
On 2017-11-10 10:19, Stefan Hajnoczi wrote: > On Thu, Nov 09, 2017 at 09:43:15PM +0100, Max Reitz wrote: >> Draining a BDS may lead to graph modifications, which in turn may result >> in it and other BDS being stripped of their current references. If >> bdrv_drain_all_begin() and

Re: [Qemu-devel] [PATCH for-2.11] block: Keep strong reference when draining all BDS

2017-11-10 Thread Fam Zheng
On Fri, 11/10 14:17, Kevin Wolf wrote: > Am 10.11.2017 um 03:45 hat Fam Zheng geschrieben: > > On Thu, 11/09 21:43, Max Reitz wrote: > > > Draining a BDS may lead to graph modifications, which in turn may result > > > in it and other BDS being stripped of their current references. If > > >

Re: [Qemu-devel] [PATCH for-2.11] block: Keep strong reference when draining all BDS

2017-11-10 Thread Kevin Wolf
Am 10.11.2017 um 03:45 hat Fam Zheng geschrieben: > On Thu, 11/09 21:43, Max Reitz wrote: > > Draining a BDS may lead to graph modifications, which in turn may result > > in it and other BDS being stripped of their current references. If > > bdrv_drain_all_begin() and bdrv_drain_all_end() do not

Re: [Qemu-devel] [PATCH for-2.11] block: Keep strong reference when draining all BDS

2017-11-10 Thread Stefan Hajnoczi
On Thu, Nov 09, 2017 at 09:43:15PM +0100, Max Reitz wrote: > Draining a BDS may lead to graph modifications, which in turn may result > in it and other BDS being stripped of their current references. If > bdrv_drain_all_begin() and bdrv_drain_all_end() do not keep strong > references themselves,

Re: [Qemu-devel] [PATCH for-2.11] block: Keep strong reference when draining all BDS

2017-11-09 Thread Fam Zheng
On Thu, 11/09 21:43, Max Reitz wrote: > Draining a BDS may lead to graph modifications, which in turn may result > in it and other BDS being stripped of their current references. If > bdrv_drain_all_begin() and bdrv_drain_all_end() do not keep strong > references themselves, the BDS they are

Re: [Qemu-devel] [PATCH for-2.11] block: Keep strong reference when draining all BDS

2017-11-09 Thread Eric Blake
On 11/09/2017 02:43 PM, Max Reitz wrote: > Draining a BDS may lead to graph modifications, which in turn may result > in it and other BDS being stripped of their current references. If > bdrv_drain_all_begin() and bdrv_drain_all_end() do not keep strong > references themselves, the BDS they are

[Qemu-devel] [PATCH for-2.11] block: Keep strong reference when draining all BDS

2017-11-09 Thread Max Reitz
Draining a BDS may lead to graph modifications, which in turn may result in it and other BDS being stripped of their current references. If bdrv_drain_all_begin() and bdrv_drain_all_end() do not keep strong references themselves, the BDS they are trying to drain (or undrain) may disappear right