qemu-block
[Top][All Lists]
Advanced

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

Re: [Qemu-block] [PATCH v2 04/17] qmp: Add block-dirty-bitmap-add and bl


From: Stefan Hajnoczi
Subject: Re: [Qemu-block] [PATCH v2 04/17] qmp: Add block-dirty-bitmap-add and block-dirty-bitmap-remove
Date: Wed, 11 Mar 2015 13:58:06 +0000
User-agent: Mutt/1.5.23 (2014-03-12)

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.

Attachment: pgpHa1HNC5HkQ.pgp
Description: PGP signature


reply via email to

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