Block layer patches
[Qemu-devel] [PULL 2/5] tests: Fix test 049 fallout from improved HMP error messages
In reply to Kevin WolfFrom: Eric Blake <[email protected]>
Commit 50b7b000 improved HMP error messages, but forgot to update qemu-iotests to match.
--- tests/qemu-iotests/049.out | 1 + 1 file changed, 1 insertion(+)
tests/qemu-iotests/049.out +1 -0
@@ -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 ==
Signature · 1 line
1.8.3.1
The following changes since commit ff770b07f34d28b79013a83989bd6c85f8f16b2f:
Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging (2015-10-02 11:01:18 +0100)
are available in the git repository at:
git://repo.or.cz/qemu/kevin.git tags/for-upstream
for you to fetch changes up to 73ba05d936e82fe01b2b2cf987bf3aecb4792af5:
block/raw-posix: Open file descriptor O_RDWR to work around glibc posix_fallocate emulation issue. (2015-10-02 13:48:29 +0200)
----------------------------------------------------------------
Block layer patches
----------------------------------------------------------------
Alberto Garcia (1):
block: disable I/O limits at the beginning of bdrv_close()
Eric Blake (1):
tests: Fix test 049 fallout from improved HMP error messages
Kevin Wolf (1):
raw-win32: Fix write request error handling
Max Reitz (1):
iotests: Fix test 128 for password-less sudo
Richard W.M. Jones (1):
block/raw-posix: Open file descriptor O_RDWR to work around glibc posix_fallocate emulation issue.
block.c | 11 ++++++----- block/raw-posix.c | 2 +- block/raw-win32.c | 4 ++-- tests/qemu-iotests/049.out | 1 + tests/qemu-iotests/128 | 9 ++++++++- 5 files changed, 18 insertions(+), 9 deletions(-)
[Qemu-devel] [PULL 1/5] raw-win32: Fix write request error handling
aio_worker() wrote the return code to the wrong variable.
--- block/raw-win32.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
block/raw-win32.c +2 -2
@@ -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 :
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 4/5] block: disable I/O limits at the beginning of bdrv_close()
In reply to Kevin WolfFrom: Alberto Garcia <[email protected]>
Disabling I/O limits from a BDS also drains all pending throttled requests, so it should be done at the beginning of bdrv_close() with the rest of the bdrv_drain() calls before the BlockDriver is closed.
--- block.c | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-)
block.c +6 -5
@@ -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); }
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 3/5] iotests: Fix test 128 for password-less sudo
In reply to Kevin WolfFrom: Max Reitz <[email protected]>
As of 934659c460d46c948cf348822fda1d38556ed9a4, $QEMU_IO is generally no longer a program name, and therefore "sudo -n $QEMU_IO" will no longer work.
Fix this by copying the qemu-io invocation function from common.config, making it use $sudo for invoking $QEMU_IO_PROG, and then use that function instead of $QEMU_IO.
--- tests/qemu-iotests/128 | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
tests/qemu-iotests/128 +8 -1
@@ -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"
Signature · 1 line
1.8.3.1
[Qemu-devel] [PULL 5/5] block/raw-posix: Open file descriptor O_RDWR to work around glibc posix_fallocate emulation issue.
In reply to Kevin WolfFrom: "Richard W.M. Jones" <[email protected]>
https://bugzilla.redhat.com/show_bug.cgi?id=1265196
The following command fails on an NFS mountpoint:
$ qemu-img create -f qcow2 -o preallocation=falloc disk.img 262144 Formatting 'disk.img', fmt=qcow2 size=262144 encryption=off cluster_size=65536 preallocation='falloc' lazy_refcounts=off qemu-img: disk.img: Could not preallocate data for the new file: Bad file descriptor
The reason turns out to be because NFS doesn't support the posix_fallocate call. glibc emulates it instead. However glibc's emulation involves using the pread(2) syscall. The pread syscall fails with EBADF if the file descriptor is opened without the read open-flag (ie. open (..., O_WRONLY)).
I contacted glibc upstream about this, and their response is here:
https://bugzilla.redhat.com/show_bug.cgi?id=1265196#c9
There are two possible fixes: Use Linux fallocate directly, or (this fix) work around the problem in qemu by opening the file with O_RDWR instead of O_WRONLY.
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1265196
--- block/raw-posix.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
block/raw-posix.c +1 -1
@@ -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;
Signature · 1 line
1.8.3.1
Peter Maydell
AppliedQuoted 7 lines · Kevin Wolf
The following changes since commit
ff770b07f34d28b79013a83989bd6c85f8f16b2f:Merge remote-tracking branch 'remotes/cody/tags/block-pull-request' into staging (2015-10-02 11:01:18 +0100)
are available in the git repository at:
Quoted 9 lines
git://repo.or.cz/qemu/kevin.gittags/for-upstreamfor you to fetch changes up to
73ba05d936e82fe01b2b2cf987bf3aecb4792af5:
block/raw-posix: Open file descriptorO_RDWRto work around glibcposix_fallocateemulation issue. (2015-10-02 13:48:29 +0200)----------------------------------------------------------------
Block layer patches
Applied, thanks.
-- PMM