Re: [RFC PATCH v2 5/8] block.c: wrlock in bdrv_replace_child_noperm

2022-04-29 Thread Emanuele Giuseppe Esposito
Am 28/04/2022 um 15:55 schrieb Stefan Hajnoczi: > On Tue, Apr 26, 2022 at 04:51:11AM -0400, Emanuele Giuseppe Esposito wrote: >> The only problem here is ->attach and ->detach callbacks >> could call bdrv_{un}apply_subtree_drain(), which itself >> will use a rdlock to navigate through all nodes.

Re: [RFC PATCH v2 5/8] block.c: wrlock in bdrv_replace_child_noperm

2022-04-28 Thread Stefan Hajnoczi
On Tue, Apr 26, 2022 at 04:51:11AM -0400, Emanuele Giuseppe Esposito wrote: > The only problem here is ->attach and ->detach callbacks > could call bdrv_{un}apply_subtree_drain(), which itself > will use a rdlock to navigate through all nodes. > To avoid deadlocks, take the lock only outside the dr

Re: [RFC PATCH v2 5/8] block.c: wrlock in bdrv_replace_child_noperm

2022-04-26 Thread Paolo Bonzini
On 4/26/22 10:51, Emanuele Giuseppe Esposito wrote: The only problem here is ->attach and ->detach callbacks could call bdrv_{un}apply_subtree_drain(), which itself will use a rdlock to navigate through all nodes. To avoid deadlocks, take the lock only outside the drains, and if we need to both a