Commit Graph

55396 Commits

Author SHA1 Message Date
Cleber Rosa
80758ec57d qemu-iotests: remove commented out variables
The variables FULL_MKFS_OPTIONS and FULL_MOUNT_OPTIONS are commented
out, never used, and even refer to functions that do exist.  The last
time these were touched was around 8 years ago, so I guess it's safe
to assume outputting such information on test execution is still on the
radar.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2017-08-14 13:06:54 +03:00
Cleber Rosa
657c572afe qemu-iotests: get rid of _full_imgproto_details()
Although this function is used, its implementation does nothing
besides echoing a variable name.  There's no need to wrap this
functionality in a function, and based on the one usage it has, it's
not even required to adhere to a convention or code style.

Signed-off-by: Cleber Rosa <crosa@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2017-08-14 13:06:54 +03:00
Thomas Huth
88552b553b qemu-doc: Fix "-net van" typo
While Andrew S. Tanenbaum has a point by saying "Never underestimate the
bandwidth of a station wagon full of tapes hurtling down the highway",
we don't support that way of transportation in QEMU yet, so replace the
typo with the correct word "vlan".

Signed-off-by: Thomas Huth <thuth@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Laurent Vivier <lvivier@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2017-08-14 13:06:54 +03:00
Eric Blake
e8ec0117b2 libqtest: Fix typo in comments
s/continuosly/continuously/

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2017-08-14 13:06:54 +03:00
Eduardo Otubo
0ac241bcf9 unicore32: abort when entering "x 0" on the monitor
Starting Qemu with "qemu-system-unicore32 -M puv3,accel=qtest -S -nographic"
and entering "x 0 " at the monitor prompt leads to abort():

  $ ./unicore32-softmmu/qemu-system-unicore32 -M puv3,accel=qtest -S -nographic
  QEMU 2.9.90 monitor - type 'help' for more information
  (qemu) x 0
  qemu: fatal: uc32_cpu_get_phys_page_debug not supported yet

  R00=00000000 R01=00000000 R02=00000000 R03=00000000
  R04=00000000 R05=00000000 R06=00000000 R07=00000000
  R08=00000000 R09=00000000 R10=00000000 R11=00000000
  R12=00000000 R13=00000000 R14=00000000 R15=00000000
  R16=00000000 R17=00000000 R18=00000000 R19=00000000
  R20=00000000 R21=00000000 R22=00000000 R23=00000000
  R24=00000000 R25=00000000 R26=00000000 R27=00000000
  R28=00000000 R29=00000000 R30=00000000 R31=03000000
  PSR=40000013 -Z-- PRIV
  Aborted (core dumped)

This happens because uc32_cpu_get_phys_page_debug() is not implemented
yet, this is a temporary workaround to avoid the crash.

Signed-off-by: Eduardo Otubo <otubo@redhat.com>
Signed-off-by: Michael Tokarev <mjt@tls.msk.ru>
2017-08-14 13:06:54 +03:00
Peter Maydell
b968316069 Fix the boot-serial test to work with the new --disable-tcg.
-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJZjbdDAAoJEN7Pa5PG8C+vEMYQAIPiwbs/poNslv250aWpRAsv
 B6S6koeJfKp7GNSKPAW/bPl/CzLviGfTy/4lwYKhMlEgChRBo/35fii9RpFKKBUq
 KP01G3lpIx99TaUODXwfnTSzXfuLu9psglgf2APzObrjYWJiQROPsvCn1gLMveVA
 NU4f1HWy9dIaNk4kMf9YABaMnkHo9v517R6eIhw6F5L1jhKYlH6MqySDTQmBjGcB
 tS4pjhdRdrSWbsD8nyzaLYGtXDURvXC8kT8K1AVbj3Qix+CXiSksexBNQPri02x6
 jJM0Sj4lhfnNrCiFx6QRphdcFpS9qmajh9qL9QUx95SZDlpYzaO8HD991aEv9qU0
 rLQ2G+pEQy9tqwjiqupmMgKznC9+jk8ZkuIuJ+LHA9B+vS/7C5sGb0IoiTTbBGls
 d08U6ZCDu5hidnyVFtjy1u15lW9+0UAd0jGtKSpIY3E1PRp1s3PK0s1wpB1m5Tqr
 H92qI2KqJjgAFus3U2jAh0QLA9lQDfIqBybqqNRN1lzihUP8cEhlg+HC66zQLc3U
 pbr2msAvhs4v5xQEqE1ZdcTi6xAY7PuEHKsbLt7JplRp6JjFpOv1AdIRLYSzTzPZ
 dp61ELcwObKBO5Yp2Rh6xu5smtcWoqKKAGgzrwZi0bm3egp2iuwgweVX8OgTI+Sz
 r2tIuVSYhzYkBKq55FMd
 =VWm0
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/cohuck/tags/boot-serial-no-tcg-20170811' into staging

Fix the boot-serial test to work with the new --disable-tcg.

