Received: from eggs.gnu.org ([2001:4830:134:3::10]:51417) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bnSo9-0007KK-ME for qemu-devel@nongnu.org; Fri, 23 Sep 2016 11:54:38 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bnSo8-0006lt-J7 for qemu-devel@nongnu.org; Fri, 23 Sep 2016 11:54:37 -0400 References: <1474628299-27134-1-git-send-email-famz@redhat.com> From: Max Reitz Message-ID: <8b71243f-fd83-454c-edde-c88366706681@redhat.com> Date: Fri, 23 Sep 2016 17:54:25 +0200 MIME-Version: 1.0 In-Reply-To: <1474628299-27134-1-git-send-email-famz@redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="oRh241L4TPqO2PUx6NXvReRhgCq7VSqHx" Subject: Re: [Qemu-devel] [PATCH] block-backend: Preserve AioContext of root across medium change List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, Kevin Wolf , qemu-stable@nongnu.org, qemu-block@nongnu.org This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --oRh241L4TPqO2PUx6NXvReRhgCq7VSqHx From: Max Reitz To: Fam Zheng , qemu-devel@nongnu.org Cc: pbonzini@redhat.com, Kevin Wolf , qemu-stable@nongnu.org, qemu-block@nongnu.org Message-ID: <8b71243f-fd83-454c-edde-c88366706681@redhat.com> Subject: Re: [PATCH] block-backend: Preserve AioContext of root across medium change References: <1474628299-27134-1-git-send-email-famz@redhat.com> In-Reply-To: <1474628299-27134-1-git-send-email-famz@redhat.com> Content-Type: text/plain; charset=iso-8859-15 Content-Transfer-Encoding: quoted-printable On 23.09.2016 12:58, Fam Zheng wrote: > This is nop for non-dataplane case, but it prevents crash > (virtio_scsi_ctx_check assertion failure) when a scsi-cd change > operation happens on a virtio-scsi dataplane device. >=20 > Cc: qemu-stable@nongnu.org > Signed-off-by: Fam Zheng > --- > block/block-backend.c | 7 +++++++ > include/block/block_int.h | 1 + > 2 files changed, 8 insertions(+) >=20 > diff --git a/block/block-backend.c b/block/block-backend.c > index d1349d9..c2cae9a 100644 > --- a/block/block-backend.c > +++ b/block/block-backend.c > @@ -1570,6 +1570,7 @@ void blk_update_root_state(BlockBackend *blk) > blk->root_state.open_flags =3D blk->root->bs->open_flags; > blk->root_state.read_only =3D blk->root->bs->read_only; > blk->root_state.detect_zeroes =3D blk->root->bs->detect_zeroes; > + blk->root_state.aio_context =3D blk->root->bs->aio_context; > } > =20 > /* > @@ -1579,7 +1580,13 @@ void blk_update_root_state(BlockBackend *blk) > */ > void blk_apply_root_state(BlockBackend *blk, BlockDriverState *bs) > { > + AioContext *ctx =3D blk->root_state.aio_context; > bs->detect_zeroes =3D blk->root_state.detect_zeroes; > + if (ctx && ctx !=3D qemu_get_aio_context()) { > + aio_context_acquire(ctx); > + bdrv_set_aio_context(bs, ctx); > + aio_context_release(ctx); > + } > } > =20 > /* > diff --git a/include/block/block_int.h b/include/block/block_int.h > index ef3c047..23c64d2 100644 > --- a/include/block/block_int.h > +++ b/include/block/block_int.h > @@ -534,6 +534,7 @@ struct BlockBackendRootState { > int open_flags; > bool read_only; > BlockdevDetectZeroesOptions detect_zeroes; > + AioContext *aio_context; > }; > =20 > typedef enum BlockMirrorBackingMode { The issue with using the BBRS is that it won't work with x-blockdev-{insert,remove}-medium. Instead, I think the AioContext should just be stored in the BB, for which Stefan sent an RFC back in Apr= il: http://lists.nongnu.org/archive/html/qemu-devel/2016-04/msg01844.html Max --oRh241L4TPqO2PUx6NXvReRhgCq7VSqHx Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- iQEvBAEBCAAZBQJX5VAxEhxtcmVpdHpAcmVkaGF0LmNvbQAKCRD0B9sAYdXPQIdf B/4+kIfwiv7DSmp1WRUZlxvg8E8LIETXKFkrcLpo9e8kMC8JfArVzWcYzaeVFlxu We/Jtvh+W1X+ZpKQFK7BeTTletlAED4xt+8MvUjNkoOCu6lJI+ZidWmua5Myvv/B tvpPDQzFIGlt+S5zXjzZpESj3xU+lDySOpw1iknwMTq9lkHWEc8/Vltz2duvjwp2 rtXo6t2upR88K3QXmaFsfAMtROhM+4irJUXIYOdrl4rscsMI3SJV4RXk88nKn/kX Ish681AKbCSquSxGE/P5vE52XSWKZlOZvn/9HfdyGUL6jtuobcRu4ezfKVBBWTI+ NT/Ueqvl3t9TWowkRmIpvtVL =x4+9 -----END PGP SIGNATURE----- --oRh241L4TPqO2PUx6NXvReRhgCq7VSqHx--