qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PULL 0/5] Block layer patches
@ 2015-10-02 12:50 Kevin Wolf
  2015-10-02 12:50 ` [Qemu-devel] [PULL 1/5] raw-win32: Fix write request error handling Kevin Wolf
                   ` (5 more replies)
  0 siblings, 6 replies; 7+ messages in thread
From: Kevin Wolf @ 2015-10-02 12:50 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

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(-)

^ permalink raw reply	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PULL 1/5] raw-win32: Fix write request error handling
  2015-10-02 12:50 [Qemu-devel] [PULL 0/5] Block layer patches Kevin Wolf
@ 2015-10-02 12:50 ` Kevin Wolf
  2015-10-02 12:50 ` [Qemu-devel] [PULL 2/5] tests: Fix test 049 fallout from improved HMP error messages Kevin Wolf
                   ` (4 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2015-10-02 12:50 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

aio_worker() wrote the return code to the wrong variable.

Signed-off-by: Kevin Wolf <kwolf@redhat.com>
Tested-by: Guangmu Zhu <guangmuzhu@gmail.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
---
 block/raw-win32.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/block/raw-win32.c b/block/raw-win32.c
index 68f2338..b562c94 100644
--- a/block/raw-win32.c
+++ b/block/raw-win32.c
@@ -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:
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PULL 2/5] tests: Fix test 049 fallout from improved HMP error messages
  2015-10-02 12:50 [Qemu-devel] [PULL 0/5] Block layer patches Kevin Wolf
  2015-10-02 12:50 ` [Qemu-devel] [PULL 1/5] raw-win32: Fix write request error handling Kevin Wolf
@ 2015-10-02 12:50 ` Kevin Wolf
  2015-10-02 12:50 ` [Qemu-devel] [PULL 3/5] iotests: Fix test 128 for password-less sudo Kevin Wolf
                   ` (3 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2015-10-02 12:50 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Eric Blake <eblake@redhat.com>

Commit 50b7b000 improved HMP error messages, but forgot to update
qemu-iotests to match.

Reported-by: Kevin Wolf <kwolf@redhat.com>
Signed-off-by: Eric Blake <eblake@redhat.com>
Reviewed-by: John Snow <jsnow@redhat.com>
Reviewed-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/049.out | 1 +
 1 file changed, 1 insertion(+)

diff --git a/tests/qemu-iotests/049.out b/tests/qemu-iotests/049.out
index 0425ae0..a2b6703 100644
--- a/tests/qemu-iotests/049.out
+++ b/tests/qemu-iotests/049.out
@@ -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 ==
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PULL 3/5] iotests: Fix test 128 for password-less sudo
  2015-10-02 12:50 [Qemu-devel] [PULL 0/5] Block layer patches Kevin Wolf
  2015-10-02 12:50 ` [Qemu-devel] [PULL 1/5] raw-win32: Fix write request error handling Kevin Wolf
  2015-10-02 12:50 ` [Qemu-devel] [PULL 2/5] tests: Fix test 049 fallout from improved HMP error messages Kevin Wolf
@ 2015-10-02 12:50 ` Kevin Wolf
  2015-10-02 12:50 ` [Qemu-devel] [PULL 4/5] block: disable I/O limits at the beginning of bdrv_close() Kevin Wolf
                   ` (2 subsequent siblings)
  5 siblings, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2015-10-02 12:50 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Max Reitz <mreitz@redhat.com>

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.

Reported-by: Fam Zheng <famz@redhat.com>
Signed-off-by: Max Reitz <mreitz@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 tests/qemu-iotests/128 | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/128 b/tests/qemu-iotests/128
index e2a0f2f..3d8107d 100755
--- a/tests/qemu-iotests/128
+++ b/tests/qemu-iotests/128
@@ -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"
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PULL 4/5] block: disable I/O limits at the beginning of bdrv_close()
  2015-10-02 12:50 [Qemu-devel] [PULL 0/5] Block layer patches Kevin Wolf
                   ` (2 preceding siblings ...)
  2015-10-02 12:50 ` [Qemu-devel] [PULL 3/5] iotests: Fix test 128 for password-less sudo Kevin Wolf