# gpg: Signature made Fri 11 Aug 2017 14:55:15 BST
# gpg:                using RSA key 0xDECF6B93C6F02FAF
# gpg: Good signature from "Cornelia Huck <conny@cornelia-huck.de>"
# gpg:                 aka "Cornelia Huck <huckc@linux.vnet.ibm.com>"
# gpg:                 aka "Cornelia Huck <cornelia.huck@de.ibm.com>"
# gpg:                 aka "Cornelia Huck <cohuck@kernel.org>"
# gpg:                 aka "Cornelia Huck <cohuck@redhat.com>"
# Primary key fingerprint: C3D0 D66D C362 4FF6 A8C0  18CE DECF 6B93 C6F0 2FAF

* remotes/cohuck/tags/boot-serial-no-tcg-20170811:
  boot-serial-test: fallback to kvm accelerator

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-08-14 09:48:44 +01:00
Thomas Huth
6900191775 qemu-doc: Fix "-net van" typo
While Andrew S. Tanenbaum has a point by saying "Never underestimate the
bandwidth of a station wagon full of tapes hurtling down the highway",
we don't support that way of transportation in QEMU yet, so replace the
typo with the correct word "vlan".

Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-Id: <1502365466-19432-1-git-send-email-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-08-14 10:41:42 +02:00
Peter Maydell
9db6ffc766 Block layer patches for 2.10.0-rc3
-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJZjbkSAAoJEH8JsnLIjy/W+ToP/joNaKOL3cC4oLWA6EkE7exi
 PftHRGxGv9W56YZrfKrQ2eKr1uxWXh9mcvshhkerTEoppdZeNru/8OSoo+huYRqA
 7arH+gGMNCTa9kelSreiUfUTqc05cCBWsSatDAEbiCn6MeZQvRjP5t2YNcjdqjdh
 n2d7CB1hBXdYUH51SG/5EBpIHckBSE4cnbB/Cdq59AYISyqLqytaNAr94q9gikqC
 xd4CWOL4xnd9uI4csiNdkuU2Z3IgewJZctfZZuFXYGL48s4S02ba3SQ+vrLNVQb6
 xplKMPCfXKeNIeJLO1LVeb6io7Egws3wq6rivCbzBEoRDMHvnlH3+0Dc+cagRu1A
 Tn04fXZNxAwHYQD47Q+RSw6iaSpTBlWeedeclDxNt2uUBkybQxvzYuCt77JFH6VO
 4Ju1puIwpDxA5+34i4a0C/SKtpqnltNi8ET1JBoeLeoun+gaNQRDOIEHoqqNX/mO
 tF/ytyklEntBCQhgP0ZOLqfwJxhGPqD41u45suKI0bFh7D2GBVOxKKTmu7R+khGj
 Uhs56kN9bz4RQe6LTWA4DSeo6oqMHzRSozQg0uCV3yWN1UypPAf+O/tJMCp5Szkk
 JbbX483SZP4AQtN47OPyzMufkbXy0WM0MYW+dI4/5kTEQx4GKuTMy1Wix7zTmRRt
 1siqBWvFW9Ct6BRMoTND
 =FH4q
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches for 2.10.0-rc3

# gpg: Signature made Fri 11 Aug 2017 15:02:58 BST
# gpg:                using RSA key 0x7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream:
  qemu-iotests: fix 185
  file-posix: Do runtime check for ofd lock API
  osdep: Add runtime OFD lock detection
  qcow2: Check failure of bdrv_getlength()
  qcow2: Drop debugging dump_refcounts()
  vpc: Check failure of bdrv_getlength()
  tests/multiboot: Fix whitespace failure

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-08-11 15:11:50 +01:00
Cornelia Huck
480bc11e61 boot-serial-test: fallback to kvm accelerator
Currently, at least x86_64 and s390x support building with --disable-tcg.
Instead of forcing tcg (which causes the test to fail on such builds),
allow to use kvm as well.

Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Cornelia Huck <cohuck@redhat.com>
2017-08-11 15:44:05 +02:00
Vladimir Sementsov-Ogievskiy
8565c3ab53 qemu-iotests: fix 185
185 can sometimes produce wrong output like this:

    185 2s ... - output mismatch (see 185.out.bad)
    --- /work/src/qemu/master/tests/qemu-iotests/185.out    2017-07-14 \
        15:14:29.520343805 +0300
    +++ 185.out.bad 2017-08-07 16:51:02.231922900 +0300
    @@ -37,7 +37,7 @@
     {"return": {}}
     {"return": {}}
     {"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
         "event": "SHUTDOWN", "data": {"guest": false}}
    -{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
        "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
            "len": 4194304, "offset": 4194304, "speed": 65536, "type": \
                "mirror"}}
    +{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, \
        "event": "BLOCK_JOB_CANCELLED", "data": {"device": "disk", \
            "len": 0, "offset": 0, "speed": 65536, "type": "mirror"}}

     === Start backup job and exit qemu ===

    Failures: 185
    Failed 1 of 1 tests

This is because, under heavy load, the quit can happen before the first
iteration of the mirror request has occurred.  To make sure we've had
time to iterate, let's just add a sleep for 0.5 seconds before quitting.

