Block layer patches

-----BEGIN PGP SIGNATURE-----
 Version: GnuPG v2.0.22 (GNU/Linux)
 
 iQIcBAABAgAGBQJWDm85AAoJEH8JsnLIjy/W8UwQALTalzXwWVx0FeVHnBVDENXI
 vLh6ZUgGxMGs5JmVyycoF6YkFhlJMI+EBhBqY+VtXSkyTpiJN0+YMYpIjBHWZyX5
 KiDYJjJT1GDp1PcskE6nAU+b8r9GFov8+S0oCuE4l6++KxjG1liv7rifx3TW5uIl
 yHcEX6lr9rAVMO2Uz62vTvYWrLv2eRplzLvZy3I31Q413Fp5ed0Qbd2SGdUG7eCm
 3midqxFdvcWfed59C6OHg8AWbNxgT+MVIhved2n/N+oqKSE+cmcinWxE+HJwClfY
 1w4FBZ6+yuvUHJtM5iiU867VHPSNRsOc3NQVc3tBkqr30xUPmO3vPN/Ey4QG8ugH
 OfjBIHxKp/aVOJN44fH4FoJ3t2qnv5c8ncn/0N3WdbqVnH4LUpQF2DfdCGmxQpRt
 y91Sgs5Jxog3C+hdLzOvjhIdPi7AZvyU4jz13596Gg3AHWFoz25Sk+paefHJuN+i
 nK4bH6GNF1wnZYk9VX0r5SYAvTg8OoK4Zt+o254DXpkJZIXU0hDCGMPnVOFmmh8W
 +dCxZz3D5u5VdBU4VZ4kGHz7GZRUbrE7PYYoFdsKPrfxbV8daNO8pGF+Umph+jAX
 NS0hl8bcCQjCLal8rLDc06sjauBcltjo8pAyGe7D1QTae8nj3o6IqI1jOfSwp0wZ
 VUNtHjRjIB828+HIdPM9
 =4Do4
 -----END PGP SIGNATURE-----

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

Block layer patches

# gpg: Signature made Fri 02 Oct 2015 12:49:13 BST using RSA key ID C88F2FD6
# gpg: Good signature from "Kevin Wolf <kwolf@redhat.com>"

* remotes/kevin/tags/for-upstream:
  block/raw-posix: Open file descriptor O_RDWR to work around glibc posix_fallocate emulation issue.
  block: disable I/O limits at the beginning of bdrv_close()
  iotests: Fix test 128 for password-less sudo
  tests: Fix test 049 fallout from improved HMP error messages
  raw-win32: Fix write request error handling

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2015-10-02 14:47:10 +01:00
commit 37dd86a44c
5 changed files with 18 additions and 9 deletions

11
block.c
View File

@ -1907,6 +1907,12 @@ void bdrv_close(BlockDriverState *bs)
if (bs->job) {
block_job_cancel_sync(bs->job);
}
/* Disable I/O limits and drain all pending throttled requests */
if (bs->io_limits_enabled) {
bdrv_io_limits_disable(bs);
}
bdrv_drain(bs); /* complete I/O */
bdrv_flush(bs);
bdrv_drain(bs); /* in case flush left pending I/O */
@ -1958,11 +1964,6 @@ void bdrv_close(BlockDriverState *bs)
blk_dev_change_media_cb(bs->blk, false);
}
/*throttling disk I/O limits*/
if (bs->io_limits_enabled) {
bdrv_io_limits_disable(bs);
}
QLIST_FOREACH_SAFE(ban, &bs->aio_notifiers, list, ban_next) {
g_free(ban);
}

View File

@ -1648,7 +1648,7 @@ static int raw_create(const char *filename, QemuOpts *opts, Error **errp)
goto out;
}
fd = qemu_open(filename, O_WRONLY | O_CREAT | O_TRUNC | O_BINARY,
fd = qemu_open(filename, O_RDWR | O_CREAT | O_TRUNC | O_BINARY,
0644);
if (fd < 0) {
result = -errno;

View File

@ -119,9 +119,9 @@ static int aio_worker(void *arg)
case QEMU_AIO_WRITE:
count = handle_aiocb_rw(aiocb);
if (count == aiocb->aio_nbytes) {
count = 0;
ret = 0;
} else {
count = -EINVAL;
ret = -EINVAL;
}
break;
case QEMU_AIO_FLUSH:

View File

@ -118,6 +118,7 @@ qemu-img: kilobytes, megabytes, gigabytes, terabytes, petabytes and exabytes.
qemu-img create -f qcow2 -o size=foobar TEST_DIR/t.qcow2
qemu-img: Parameter 'size' expects a size
You may use k, M, G or T suffixes for kilobytes, megabytes, gigabytes and terabytes.
qemu-img: TEST_DIR/t.qcow2: Invalid options for file format 'qcow2'
== Check correct interpretation of suffixes for cluster size ==

View File

@ -31,6 +31,11 @@ status=1 # failure is the default!
devname="eiodev$$"
sudo=""
_sudo_qemu_io_wrapper()
{
(exec $sudo "$QEMU_IO_PROG" $QEMU_IO_OPTIONS "$@")
}
_setup_eiodev()
{
# This test should either be run as root or with passwordless sudo
@ -76,7 +81,9 @@ TEST_IMG="/dev/mapper/$devname"
echo
echo "== reading from error device =="
# Opening image should succeed but the read operation should fail
$sudo $QEMU_IO --format "$IMGFMT" --nocache -c "read 0 65536" "$TEST_IMG" | _filter_qemu_io
_sudo_qemu_io_wrapper --format "$IMGFMT" --nocache \
-c "read 0 65536" "$TEST_IMG" \
| _filter_qemu_io
# success, all done
echo "*** done"