From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:60959) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1YVh9P-0005R2-Ms for qemu-devel@nongnu.org; Wed, 11 Mar 2015 09:58:20 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1YVh9P-0003Fr-0R for qemu-devel@nongnu.org; Wed, 11 Mar 2015 09:58:19 -0400 Date: Wed, 11 Mar 2015 13:58:06 +0000 From: Stefan Hajnoczi Message-ID: <20150311135806.GF10493@stefanha-thinkpad.redhat.com> References: <1425338403-16138-1-git-send-email-jsnow@redhat.com> <1425338403-16138-5-git-send-email-jsnow@redhat.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="Y1L3PTX8QE8cb2T+" Content-Disposition: inline In-Reply-To: <1425338403-16138-5-git-send-email-jsnow@redhat.com> Subject: Re: [Qemu-devel] [Qemu-block] [PATCH v2 04/17] qmp: Add block-dirty-bitmap-add and block-dirty-bitmap-remove List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: John Snow Cc: famz@redhat.com, qemu-block@nongnu.org, qemu-devel@nongnu.org, armbru@redhat.com, vsementsov@parallels.com, stefanha@redhat.com --Y1L3PTX8QE8cb2T+ Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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. --Y1L3PTX8QE8cb2T+ Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAEBAgAGBQJVAEnuAAoJEJykq7OBq3PIAFYH/1XUYouOC2v9OTAPrDHMnQw7 ZAflT1w5QGeVs2Cv+0e5XNKxmlFt5oJFKh0MnLphAYnZCwXWMF3THsy063Vib7wH KmnksEj/AWJSnea1QkLJ5dBYu7+L+pBUV4oW7XhrDrT5mXkIOfBZ/QINMu3YzxBz H1j46G8aLF1X05Mlf7o4xwJBiFz7vWuCXCQ+sYHIvZyya4DJZ0YEbMQlqa+zANK6 qoxP+l29idop0+GcQyODnrlXnXMwgKeEvZHMOTW4AHl/90AnDy2yped9OruWaK3i ZD0eUmhxXWQ46/8U6cRt+BI0VTA5UFywalV/U2wCm7zkeHrqHlzppD94cvwE4Vk= =e9BJ -----END PGP SIGNATURE----- --Y1L3PTX8QE8cb2T+--