Signed-off-by: Vladimir Sementsov-Ogievskiy <vsementsov@virtuozzo.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2017-08-11 14:44:39 +02:00
Fam Zheng
2b218f5dbc file-posix: Do runtime check for ofd lock API
It is reported that on Windows Subsystem for Linux, ofd operations fail
with -EINVAL. In other words, QEMU binary built with system headers that
exports F_OFD_SETLK doesn't necessarily run in an environment that
actually supports it:

$ qemu-system-aarch64 ... -drive file=test.vhdx,if=none,id=hd0 \
    -device virtio-blk-pci,drive=hd0
qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to unlock byte 100
qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to unlock byte 100
qemu-system-aarch64: -drive file=test.vhdx,if=none,id=hd0: Failed to lock byte 100

As a matter of fact this is not WSL specific. It can happen when running
a QEMU compiled against a newer glibc on an older kernel, such as in
a containerized environment.

Let's do a runtime check to cope with that.

Reported-by: Andrew Baumann <Andrew.Baumann@microsoft.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2017-08-11 14:12:44 +02:00
Fam Zheng
ca749954b0 osdep: Add runtime OFD lock detection
Build time check of OFD lock is not sufficient and can cause image open
errors when the runtime environment doesn't support it.

Add a helper function to probe it at runtime, additionally. Also provide
a qemu_has_ofd_lock() for callers to check the status.

Signed-off-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2017-08-11 14:12:44 +02:00
Eric Blake
d0d5d0e31a qcow2: Check failure of bdrv_getlength()
qcow2_co_pwritev_compressed() should not call bdrv_truncate()
if determining the size failed.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2017-08-11 13:23:47 +02:00
Eric Blake
c40fe9c06c qcow2: Drop debugging dump_refcounts()
It's been #if 0'd since its introduction in 2006, commit 585f8587.
We can revive dead code if we need it, but in the meantime, it has
bit-rotted (for example, not checking for failure in bdrv_getlength()).

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2017-08-11 13:23:45 +02:00
Eric Blake
81caa3cc3b vpc: Check failure of bdrv_getlength()
vpc_open() was checking for bdrv_getlength() failure in one, but
not the other, location.

Reported-by: Markus Armbruster <armbru@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2017-08-11 13:23:40 +02:00
Eric Blake
01a02ec4f6 tests/multiboot: Fix whitespace failure
Commit b43671f8 accidentally broke run_test.sh within tests/multiboot;
due to a subtle change in whitespace.

These two commands produce theh same output (at least, for sane $IFS
of space-tab-newline):

echo -e "...$@..."
echo -e "...$*..."

But that's only because echo inserts spaces between multiple arguments
(the $@ case), while the $* form gives a single argument to echo with
the spaces already present.

But when converting to printf %b, there are no automatic spaces between
multiple arguments, so we HAVE to use $*.

It doesn't help that run_test.sh isn't part of 'make check'.

Signed-off-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2017-08-11 13:23:19 +02:00
Peter Maydell
95766c2cd0 -----BEGIN PGP SIGNATURE-----
iQEcBAABAgAGBQJZjJxdAAoJEJykq7OBq3PIIH0IALZoC3VFv9aEw9/lKBWN21bJ
 pB5OPuXvh8h8xgjQx9tGnNW9wyUQdwup9jSJncmRPJIF4+FxGouQRLTMD8bXrRPq
 61zv0CTxHRi6o++NVWB0z0sMjzT29lnSXJjPJ45RiORM2+ErM9QxlgD172oIo49x
 fbwixqXofdAc2in+AmKhpm9PWC3qJ4kwqaIdPHmHKZG73lhTUPv5aFhoxO/48Z9C
 xlBB9daQ60QwnpKn1rw0Ewl3r2MWjxFEfKifARQkga9YaNwVf5zlJc73SfvUQEU/
 J6QBUQfWO7l9et5U3AFM8rW4QbjCkO3fzAbWuPH3FHUukkA3K+kWGURR2jm8vsc=
 =Tn14
 -----END PGP SIGNATURE-----

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

# gpg: Signature made Thu 10 Aug 2017 18:48:13 BST
# gpg:                using RSA key 0x9CA4ABB381AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"
# Primary key fingerprint: 8695 A8BF D3F9 7CDA AC35  775A 9CA4 ABB3 81AB 73C8

* remotes/stefanha/tags/block-pull-request:
  virtio-blk: handle blk_getlength() errors
  IDE: test flush on empty CDROM
  IDE: Do not flush empty CDROM drives

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-08-10 18:53:39 +01:00
Peter Maydell
473a321122 Just a single fix for an annoying regression introduced in 2.9 when fixing
CVE-2016-9602.
 -----BEGIN PGP SIGNATURE-----
 
 iEYEABECAAYFAlmMVDwACgkQAvw66wEB28KtPACglcqxxpYeK34F/Rhqx8EzgGJN
 OkMAn03uaoS1sQUmk0GuqpbSJAh4cWi5
 =gUqz
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/gkurz/tags/for-upstream' into staging

Just a single fix for an annoying regression introduced in 2.9 when fixing
CVE-2016-9602.

