• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
No Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

Commit MetaInfo

Revisão81a23caf47956778c5a5056ad656d1ef92bf9659 (tree)
Hora2020-02-11 02:08:51
AutorPeter Maydell <peter.maydell@lina...>
CommiterPeter Maydell

Mensagem de Log

Pull request
-----BEGIN PGP SIGNATURE-----

iQEzBAABCAAdFiEEhpWov9P5fNqsNXdanKSrs4Grc8gFAl5BIR4ACgkQnKSrs4Gr
c8gC9ggAk4npQQyMIgrV8FM3oJfs7sv6hAuyhcnMw4xqNDGw1zTelwSY4Vif9IRu
0dU3xNZKR1LvWqmu5ciShTp8VQ9wtTtGJzI3T90+pweYwa3C3i1go7DXyxAd4EUm
B0HqD3pb9b7X/wwEC1bi8MlGsJCpWqeLHBWXB4C2Gt1Erjo8I3UHKZBWDQTSfwgz
aWBvuxp+H2eIqr6aUyHziF2htGminrmQm8m9oIzx6NXghvfLzo4CPr8m0vOZiWdn
096Y08ZLbCT3IQBfvQDKHRHqPdKGB0MzCdUyN8q+WtApq+dA/HBFGyI2X845iGPf
XY6qMf/TTRHenV7oBwgU8uMzEI4eMw==
=8xC9
-----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging

Pull request

# gpg: Signature made Mon 10 Feb 2020 09:23:42 GMT
# gpg: using RSA key 8695A8BFD3F97CDAAC35775A9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>" [full]
# gpg: aka "Stefan Hajnoczi <stefanha@gmail.com>" [full]
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35 775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:

hw/core: Allow setting 'virtio-blk-device.scsi' property on OSX host
block: fix crash on zero-length unaligned write and read

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>

Mudança Sumário

Diff

--- a/block/io.c
+++ b/block/io.c
@@ -1565,10 +1565,12 @@ static bool bdrv_init_padding(BlockDriverState *bs,
15651565 pad->tail = align - pad->tail;
15661566 }
15671567
1568- if ((!pad->head && !pad->tail) || !bytes) {
1568+ if (!pad->head && !pad->tail) {
15691569 return false;
15701570 }
15711571
1572+ assert(bytes); /* Nothing good in aligning zero-length requests */
1573+
15721574 sum = pad->head + bytes + pad->tail;
15731575 pad->buf_len = (sum > align && pad->head && pad->tail) ? 2 * align : align;
15741576 pad->buf = qemu_blockalign(bs, pad->buf_len);
@@ -1706,6 +1708,18 @@ int coroutine_fn bdrv_co_preadv_part(BdrvChild *child,
17061708 return ret;
17071709 }
17081710
1711+ if (bytes == 0 && !QEMU_IS_ALIGNED(offset, bs->bl.request_alignment)) {
1712+ /*
1713+ * Aligning zero request is nonsense. Even if driver has special meaning
1714+ * of zero-length (like qcow2_co_pwritev_compressed_part), we can't pass
1715+ * it to driver due to request_alignment.
1716+ *
1717+ * Still, no reason to return an error if someone do unaligned
1718+ * zero-length read occasionally.
1719+ */
1720+ return 0;
1721+ }
1722+
17091723 bdrv_inc_in_flight(bs);
17101724
17111725 /* Don't do copy-on-read if we read data before write operation */
@@ -2116,6 +2130,18 @@ int coroutine_fn bdrv_co_pwritev_part(BdrvChild *child,
21162130 return -ENOTSUP;
21172131 }
21182132
2133+ if (bytes == 0 && !QEMU_IS_ALIGNED(offset, bs->bl.request_alignment)) {
2134+ /*
2135+ * Aligning zero request is nonsense. Even if driver has special meaning
2136+ * of zero-length (like qcow2_co_pwritev_compressed_part), we can't pass
2137+ * it to driver due to request_alignment.
2138+ *
2139+ * Still, no reason to return an error if someone do unaligned
2140+ * zero-length write occasionally.
2141+ */
2142+ return 0;
2143+ }
2144+
21192145 bdrv_inc_in_flight(bs);
21202146 /*
21212147 * Align write if necessary by performing a read-modify-write cycle.
--- a/hw/core/machine.c
+++ b/hw/core/machine.c
@@ -148,7 +148,8 @@ GlobalProperty hw_compat_2_5[] = {
148148 const size_t hw_compat_2_5_len = G_N_ELEMENTS(hw_compat_2_5);
149149
150150 GlobalProperty hw_compat_2_4[] = {
151- { "virtio-blk-device", "scsi", "true" },
151+ /* Optional because the 'scsi' property is Linux-only */
152+ { "virtio-blk-device", "scsi", "true", .optional = true },
152153 { "e1000", "extra_mac_registers", "off" },
153154 { "virtio-pci", "x-disable-pcie", "on" },
154155 { "virtio-pci", "migrate-extra", "off" },