diff mbox series

[PULL,15/22] block/dirty-bitmaps: prohibit removing readonly bitmaps

Message ID 20190312202337.5278-16-jsnow@redhat.com
State New
Headers show
Series [PULL,01/22] block/dirty-bitmap: add recording and busy properties | expand

Commit Message

John Snow March 12, 2019, 8:23 p.m. UTC
Remove is an inherently RW operation, so this will fail anyway, but
we can fail it very quickly instead of trying and failing, so do so.

Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Message-id: 20190301191545.8728-6-jsnow@redhat.com
Signed-off-by: John Snow <jsnow@redhat.com>
---
 blockdev.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
diff mbox series

Patch

diff --git a/blockdev.c b/blockdev.c
index dd841fc5db..1391f4200a 100644
--- a/blockdev.c
+++ b/blockdev.c
@@ -2884,7 +2884,8 @@  void qmp_block_dirty_bitmap_remove(const char *node, const char *name,
         return;
     }
 
-    if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_BUSY, errp)) {
+    if (bdrv_dirty_bitmap_check(bitmap, BDRV_BITMAP_BUSY | BDRV_BITMAP_RO,
+                                errp)) {
         return;
     }