qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [Qemu-block] [PATCH v2 04/17] qmp: Add block-dirty-bitm


From: John Snow
Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2 04/17] qmp: Add block-dirty-bitmap-add and block-dirty-bitmap-remove
Date: Wed, 11 Mar 2015 10:23:01 -0400
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.4.0



On 03/11/2015 09:58 AM, Stefan Hajnoczi wrote:
On Mon, Mar 02, 2015 at 06:19:50PM -0500, John Snow wrote:
+static BdrvDirtyBitmap *block_dirty_bitmap_lookup(const char *node,
+                                                  const char *name,
+                                                  BlockDriverState **pbs,
+                                                  Error **errp)
+{
+    BlockDriverState *bs;
+    BdrvDirtyBitmap *bitmap;
+
+    if (!node) {
+        error_setg(errp, "Node cannot be NULL");
+        return NULL;
+    }
+    if (!name) {
+        error_setg(errp, "Bitmap name cannot be NULL");
+        return NULL;
+    }
+
+    bs = bdrv_lookup_bs(node, node, NULL);
+    if (!bs) {
+        error_setg(errp, "Node '%s' not found", node);
+        return NULL;
+    }
+
+    /* If caller provided a BDS*, provide the result of that lookup, too. */
+    if (pbs) {
+        *pbs = bs;
+    }
+
+    bitmap = bdrv_find_dirty_bitmap(bs, name);

AioContext is not held here.  I'm worried that a block job (running
under the AioContext) could change or delete the bitmap at the same time
as this function is running.

This function should acquire the AioContext before calling
bdrv_find_dirty_bitmap() and fill out an AioContext** parameter so the
caller can continue to use bs/bitmap under the lock.


OK, I'll audit all uses of this function with this in mind.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]