From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:55243) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1axG0p-0002hx-7A for qemu-devel@nongnu.org; Mon, 02 May 2016 11:44:01 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1axG0d-0003Tx-8Q for qemu-devel@nongnu.org; Mon, 02 May 2016 11:43:49 -0400 References: <1462052936-16933-1-git-send-email-eblake@redhat.com> <20160502153529.GE4882@noname.redhat.com> From: Eric Blake Message-ID: <57277583.1030209@redhat.com> Date: Mon, 2 May 2016 09:42:59 -0600 MIME-Version: 1.0 In-Reply-To: <20160502153529.GE4882@noname.redhat.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="TpVftnhs6fcEJAxCt0edd8VUI3cgocxnL" Subject: Re: [Qemu-devel] [PATCH] block: Don't lose FUA flag during ZERO_WRITE fallback List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Kevin Wolf Cc: qemu-devel@nongnu.org, qemu-stable@nongnu.org, Stefan Hajnoczi , Fam Zheng , Max Reitz , "open list:Block I/O path" This is an OpenPGP/MIME signed message (RFC 4880 and 3156) --TpVftnhs6fcEJAxCt0edd8VUI3cgocxnL Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable On 05/02/2016 09:35 AM, Kevin Wolf wrote: > Am 30.04.2016 um 23:48 hat Eric Blake geschrieben: >> NBD has situations where it can support FUA but not ZERO_WRITE; >> when that happens, the generic block layer fallback was losing >> the FUA flag. The problem of losing flags unrelated to >> ZERO_WRITE has been latent in bdrv_co_do_write_zeroes() since >> aa7bfbff, but back then, it did not matter because there was no >> FUA flag. But ever since 93f5e6d8 added bdrv_co_writev_flags(), >> the loss of flags can impact correctness. >> >> +++ b/block/io.c >> @@ -1213,7 +1213,8 @@ static int coroutine_fn bdrv_co_do_write_zeroes(= BlockDriverState *bs, >> qemu_iovec_init_external(&qiov, &iov, 1); >> >> ret =3D bdrv_driver_pwritev(bs, sector_num * BDRV_SECTOR_= SIZE, >> - num * BDRV_SECTOR_SIZE, &qiov, = 0); >> + num * BDRV_SECTOR_SIZE, &qiov, >> + flags & ~BDRV_REQ_ZERO_WRITE); >=20 > This is a good change, but it's only in the fallback code. If we succee= d > here: >=20 > if (drv->bdrv_co_write_zeroes) { > ret =3D drv->bdrv_co_write_zeroes(bs, sector_num, num, flags); > } >=20 > then we still don't get the necessary flush unless the driver's > .bdrv_co_write_zeroes() implementation explicitly handles FUA. As far a= s > I know, we don't have any driver that implements FUA there. NBD will, once we get to that part of my series. But I see what you're saying: since we already emulate FUA for all drivers where .supported_write_flags does not include BDRV_REQ_FUA during bdrv_driver_pwritev(), we should also emulate it here for all the same drivers (and any driver that DOES advertise BDRV_REQ_FUA as supported as well as a write_zeroes callback should be fixed to honor it). I'll do that in v2, which I guess means I should post it at the same time as my work for making .supported_write_flags a per-bds rather than per-driver designation. --=20 Eric Blake eblake redhat com +1-919-301-3266 Libvirt virtualization library http://libvirt.org --TpVftnhs6fcEJAxCt0edd8VUI3cgocxnL 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/ iQEcBAEBCAAGBQJXJ3WDAAoJEKeha0olJ0Nqga0H/j/PruY+9c+94LeKziEw02q0 QlRKCIAwsr5lWisrSxPYPNv88X2eJJnctSZnYkGYu8hEG4/xQbZxKgBLwxpsIIeI iLv3cTVQ5LuwqVRQhgNK2/nqbBV6lQ0Hu2yRH3KBTBwLyIZLPCXKKxe8qpPMljPn MdA11sTLMZthtVFDSSgmYzLkaDRTl3oyOJQVHqOIgAaFYXSTEhFwS74XdOj4hrpv BGYwb7MdMDTeshVFeq6l+000GIJyH2PIEid5DRfydfhEEzAB3HqAGEowBUSwjsYF gTqFVoT3n9aHXSXKdlUDL6Te/tzqnROBoZW/95P6QcRLeo5wF1KvaNmufB4NX4M= =0vxo -----END PGP SIGNATURE----- --TpVftnhs6fcEJAxCt0edd8VUI3cgocxnL--