# gpg: Signature made Thu 10 Aug 2017 13:40:28 BST
# gpg:                using DSA key 0x02FC3AEB0101DBC2
# gpg: Good signature from "Greg Kurz <groug@kaod.org>"
# gpg:                 aka "Greg Kurz <groug@free.fr>"
# gpg:                 aka "Greg Kurz <gkurz@linux.vnet.ibm.com>"
# gpg:                 aka "Gregory Kurz (Groug) <groug@free.fr>"
# gpg:                 aka "[jpeg image of size 3330]"
# gpg: WARNING: This key is not certified with a trusted signature!
# gpg:          There is no indication that the signature belongs to the owner.
# Primary key fingerprint: 2BD4 3B44 535E C0A7 9894  DBA2 02FC 3AEB 0101 DBC2

* remotes/gkurz/tags/for-upstream:
  9pfs: local: fix fchmodat_nofollow() limitations

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-08-10 17:50:55 +01:00
Stefan Hajnoczi
17d0bc01bf virtio-blk: handle blk_getlength() errors
If blk_getlength() fails in virtio_blk_update_config() consider the disk
image length to be 0 bytes.

Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Fam Zheng <famz@redhat.com>
Message-id: 20170808122251.29815-1-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-08-10 14:33:43 +01:00
Kevin Wolf
ce317e8dea IDE: test flush on empty CDROM
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: John Snow <jsnow@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Message-id: 20170809160212.29976-3-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-08-10 14:33:43 +01:00
Stefan Hajnoczi
4da97120d5 IDE: Do not flush empty CDROM drives
The block backend changed in a way that flushing empty CDROM drives now
crashes.  Amend IDE to avoid doing so until the root problem can be
addressed for 2.11.

Original patch by John Snow <jsnow@redhat.com>.

Reported-by: Kieron Shorrock <kshorrock@paloaltonetworks.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Message-id: 20170809160212.29976-2-stefanha@redhat.com
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
2017-08-10 14:33:43 +01:00
Greg Kurz
4751fd5328 9pfs: local: fix fchmodat_nofollow() limitations
This function has to ensure it doesn't follow a symlink that could be used
to escape the virtfs directory. This could be easily achieved if fchmodat()
on linux honored the AT_SYMLINK_NOFOLLOW flag as described in POSIX, but
it doesn't. There was a tentative to implement a new fchmodat2() syscall
with the correct semantics:

https://patchwork.kernel.org/patch/9596301/

but it didn't gain much momentum. Also it was suggested to look at an O_PATH
based solution in the first place.

The current implementation covers most use-cases, but it notably fails if:
- the target path has access rights equal to 0000 (openat() returns EPERM),
  => once you've done chmod(0000) on a file, you can never chmod() again
- the target path is UNIX domain socket (openat() returns ENXIO)
  => bind() of UNIX domain sockets fails if the file is on 9pfs

The solution is to use O_PATH: openat() now succeeds in both cases, and we
can ensure the path isn't a symlink with fstat(). The associated entry in
"/proc/self/fd" can hence be safely passed to the regular chmod() syscall.

The previous behavior is kept for older systems that don't have O_PATH.

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Tested-by: Zhi Yong Wu <zhiyong.wu@ucloud.cn>
Acked-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
2017-08-10 14:36:11 +02:00
Peter Maydell
b38df311c1 ppc patch queue 2017-08-09
This series contains a number of bugfixes for ppc and related
 machines, for the qemu-2.10.release.  Some are true regressions,
 others are serious enough and non-invasive enough to fix that it's
 worth putting in 2.10 this late.
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCAAdFiEEdfRlhq5hpmzETofcbDjKyiDZs5IFAlmKrEUACgkQbDjKyiDZ
 s5IkMQ/+NGW30/N3siqDh3R7JUL9jpT7N4XRuYrGlWcJFh25NscEVw6M6iPJtkDZ
 qS7/OZDlfnELj/9Js8kcTYdzI+X3X9WSnftiZalJ0KYiE6sPDiWRa4bo9jiT+0OU
 MkIY1pVTpzrJnZl0XSlN/n+senjdBQWg/djmatX8+LPTz75lOlkujxo6LEDOtyv5
 RSx9jME4J/HZ0WQyoY8dOAORBQQHxtJel5RBfd+BloTfslA+VREJEOi8d+Xkc9oz
 H4UPEMp/Kb4fpBB7XsaACUC3HRs7kikG/eS6tOtwKor9jwpp2v/BP733jMHsebzw
 RiyJVnVVk8kfyC7DBsra3XhjBtDlQPbq/quL/O3qMcdc8EslkVECMBUbb2tWsnYD
 /H1H1sjdvDJV9nVs9Wbqmi/N/SE6gvubK35wBpWQ0U0ZDGcbSdmwXkbdjFT1plUg
 z5+oZWYmOP0ndsKrv4+rmeqbMszEBQv4EBSZJ1LswGdC7+7Ga95VmN+f6ZUFq2en
 OlSlgPAvXn0PkEYgn/CVIr+Oq6lR5SNRtvDkLNpa+IkQzBoGXCgIeiuyR6ZaswH5
 FywK+QaiVKqtwgF0Zb3JWf6L5fyKdOE6fTZvyL93esXVCBSfkMIvCeACDLInczUl
 xgZCryyBpdVT/mxz4M06QI43H8nb0WIbY6UeV2WuXIN4dJlSJqE=
 =43aW
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/dgibson/tags/ppc-for-2.10-20170809' into staging

