Re: [Qemu-devel] [PATCH 04/21] block: Add bdrv_close_all() handlers

2015-01-29 Thread Paolo Bonzini
On 28/01/2015 23:56, Max Reitz wrote: > Somehow I lost track of that final detail (I blame Christmas and New > Year), so that's indeed what we decided upon. I will implement it in v2 > (an eject notifier for BBs, which is then used by NBD). Yeah, I was thinking again about it and an eject notifi

Re: [Qemu-devel] [PATCH 04/21] block: Add bdrv_close_all() handlers

2015-01-28 Thread Max Reitz
On 2015-01-28 at 17:05, Eric Blake wrote: On 01/26/2015 02:22 PM, Paolo Bonzini wrote: On 26/01/2015 22:13, Max Reitz wrote: An eject blocker would also break backwards-compatibility though. What about an eject notifier? Would that concept make sense? It does make sense (in that it is the w

Re: [Qemu-devel] [PATCH 04/21] block: Add bdrv_close_all() handlers

2015-01-28 Thread Max Reitz
On 2015-01-28 at 17:44, Eric Blake wrote: On 01/26/2015 12:27 PM, Max Reitz wrote: Every time a reference to a BlockBackend is taken, a notifier for bdrv_close_all() has to be deposited so the reference holder can relinquish its reference when bdrv_close_all() is called. That notifier should be

Re: [Qemu-devel] [PATCH 04/21] block: Add bdrv_close_all() handlers

2015-01-28 Thread Eric Blake
On 01/26/2015 12:27 PM, Max Reitz wrote: > Every time a reference to a BlockBackend is taken, a notifier for > bdrv_close_all() has to be deposited so the reference holder can > relinquish its reference when bdrv_close_all() is called. That notifier > should be revoked on a bdrv_unref() call. > I

Re: [Qemu-devel] [PATCH 04/21] block: Add bdrv_close_all() handlers

2015-01-28 Thread Eric Blake
On 01/26/2015 02:22 PM, Paolo Bonzini wrote: > > > On 26/01/2015 22:13, Max Reitz wrote: >>> An eject blocker would also break backwards-compatibility though. What >>> about an eject notifier? Would that concept make sense? >> >> It does make sense (in that it is the way I would implement

Re: [Qemu-devel] [PATCH 04/21] block: Add bdrv_close_all() handlers

2015-01-26 Thread Paolo Bonzini
On 26/01/2015 22:13, Max Reitz wrote: >>> >> An eject blocker would also break backwards-compatibility though. What >> about an eject notifier? Would that concept make sense? > > It does make sense (in that it is the way I would implement "just do > what we always did"), but I just don't like

Re: [Qemu-devel] [PATCH 04/21] block: Add bdrv_close_all() handlers

2015-01-26 Thread Max Reitz
On 2015-01-26 at 16:10, Paolo Bonzini wrote: On 26/01/2015 21:43, Max Reitz wrote: If the NBD server is attached to the BDS, it should keep serving the BDS. The problem is that it is no longer attached to the BDS, but to the BB. That's not necessarily a problem. :) It is the cause of the pro

Re: [Qemu-devel] [PATCH 04/21] block: Add bdrv_close_all() handlers

2015-01-26 Thread Paolo Bonzini
On 26/01/2015 21:43, Max Reitz wrote: >> If the NBD server is attached to the BDS, it should keep serving the BDS. > > The problem is that it is no longer attached to the BDS, but to the BB. That's not necessarily a problem. :) It is the cause of the problem though. Is it possible to attach t

Re: [Qemu-devel] [PATCH 04/21] block: Add bdrv_close_all() handlers

2015-01-26 Thread Max Reitz
On 2015-01-26 at 15:40, Paolo Bonzini wrote: On 26/01/2015 20:27, Max Reitz wrote: However, this was wrong: With the NBD attached to some BB, it should stay attached until the NBD export is removed or the server stopped; medium ejection should have nothing to do with this (other than the NBD se

Re: [Qemu-devel] [PATCH 04/21] block: Add bdrv_close_all() handlers

2015-01-26 Thread Paolo Bonzini
On 26/01/2015 20:27, Max Reitz wrote: > However, this was wrong: With the NBD attached to some BB, it > should stay attached until the NBD export is removed or the server > stopped; medium ejection should have nothing to do with this (other than > the NBD server not being able to read data while

[Qemu-devel] [PATCH 04/21] block: Add bdrv_close_all() handlers

2015-01-26 Thread Max Reitz
Every time a reference to a BlockBackend is taken, a notifier for bdrv_close_all() has to be deposited so the reference holder can relinquish its reference when bdrv_close_all() is called. That notifier should be revoked on a bdrv_unref() call. Add a Notifier * parameter to all the functions chang