@ 2015-10-02 12:50 ` Kevin Wolf
  2015-10-02 12:50 ` [Qemu-devel] [PULL 5/5] block/raw-posix: Open file descriptor O_RDWR to work around glibc posix_fallocate emulation issue Kevin Wolf
  2015-10-02 15:03 ` [Qemu-devel] [PULL 0/5] Block layer patches Peter Maydell
  5 siblings, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2015-10-02 12:50 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: Alberto Garcia <berto@igalia.com>

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.

Signed-off-by: Alberto Garcia <berto@igalia.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block.c | 11 ++++++-----
 1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/block.c b/block.c
index 6268e37..1f90b47 100644
--- a/block.c
+++ b/block.c
@@ -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);
     }
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [Qemu-devel] [PULL 5/5] block/raw-posix: Open file descriptor O_RDWR to work around glibc posix_fallocate emulation issue.
  2015-10-02 12:50 [Qemu-devel] [PULL 0/5] Block layer patches Kevin Wolf
                   ` (3 preceding siblings ...)
  2015-10-02 12:50 ` [Qemu-devel] [PULL 4/5] block: disable I/O limits at the beginning of bdrv_close() Kevin Wolf
@ 2015-10-02 12:50 ` Kevin Wolf
  2015-10-02 15:03 ` [Qemu-devel] [PULL 0/5] Block layer patches Peter Maydell
  5 siblings, 0 replies; 7+ messages in thread
From: Kevin Wolf @ 2015-10-02 12:50 UTC (permalink / raw)
  To: qemu-block; +Cc: kwolf, qemu-devel

From: "Richard W.M. Jones" <rjones@redhat.com>

  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.

Signed-off-by: Richard W.M. Jones <rjones@redhat.com>
BZ: https://bugzilla.redhat.com/show_bug.cgi?id=1265196
Reviewed-by: Jeff Cody <jcody@redhat.com>
Reviewed-by: Eric Blake <eblake@redhat.com>
Signed-off-by: Kevin Wolf <kwolf@redhat.com>
---
 block/raw-posix.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/block/raw-posix.c b/block/raw-posix.c
index 30df8ad..86f8562 100644
--- a/block/raw-posix.c
+++ b/block/raw-posix.c
@@ -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;
-- 
1.8.3.1

^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [Qemu-devel] [PULL 0/5] Block layer patches
  2015-10-02 12:50 [Qemu-devel] [PULL 0/5] Block layer patches Kevin Wolf
                   ` (4 preceding siblings ...)
  2015-10-02 12:50 ` [Qemu-devel] [PULL 5/5] block/raw-posix: Open file descriptor O_RDWR to work around glibc posix_fallocate emulation issue Kevin Wolf
@ 2015-10-02 15:03 ` Peter Maydell
  5 siblings, 0 replies; 7+ messages in thread
From: Peter Maydell @ 2015-10-02 15:03 UTC (permalink / raw)
  To: Kevin Wolf; +Cc: QEMU Developers, Qemu-block

On 2 October 2015 at 13:50, Kevin Wolf <kwolf@redhat.com> wrote:
> 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
>

Applied, thanks.

-- PMM

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2015-10-02 15:04 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-10-02 12:50 [Qemu-devel] [PULL 0/5] Block layer patches Kevin Wolf
2015-10-02 12:50 ` [Qemu-devel] [PULL 1/5] raw-win32: Fix write request error handling Kevin Wolf
2015-10-02 12:50 ` [Qemu-devel] [PULL 2/5] tests: Fix test 049 fallout from improved HMP error messages Kevin Wolf
2015-10-02 12:50 ` [Qemu-devel] [PULL 3/5] iotests: Fix test 128 for password-less sudo Kevin Wolf
2015-10-02 12:50 ` [Qemu-devel] [PULL 4/5] block: disable I/O limits at the beginning of bdrv_close() Kevin Wolf
2015-10-02 12:50 ` [Qemu-devel] [PULL 5/5] block/raw-posix: Open file descriptor O_RDWR to work around glibc posix_fallocate emulation issue Kevin Wolf
2015-10-02 15:03 ` [Qemu-devel] [PULL 0/5] Block layer patches Peter Maydell

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).