ppc patch queue 2017-08-09

This series contains a number of bugfixes for ppc and related
machines, for the qemu-2.10.release.  Some are true regressions,
others are serious enough and non-invasive enough to fix that it's
worth putting in 2.10 this late.

# gpg: Signature made Wed 09 Aug 2017 07:31:33 BST
# gpg:                using RSA key 0x6C38CACA20D9B392
# gpg: Good signature from "David Gibson <david@gibson.dropbear.id.au>"
# gpg:                 aka "David Gibson (Red Hat) <dgibson@redhat.com>"
# gpg:                 aka "David Gibson (ozlabs.org) <dgibson@ozlabs.org>"
# gpg:                 aka "David Gibson (kernel.org) <dwg@kernel.org>"
# Primary key fingerprint: 75F4 6586 AE61 A66C C44E  87DC 6C38 CACA 20D9 B392

* remotes/dgibson/tags/ppc-for-2.10-20170809:
  spapr: Fix bug in h_signal_sys_reset()
  spapr_drc: abort if object_property_add_child() fails
  target/ppc: Add stub implementation of the PSSCR
  target/ppc: Implement TIDR
  ppc: fix double-free in cpu_post_load()
  booke206: fix MAS update on tlb miss

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-08-10 11:12:36 +01:00
Peter Maydell
8a6be122e4 pc, vhost: fixes for rc3
Fix up bugs and warnings in tests. Revert an experimental commit that I
 put in by mistake: harmless but useless.
 
 Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iQEcBAABAgAGBQJZimQFAAoJECgfDbjSjVRp+lQIAKAb7hAJFDnnE9qeRE2fbuQ6
 7l1CkBD4i8r/KWsQ4dqpOlaMquQIfnzu2GXbg52tJdQQqajYuFVDSZx+1EO+OOEP
 ZUSCTbWJW1VWNeCNt2nmy5gfI8+f40uijpg2NBjMl5//t+EG9dXR29gH7+X+UWii
 TuJ7bT8njNbYWPCAOyWbDPP3Y2PHZMsbEDqoSbIlt+X/Hk/3fvynBGH1VpS4swlx
 VoUqTXqd070m5IciENio8ygwDLOjr6hrtsmuiPL1vq7YzKZhylQt2/IywaqOK6M5
 7AKWnm9E8v6zyizQSx1jPmRlcwf4VJ5gvw7fTboCMEEpwqu4WkQafObwSH857Ao=
 =8ZKa
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging

pc, vhost: fixes for rc3

Fix up bugs and warnings in tests. Revert an experimental commit that I
put in by mistake: harmless but useless.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

# gpg: Signature made Wed 09 Aug 2017 02:23:17 BST
# gpg:                using RSA key 0x281F0DB8D28D5469
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>"
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>"
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* remotes/mst/tags/for_upstream:
  libqtest: always set up signal handler for SIGABRT
  libvhost-user: quit when no more data received
  net: fix -netdev socket,fd= for UDP sockets
  Revert "cpu: add APIs to allocate/free CPU environment"
  acpi-test: update expected DSDT files

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-08-10 10:05:29 +01:00
Sam Bobroff
f57467e3b3 spapr: Fix bug in h_signal_sys_reset()
The unicast case in h_signal_sys_reset() seems to be broken:
rather than selecting the target CPU, it looks like it will pick
either the first CPU or fail to find one at all.

Fix it by using the search function rather than open coding the
search.

This was found by inspection; the code appears to be unused because
the Linux kernel only uses the broadcast target.

Signed-off-by: Sam Bobroff <sam.bobroff@au1.ibm.com>
Reviewed-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-09 14:04:28 +10:00
Greg Kurz
325837ca38 spapr_drc: abort if object_property_add_child() fails
object_property_add_child() can only fail in two cases:
- the child already has a parent, which shouldn't happen since the DRC was
  allocated a few lines above
- the parent already has a child with the same name, which would mean the
  caller tries to create a DRC that already exists

In both case, this is a QEMU bug and we should abort.

Signed-off-by: Greg Kurz <groug@kaod.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-09 11:46:44 +10:00
David Gibson
b8af5b2d5f target/ppc: Add stub implementation of the PSSCR
The PSSCR register added in POWER9 controls certain power saving mode
behaviours.  Mostly, it's not relevant to TCG, however because qemu
doesn't know about it yet, it doesn't synchronize the state with KVM,
and thus it doesn't get migrated.

To fix that, this adds a minimal stub implementation of the register.
This isn't complete, even to the extent that an implementation is
possible in TCG, just enough to get migration working.  We need to
come back later and at least properly filter the various fields in the
register based on privilege level.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
2017-08-09 11:46:44 +10:00
David Gibson
650f3287ab target/ppc: Implement TIDR
This adds a trivial implementation of the TIDR register added in
POWER9.  This isn't particularly important to qemu directly - it's
used by accelerator modules that we don't emulate.

