Am 30.05.2025 um 17:11 hat Fiona Ebner geschrieben: > The function bdrv_new() calls bdrv_drained_begin(), which must be > called with the graph unlocked. > > Marking bdrv_new() as GRAPH_UNLOCKED requires making the locked > section in bdrv_open_inherit() shorter. > > Signed-off-by: Fiona Ebner <f.eb...@proxmox.com> > --- > > I'm not sure if the TODO comment is only intended for the > lower half of the function, i.e. is moving it like this okay?
The thing that should require locking is when you attach the new node to something, which is after the place where you moved it to. Currently, these functions take the lock internally, and I'm not sure if that can possibly be changed because opening an image usually involves a mix of I/O to read image metadata (which is incompatible with having a writer lock) and graph changing operations. It's not clear if this TODO can ever be resolved... But I'm not sure if bdrv_new() really should be GRAPH_UNLOCKED. We know that we don't have any active I/O for a node that we only just created and that isn't even linked in the global list yet. So maybe the other option is using bdrv_do_drained_begin_quiesce(bs, NULL) in bdrv_new() instead? Then callers can hold the lock if they want to. Kevin