On 27/06/2017 11:47, Vladimir Sementsov-Ogievskiy wrote: > bdrv_enable_dirty_bitmap - writes to the list, it changes 'disabled' > field. So it requires both BQL and dirty_bitmap_mutex? But the comment > says only about BQL.
This one is interesting. There could be a concurrent call to bdrv_set_dirty, indeed. I'll send a patch. > Also, for example, if I want to create a new bitmap and than somehow > change it, should I do it like this: > > bdrv_create_dirty_bitmap(...) > > bdrv_dirty_bitmaps_lock(bs) > > bitmap = bdrv_find_dirty_bitmap(bs, name) > > <some changes> > > bdrv_dirty_bitmaps_unlock(bs) > > - because we can't now trust the pointer returned by > bdrv_create_dirty_bitmap, as it releases bitmap lock before return. If you have the big QEMU lock (you do if you are in the QEMU monitor), you are protected from changes to the list of bitmaps. Paolo