However, since qemu isn't aware of it, its state is not synchronized
with KVM and therefore not migrated, which can be a problem.

Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
Reviewed-by: Cédric Le Goater <clg@kaod.org>
Reviewed-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Thomas Huth <thuth@redhat.com>
2017-08-09 11:46:44 +10:00
Greg Kurz
e7bab9a256 ppc: fix double-free in cpu_post_load()
When running nested with KVM PR, ppc_set_compat() fails and QEMU crashes
because of "double free or corruption (!prev)". The crash happens because
error_report_err() has already called error_free().

Signed-off-by: Greg Kurz <groug@kaod.org>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-09 11:46:44 +10:00
KONRAD Frederic
89fca22f21 booke206: fix MAS update on tlb miss
When a tlb instruction miss happen, rw is set to 0 at the bottom
of cpu_ppc_handle_mmu_fault which cause the MAS update function to miss
the SAS and TS bit in MAS6, MAS1 in booke206_update_mas_tlb_miss.

Just calling booke206_update_mas_tlb_miss with rw = 2 solve the issue.

Signed-off-by: KONRAD Frederic <frederic.konrad@adacore.com>
Signed-off-by: David Gibson <david@gibson.dropbear.id.au>
2017-08-09 11:46:44 +10:00
Jens Freimann
24dd1e1769 libqtest: always set up signal handler for SIGABRT
Currently abort handlers only work for the first test function
in a testcase, because the list of abort handlers is not properly
cleared when qtest_quit() is called.

qtest_quit() only deletes the kill_qemu_hook but doesn't completely
clear the abrt_hooks list.  The effect is that abrt_hooks.is_setup is
never set to false and in a following test the abrt_hooks list is not
initialized and setup_sigabrt_handler() is not called.

One way to solve this is to clear the list in qtest_quit(), but
that means only asserts between qtest_start and qtest_quit will
be catched by the abort handler.

We can make abort handlers work in all cases if we always setup the
signal handler for SIGABRT in qtest_init.

Signed-off-by: Jens Freimann <jfreimann@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2017-08-09 04:22:14 +03:00
Jens Freimann
2566378d6d libvhost-user: quit when no more data received
End processing of messages when VHOST_USER_NONE
is received.

Without this we run into a vubr_panic() call and get
"PANIC: Unhandled request: 0"

Signed-off-by: Jens Freimann <jfreiman@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2017-08-09 04:22:13 +03:00
Jens Freimann
0f8c289ad5 net: fix -netdev socket,fd= for UDP sockets
This patch fixes -netdev socket,fd= for UDP sockets
Currently -netdev socket,fd=<...> results in

  qemu: error: specified mcastaddr "127.0.0.1" (0x7f000001) does not
    contain a multicast address
  qemu-system-x86_64: -netdev
    socket,id=n1,fd=3: Device 'socket' could not be initialized

To fix these we need to allow specifying multicast and fd arguments
for the same netdev. With this the user can specify "-netdev
fd=3,mcast=<IP:port>"

Cc: Jason Wang <jasowang@redhat.com>
Fixes: 3d830459b1
Signed-off-by: Jens Freimann <jfreimann@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Reviewed-by: Michael S. Tsirkin <mst@redhat.com>
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2017-08-09 04:22:13 +03:00
Michael S. Tsirkin
cde0a63ad7 Revert "cpu: add APIs to allocate/free CPU environment"
This reverts commit e2a7f28693.

This was not supposed to go upstream yet. Reverting.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2017-08-09 04:22:13 +03:00
Michael S. Tsirkin
114e0af84e acpi-test: update expected DSDT files
Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
2017-08-09 04:22:13 +03:00
Peter Maydell
54affb3a36 Update version for v2.10.0-rc2 release
Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-08-08 19:07:46 +01:00
Peter Maydell
e42590c22a * --help/--version improvements (Eric)
* GCC 7 workaround (Greg)
 * Small SCSI fix (Hannes)
 * SSE 4.1 fix (Joseph)
 * RCU deadlock fix (myself)
 -----BEGIN PGP SIGNATURE-----
 
 iQFIBAABCAAyFiEE8TM4V0tmI4mGbHaCv/vSX3jHroMFAlmJ2LgUHHBib256aW5p
 QHJlZGhhdC5jb20ACgkQv/vSX3jHroPMLgf/Zvj+1yP94YejCWma5jay8/kbWqNx
 25AVurgleLsuhFATpZixyURauVkyGi1RCCldq0EZR2bXMDmwTk76VTt2Kh7/xh5I
 GZIT44tRKwItpihfN600xGHFH00C9pu4dg5zSZvj1nuwlowEgmx7hni2uG4DdKaM
 PSGckkXq4IaIAh49Pggc/Mucj9S5ZbgFvEUK4KcB75+U5x0UXpQRh/dY7gOfIrw/
 Alufbu48UOFNIW9k8AcMRucin0HawHyWhaGbn3cgyfdVTNO2t9mhFyAIYcPbF/6L
 7LLXp1Ujngfdfcq4b4pLaFAkFkGOjHwXEtgEi/Z+mphXfORlf7haOphdOA==
 =v1PK
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/bonzini/tags/for-upstream' into staging

