From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:40397) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bCR9T-0008Ld-0A for qemu-devel@nongnu.org; Mon, 13 Jun 2016 08:39:36 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bCR9R-0001VS-U7 for qemu-devel@nongnu.org; Mon, 13 Jun 2016 08:39:34 -0400 References: <1465694320-13500-1-git-send-email-eblake@redhat.com> <20160612021513.GB27167@ad.usersys.redhat.com> From: Eric Blake Message-ID: <575EA97B.4010005@redhat.com> Date: Mon, 13 Jun 2016 06:39:23 -0600 MIME-Version: 1.0 In-Reply-To: <20160612021513.GB27167@ad.usersys.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="uT1gnxBlhV9CTF3icE0RLwrxbGbD44ODc" Subject: Re: [Qemu-devel] [PATCH] block: Avoid bogus flags during mirroring List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Fam Zheng Cc: qemu-devel@nongnu.org, kwolf@redhat.com, Jeff Cody , qemu-block@nongnu.org, Max Reitz This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --uT1gnxBlhV9CTF3icE0RLwrxbGbD44ODc Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 06/11/2016 08:15 PM, Fam Zheng wrote: > On Sat, 06/11 19:18, Eric Blake wrote: >> Commit e253f4b8 converted mirroring from sector-based bdrv_aio_* >> to byte-based blk_aio_*, but failed to account for the subtle >> difference in signatures (the former takes a semi-redundant length, >> the latter takes a flags parameter). Since all of our flags are >> currently smaller in size than BDRV_SECTOR_SIZE, it has no ill >> effects until we either perform sub-sector mirroring, or we start >> asserting that no unexpected flags are set. I found it while >> testing new asserts when qemu-iotests 132 started warning about an >> unknown flag 0x200000. >> >> Add an assert to help us catch any other improper flags. >> >> Signed-off-by: Eric Blake >> --- >> block/block-backend.c | 2 ++ >> block/mirror.c | 6 ++---- >> 2 files changed, 4 insertions(+), 4 deletions(-) >> >> diff --git a/block/block-backend.c b/block/block-backend.c >> index 34500e6..a5dc6e3 100644 >> --- a/block/block-backend.c >> +++ b/block/block-backend.c >> @@ -945,6 +945,8 @@ static BlockAIOCB *blk_aio_prwv(BlockBackend *blk,= int64_t offset, int bytes, >> acb->bh =3D NULL; >> acb->has_returned =3D false; >> >> + assert(flags <=3D 0x1f); >> + >=20 > Maybe define BDRV_REQ_FLAGS_MAX in include/block/block.h so it's easier= to keep > this assertion valid when we introduce more flags in the future? Oh, good idea. And I also don't know if blk_aio_prwv() is really the best place (it happened to be nicer for getting a good gdb backtrace of the culprit caller prior to entering coroutines, since coroutines tend to kill the call trace - but is too narrow in that it doesn't catch non-aio entry into the block layer) - so I should probably make the actual asserts live in better places like bdrv_driver_p*. I'll split the patch between bug fix and assertion additions, v2 coming up later tod= ay. >=20 > Otherwise the patch looks good. >=20 --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --uT1gnxBlhV9CTF3icE0RLwrxbGbD44ODc Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 Comment: Public key at http://people.redhat.com/eblake/eblake.gpg Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/ iQEcBAEBCAAGBQJXXql7AAoJEKeha0olJ0NqOuoH/i8lYNnAIWh6MNWFkOn4cbhu LVGmtBu0w92co7MH8Jrk61hp6GB0zmB8ho5d2wUO+9Jan0xvow0ohxs6ufX3HAxB bPGMIhc+nrDK4Fs6s+5Cg41DxRtTYaeFIF2xwJnvGeG0tqIyj76oD8Jh85gMl3Hy 222ygSeHeZt1f3KNSnLX5le3+4GQqiTnYUBXX1AQlpN5vONclvKgW0ipqjRseOnE Am0cB3lFnH7lB7ugZBNe9SqDCAN0RB7h+ib/Kv4IfDgPZ7pD3tLmj2mux0dEAPw9 DHHQpkA1LlIYKPTZ3LiTxc7a6L179LVi+s7EN6yfxNT7eFgRg4rQ/QsxafgLPYM= =fGhj -----END PGP SIGNATURE----- --uT1gnxBlhV9CTF3icE0RLwrxbGbD44ODc--