* --help/--version improvements (Eric)
* GCC 7 workaround (Greg)
* Small SCSI fix (Hannes)
* SSE 4.1 fix (Joseph)
* RCU deadlock fix (myself)

# gpg: Signature made Tue 08 Aug 2017 16:28:56 BST
# gpg:                using RSA key 0xBFFBD25F78C7AE83
# gpg: Good signature from "Paolo Bonzini <bonzini@gnu.org>"
# gpg:                 aka "Paolo Bonzini <pbonzini@redhat.com>"
# Primary key fingerprint: 46F5 9FBD 57D6 12E7 BFD4  E2F7 7E15 100C CD36 69B1
#      Subkey fingerprint: F133 3857 4B66 2389 866C  7682 BFFB D25F 78C7 AE83

* remotes/bonzini/tags/for-upstream:
  maint: Include bug-reporting info in --help output
  qga: Give more --version information
  qemu-io: Give more --version information
  qemu-img: Sort sub-command names in --help
  target/i386: set rip_offset for some SSE4.1 instructions
  scsi: clarify sense codes for LUN0 emulation
  kvm: workaround build break on gcc-7.1.1 / fedora26
  Revert "rcu: do not create thread in pthread_atfork callback"
  rcu: completely disable pthread_atfork callbacks as soon as possible

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-08-08 16:32:54 +01:00
Eric Blake
f5048cb751 maint: Include bug-reporting info in --help output
These days, many programs are including a bug-reporting address,
or better yet, a link to the project web site, at the tail of
their --help output.  However, we were not very consistent at
doing so: only qemu-nbd and qemu-qa mentioned anything, with the
latter pointing to an individual person instead of the project.

Add a new #define that sets up a uniform string, mentioning both
bug reporting instructions and overall project details, and which
a downstream vendor could tweak if they want bugs to go to a
downstream database.  Then use it in all of our binaries which
have --help output.

The canned text intentionally references http:// instead of https://
because our https website currently causes certificate errors in
some browsers.  That can be tweaked later once we have resolved the
web site issued.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Message-Id: <20170803163353.19558-5-eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-08-08 17:28:53 +02:00
Eric Blake
8f1c29af01 qga: Give more --version information
Include the package version information (useful for detecting
builds from git or downstream backports), and the copyright notice.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Message-Id: <20170803163353.19558-4-eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-08-08 17:28:53 +02:00
Eric Blake
4face32a7a qemu-io: Give more --version information
Include the package version information (useful for detecting
builds from git or downstream backports), and the copyright notice.

Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Daniel P. Berrange <berrange@redhat.com>
Acked-by: Kevin Wolf <kwolf@redhat.com>
Message-Id: <20170803163353.19558-3-eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-08-08 17:28:53 +02:00
Eric Blake
57b2d9d4a7 qemu-img: Sort sub-command names in --help
'amend' and 'create' were not listed alphabetically; hoist them
earlier.  Separate the @end table block to make it easier to
copy-and-paste the addition of future sub-commands.

Signed-off-by: Eric Blake <eblake@redhat.com>

Message-Id: <20170803163353.19558-2-eblake@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
2017-08-08 17:28:53 +02:00
Peter Maydell
53b080fa83 Block layer patches for 2.10.0-rc2
-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJZicL/AAoJEH8JsnLIjy/WnRYP/AhJ+3RuyemPn1rTRVbz6AtS
 3nWmNJTCrbbmxP9dfM50C30q1OjT9114AibC0qz4cm6LGRA7O82kWT0KcWHOM443
 ljnuxXfJ3S0FGC0sJXG4jdzkOEIWBnIsfYqkVih4KPzsARUTlBZjtANjyyvRMFmT
 hgqUKrKl+WwE0Ys248xSuE8bCE5TmSkvKV14ezq/FpjZMmJVpsQXFhkUfH8ZjX48
 USCDG8MAOFFJsPojl9ONOFn9dc3hX2GLwOJe7fSLe19ppnA7FiTPLy0ySpLMpQA6
 Ipu+PmHtfVBmHX6g6a0XXput7gGNJ1aURNRQuWiLtOlo4uoybwMRf7teKe8ob5+n
 S2PmhKOFXVMK+pbARZJ8IPAWcHo6dcMqEJXN5xvJLcKiN2WM5A4rx1/liSDIbQ9p
 +TrFhzZlLmMy/6xMJdv63uwKbWcdS18R4q9tzU5Y+/BTG/+LsKgpkwscnqeEvEEv
 i5+0QjdJZQajCuF4PTE2dEzw2WesPHdUFcYMtYAm9QKGG07kwJOoncJ+ghuriyrw
 JzvcoSbkug8a7M+18zoDTszWyXqHl3ObODVUCiLQFe0Tzu+SxYy0cDrH/QMNi7cI
 EcfbLDfCNOaNU27ctsGiey6idB2qHwWpZ0N+XnTb2TRIBRX6WAefVdxF0aTJPQdh
 +vwWHW7+gd1QwEgCQpvP
 =swst
 -----END PGP SIGNATURE-----

Merge remote-tracking branch 'remotes/kevin/tags/for-upstream' into staging

Block layer patches for 2.10.0-rc2

# gpg: Signature made Tue 08 Aug 2017 14:56:15 BST
# gpg:                using RSA key 0x7F09B272C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"
# Primary key fingerprint: DC3D EB15 9A9A F95D 3D74  56FE 7F09 B272 C88F 2FD6

* remotes/kevin/tags/for-upstream:
  block/nfs: fix mutex assertion in nfs_file_close()
  qemu-iotests: Test reopen between read-only and read-write
  qemu-io: Allow reopen read-write
  block: Set BDRV_O_ALLOW_RDWR during rw reopen
  block: Allow reopen rw without BDRV_O_ALLOW_RDWR
  block: Fix order in bdrv_replace_child()
  parallels: drop check that bdrv_truncate() is working
  parallels: respect error code of bdrv_getlength() in allocate_clusters()
  block: respect error code from bdrv_getlength in handle_aiocb_write_zeroes
  vmdk: Fix error handling/reporting of vmdk_check
  block/null: Remove 'filename' option
  block: drop bdrv_set_key from BlockDriver
  block/vhdx: check error return of bdrv_truncate()
  block/vhdx: check error return of bdrv_flush()
  block/vhdx: check for offset overflow to bdrv_truncate()
  block/vhdx: check error return of bdrv_getlength()
  quorum: Set sectors-count to 0 when reporting a flush error
  qemu-iotests/109: Fix lock race condition

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
2017-08-08 15:23:21 +01:00
Jeff Cody
113fe792fd block/nfs: fix mutex assertion in nfs_file_close()
Commit c096358e74 introduced assertion
checks for when qemu_mutex() functions are called without the
corresponding qemu_mutex_init() having initialized the mutex.

This uncovered a latent bug in qemu's nfs driver - in
nfs_client_close(), the NFSClient structure is overwritten with zeros,
prior to the mutex being destroyed.

Go ahead and destroy the mutex in nfs_client_close(), and change where
we call qemu_mutex_init() so that it is correctly balanced.

There are also a couple of memory leaks obscured by the memset, so this
fixes those as well.

Finally, we should be able to get rid of the memset(), as it isn't
necessary.

Cc: qemu-stable@nongnu.org
Signed-off-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Peter Lieven <pl@kamp.de>
Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2017-08-08 15:19:16 +02:00
Kevin Wolf
ea22b7a220 qemu-iotests: Test reopen between read-only and read-write
This serves as a regression test for the bugs that were just fixed for
bdrv_reopen() between read-only and read-write mode.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
2017-08-08 15:19:16 +02:00
Kevin Wolf
ea92203c66 qemu-io: Allow reopen read-write
This allows qemu-iotests to test the switch between read-only and
read-write mode for block devices.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
2017-08-08 15:19:16 +02:00
Kevin Wolf
fd4520212b block: Set BDRV_O_ALLOW_RDWR during rw reopen
Reopening an image should be consistent with opening it, so we should
set BDRV_O_ALLOW_RDWR for any image that is reopened read-write like in
bdrv_open_inherit().

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
2017-08-08 15:19:16 +02:00
Kevin Wolf
54a32bfec1 block: Allow reopen rw without BDRV_O_ALLOW_RDWR
BDRV_O_ALLOW_RDWR is a flag that tells whether qemu can internally
reopen a node read-write temporarily because the user requested
read-write for the top-level image, but qemu decided that read-only is
enough for this node (a backing file).

bdrv_reopen() is different, it is also used for cases where the user
changed their mind and wants to update the options. There is no reason
to forbid making a node read-write in that case.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
2017-08-08 15:19:16 +02:00
Kevin Wolf
8aecf1d1bd block: Fix order in bdrv_replace_child()
Commit 8ee03995 refactored the code incorrectly and broke the release of
permissions on the old BDS. Instead of changing the permissions to the
new required values after removing the old BDS from the list of
children, it only re-obtains the permissions it already had.

Change the order of operations so that the old BDS is removed again
before calculating the new required permissions.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
2017-08-08 15:19:16 +02:00
Denis V. Lunev
e5e6268348 parallels: drop check that bdrv_truncate() is working
This would be actually strange and error prone. If truncate() nowadays
will fail, there is something fatally wrong. Let's check for that during
the actual work.

The only fallback case is when the file is not zero initialized. In this
case we should switch to preallocation via fallocate().

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Markus Armbruster <armbru@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Max Reitz <mreitz@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
2017-08-08 15:19:16 +02:00
Denis V. Lunev
d8b83e37c3 parallels: respect error code of bdrv_getlength() in allocate_clusters()
If we can not get the file length, the state of BDS is broken completely.
Return error to the caller.

Signed-off-by: Denis V. Lunev <den@openvz.org>
CC: Markus Armbruster <armbru@redhat.com>
CC: Kevin Wolf <kwolf@redhat.com>
CC: Max Reitz <mreitz@redhat.com>
CC: Stefan Hajnoczi <stefanha@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
2017-08-08 15:19:16 +02:00