Skip to contentSkip to conversation

Block layer patches for 2.10.0-rc1

GIT PULL Kevin Wolf 2 participants 18 messages Aug 1, 2017

Subsystems (2)
lore
Share & tools
lore

Kevin Wolf

author
#0 lore raw

The following changes since commit 5619c179057e24195ff19c8fe6d6a6cbcb16ed28:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20170731' into staging (2017-07-31 14:45:42 +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 9ae03670701fea9124f4f1a6d4b6d1badbf9e485:

block/qapi: Remove redundant NULL check to silence Coverity (2017-08-01 15:26:04 +0200)

----------------------------------------------------------------
Block layer patches for 2.10.0-rc1

----------------------------------------------------------------
Eric Blake (2):
iotests: Check dirty bitmap statistics in 124
iotests: Add test of recent fix to 'qemu-img measure'

Kevin Wolf (8):
qemu-iotests/041: Fix leaked scratch images
qemu-iotests: Remove blkdebug.conf after tests qemu-iotests/141: Fix image cleanup qemu-iotests/153: Fix leaked scratch images qemu-iotests/162: Fix leaked temporary files qemu-iotests/063: Fix leaked image qemu-iotests/059: Fix leaked image files block/qapi: Remove redundant NULL check to silence Coverity

Manos Pitsidianakis (2):
block: fix dangling bs->explicit_options in block.c
block: fix leaks in bdrv_open_driver()

Max Reitz (2):
iotests: Fix test 156
iotests: Redirect stderr to stdout in 186

Stefan Hajnoczi (1):
docs: add qemu-block-drivers(7) man page

 block.c                      |  24 +-
 block/qapi.c                 |   3 +-
 Makefile                     |  23 +-
 docs/qemu-block-drivers.texi | 799 +++++++++++++++++++++++++++++++++++++++++++
 qemu-doc.texi                | 780 +-----------------------------------------
 tests/qemu-iotests/041       |   4 +-
 tests/qemu-iotests/059       |  11 +-
 tests/qemu-iotests/059.out   |  22 +-
 tests/qemu-iotests/063       |   4 +-
 tests/qemu-iotests/074       |   1 +
 tests/qemu-iotests/124       |   7 +-
 tests/qemu-iotests/141       |   2 +-
 tests/qemu-iotests/153       |   1 +
 tests/qemu-iotests/156       |   4 +-
 tests/qemu-iotests/162       |   7 +
 tests/qemu-iotests/179       |   1 +
 tests/qemu-iotests/186       |   2 +-
 tests/qemu-iotests/186.out   |  12 +-
 tests/qemu-iotests/190       |  59 ++++
 tests/qemu-iotests/190.out   |  11 +
 tests/qemu-iotests/common.rc |   3 +
 tests/qemu-iotests/group     |   1 +
 22 files changed, 958 insertions(+), 823 deletions(-)
 create mode 100644 docs/qemu-block-drivers.texi
 create mode 100755 tests/qemu-iotests/190
 create mode 100644 tests/qemu-iotests/190.out
author
#1 lore raw

[Qemu-devel] [PULL 03/15] iotests: Redirect stderr to stdout in 186

From: Max Reitz <[email protected]>

Without redirecting qemu's stderr to stdout, _filter_qemu will not apply to warnings. This results in $QEMU_PROG not being replaced by QEMU_PROG which is not great if your qemu executable is not called qemu-system-x86_64 (e.g. qemu-system-i386).

---
 tests/qemu-iotests/186     |  2 +-
 tests/qemu-iotests/186.out | 12 ++++++------
 2 files changed, 7 insertions(+), 7 deletions(-)
tests/qemu-iotests/186 +1 -1
index ab83ee402a..2b9f618f90 100755
@@ -56,7 +56,7 @@ function do_run_qemu()
             done
         fi
         echo quit
-    ) | $QEMU -S -nodefaults -display none -device virtio-scsi-pci -monitor stdio "$@"
+    ) | $QEMU -S -nodefaults -display none -device virtio-scsi-pci -monitor stdio "$@" 2>&1
     echo
 }
 
tests/qemu-iotests/186.out +6 -6
index b8bf9a2550..c8377fe146 100644
@@ -442,28 +442,28 @@ ide0-cd0 (NODE_NAME): null-co:// (null-co, read-only)
     Cache mode:       writeback
 (qemu) quit
 
-qemu-system-x86_64: -drive if=scsi,driver=null-co: warning: bus=0,unit=0 is deprecated with this machine type
 Testing: -drive if=scsi,driver=null-co
 QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) info block
+(qemu) QEMU_PROG: -drive if=scsi,driver=null-co: warning: bus=0,unit=0 is deprecated with this machine type
+info block
 scsi0-hd0 (NODE_NAME): null-co:// (null-co)
     Attached to:      /machine/unattached/device[27]/scsi.0/legacy[0]
     Cache mode:       writeback
 (qemu) quit
 
-qemu-system-x86_64: -drive if=scsi,media=cdrom: warning: bus=0,unit=0 is deprecated with this machine type
 Testing: -drive if=scsi,media=cdrom
 QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) info block
+(qemu) QEMU_PROG: -drive if=scsi,media=cdrom: warning: bus=0,unit=0 is deprecated with this machine type
+info block
 scsi0-cd0: [not inserted]
     Attached to:      /machine/unattached/device[27]/scsi.0/legacy[0]
     Removable device: not locked, tray closed
 (qemu) quit
 
-qemu-system-x86_64: -drive if=scsi,driver=null-co,media=cdrom: warning: bus=0,unit=0 is deprecated with this machine type
 Testing: -drive if=scsi,driver=null-co,media=cdrom
 QEMU X.Y.Z monitor - type 'help' for more information
-(qemu) info block
+(qemu) QEMU_PROG: -drive if=scsi,driver=null-co,media=cdrom: warning: bus=0,unit=0 is deprecated with this machine type
+info block
 scsi0-cd0 (NODE_NAME): null-co:// (null-co, read-only)
     Attached to:      /machine/unattached/device[27]/scsi.0/legacy[0]
     Removable device: not locked, tray closed
Signature · 1 line
2.13.3
author
#2 lore raw

[Qemu-devel] [PULL 04/15] iotests: Check dirty bitmap statistics in 124

In reply to Kevin Wolf

From: Eric Blake <[email protected]>

We had a bug for multiple releases where dirty-bitmap count was documented in bytes but reported in sectors; enhance the testsuite to add coverage of DirtyBitmapInfo to ensure we do not regress again.

---
 tests/qemu-iotests/124 | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)
tests/qemu-iotests/124 +6 -1
index d0d2c2bfb0..8e76e62f93 100644
@@ -336,7 +336,12 @@ class TestIncrementalBackup(TestIncrementalBackupBase):
                            (('0xab', 0, 512),
                             ('0xfe', '16M', '256k'),
                             ('0x64', '32736k', '64k')))
-
+        # Check the dirty bitmap stats
+        result = self.vm.qmp('query-block')
+        self.assert_qmp(result, 'return[0]/dirty-bitmaps[0]/name', 'bitmap0')
+        self.assert_qmp(result, 'return[0]/dirty-bitmaps[0]/count', 458752)
+        self.assert_qmp(result, 'return[0]/dirty-bitmaps[0]/granularity', 65536)
+        self.assert_qmp(result, 'return[0]/dirty-bitmaps[0]/status', 'active')
 
         # Prepare a cluster_size=128k backup target without a backing file.
         (target, _) = bitmap0.new_target()
Signature · 1 line
2.13.3
author
#3 lore raw

[Qemu-devel] [PULL 02/15] iotests: Fix test 156

In reply to Kevin Wolf

From: Max Reitz <[email protected]>

On one hand, the _make_test_img invocation for creating the target image was missing a -u because its backing file is not supposed to exist at that point.

On the other hand, nobody noticed probably because the backing file is created later on and _cleanup failed to remove it: The quotation marks were misplaced so bash tried to delete a file literally called "$TEST_IMG{,.target}..." instead of performing brace expansion. Thus, the files stayed around after the first run and qemu-img create did not complain about a missing backing file on any run but the first.

---
 tests/qemu-iotests/156 | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
tests/qemu-iotests/156 +2 -2
index 2c4a06e2d8..e75dc4d743 100755
@@ -38,7 +38,7 @@ status=1	# failure is the default!
 _cleanup()
 {
     _cleanup_qemu
-    rm -f "$TEST_IMG{,.target}{,.backing,.overlay}"
+    rm -f "$TEST_IMG"{,.target}{,.backing,.overlay}
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
@@ -83,7 +83,7 @@ _send_qemu_cmd $QEMU_HANDLE \
     'return'
 
 # Create target image
-TEST_IMG="$TEST_IMG.target.overlay" _make_test_img -b "$TEST_IMG.target" 1M
+TEST_IMG="$TEST_IMG.target.overlay" _make_test_img -u -b "$TEST_IMG.target" 1M
 
 # Mirror snapshot
 _send_qemu_cmd $QEMU_HANDLE \
Signature · 1 line
2.13.3
author
#4 lore raw

[Qemu-devel] [PULL 05/15] iotests: Add test of recent fix to 'qemu-img measure'

In reply to Kevin Wolf

From: Eric Blake <[email protected]>

The new test 190 ensures we don't regress back to an infinite loop when measuring the size of a 2T+ qcow2 image. I did not append to test 178, because that test is also designed to run with format 'raw'; also, this gives us some coverage of the measure command under the quick group.

---
 tests/qemu-iotests/190     | 59 ++++++++++++++++++++++++++++++++++++++++++++++
 tests/qemu-iotests/190.out | 11 +++++++++
 tests/qemu-iotests/group   |  1 +
 3 files changed, 71 insertions(+)
 create mode 100755 tests/qemu-iotests/190
 create mode 100644 tests/qemu-iotests/190.out
tests/qemu-iotests/190 new file +59 -0
new file mode 100755
index 0000000000..8f808fef5d
@@ -0,0 +1,59 @@
+#!/bin/bash
+#
+# qemu-img measure sub-command tests on huge qcow2 files
+#
+# Copyright (C) 2017 Red Hat, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <http://www.gnu.org/licenses/>.
+#
+
+# creator
[email protected]
+
+seq=`basename $0`
+echo "QA output created by $seq"
+
+here=`pwd`
+status=1    # failure is the default!
+
+_cleanup()
+{
+    _cleanup_test_img
+    rm -f "$TEST_IMG.converted"
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
+# get standard environment, filters and checks
+. ./common.rc
+. ./common.filter
+. ./common.pattern
+
+# See 178 for more extensive tests across more formats
+_supported_fmt qcow2
+_supported_proto file
+_supported_os Linux
+
+echo "== Huge file =="
+echo
+
+IMGOPTS='cluster_size=2M' _make_test_img 2T
+
+$QEMU_IMG measure -O raw -f qcow2 "$TEST_IMG"
+$QEMU_IMG measure -O qcow2 -o cluster_size=64k -f qcow2 "$TEST_IMG"
+$QEMU_IMG measure -O qcow2 -o cluster_size=2M -f qcow2 "$TEST_IMG"
+
+# success, all done
+echo "*** done"
+rm -f $seq.full
+status=0
tests/qemu-iotests/190.out new file +11 -0
new file mode 100644
index 0000000000..d001942002
@@ -0,0 +1,11 @@
+QA output created by 190
+== Huge file ==
+
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=2199023255552
+required size: 2199023255552
+fully allocated size: 2199023255552
+required size: 335806464
+fully allocated size: 2199359062016
+required size: 18874368
+fully allocated size: 2199042129920
+*** done
tests/qemu-iotests/group +1 -0
index 287f0ea27d..823811076d 100644
@@ -184,3 +184,4 @@
 186 rw auto
 188 rw auto quick
 189 rw auto
+190 rw auto quick
Signature · 1 line
2.13.3
author
#5 lore raw

[Qemu-devel] [PULL 06/15] block: fix dangling bs->explicit_options in block.c

In reply to Kevin Wolf

From: Manos Pitsidianakis <[email protected]>

In some error paths it is possible to QDECREF a freed dangling explicit_options, resulting in a heap overflow crash. For example bdrv_open_inherit()'s fail unrefs it, then calls bdrv_unref which calls bdrv_close which also unrefs it.

---
 block.c | 2 ++
 1 file changed, 2 insertions(+)
block.c +2 -0
index 37e72b7a96..7a78bc647b 100644
@@ -2608,6 +2608,7 @@ fail:
     QDECREF(bs->options);
     QDECREF(options);
     bs->options = NULL;
+    bs->explicit_options = NULL;
     bdrv_unref(bs);
     error_propagate(errp, local_err);
     return NULL;
@@ -3087,6 +3088,7 @@ static void bdrv_close(BlockDriverState *bs)
         QDECREF(bs->options);
         QDECREF(bs->explicit_options);
         bs->options = NULL;
+        bs->explicit_options = NULL;
         QDECREF(bs->full_open_options);
         bs->full_open_options = NULL;
     }
Signature · 1 line
2.13.3
author
#6 lore raw

[Qemu-devel] [PULL 07/15] block: fix leaks in bdrv_open_driver()

In reply to Kevin Wolf

From: Manos Pitsidianakis <[email protected]>

bdrv_open_driver() is called in two places, bdrv_new_open_driver() and bdrv_open_common(). In the latter, failure cleanup in is in its caller, bdrv_open_inherit(), which unrefs the bs->file of the failed driver open if it exists.

Let's move the bs->file cleanup to bdrv_open_driver() to take care of all callers and do not set bs->drv to NULL unless the driver's open function failed. When bs is destroyed by removing its last reference, it calls bdrv_close() which checks bs->drv to perform the needed cleanups and also call the driver's close function. Since it cleans up options and opaque we must take care not leave dangling pointers.

The error paths in bdrv_open_driver() are now two:
If open fails, drv->bdrv_close() should not be called. Unref the child if it exists, free what we allocated and set bs->drv to NULL. Return the error and let callers free their stuff.

If open succeeds but we fail after, return the error and let callers unref and delete their bs, while cleaning up their allocations.

---
 block.c | 22 +++++++++++-----------
 1 file changed, 11 insertions(+), 11 deletions(-)
block.c +11 -11
index 7a78bc647b..ce9cce7b3c 100644
@@ -1119,20 +1119,19 @@ static int bdrv_open_driver(BlockDriverState *bs, BlockDriver *drv,
         } else {
             error_setg_errno(errp, -ret, "Could not open image");
         }
-        goto free_and_fail;
+        goto open_failed;
     }
 
     ret = refresh_total_sectors(bs, bs->total_sectors);
     if (ret < 0) {
         error_setg_errno(errp, -ret, "Could not refresh total sector count");
-        goto free_and_fail;
+        return ret;
     }
 
     bdrv_refresh_limits(bs, &local_err);
     if (local_err) {
         error_propagate(errp, local_err);
-        ret = -EINVAL;
-        goto free_and_fail;
+        return -EINVAL;
     }
 
     assert(bdrv_opt_mem_align(bs) != 0);
@@ -1140,12 +1139,14 @@ static int bdrv_open_driver(BlockDriverState *bs, BlockDriver *drv,
     assert(is_power_of_2(bs->bl.request_alignment));
 
     return 0;
-
-free_and_fail:
-    /* FIXME Close bs first if already opened*/
+open_failed:
+    bs->drv = NULL;
+    if (bs->file != NULL) {
+        bdrv_unref_child(bs, bs->file);
+        bs->file = NULL;
+    }
     g_free(bs->opaque);
     bs->opaque = NULL;
-    bs->drv = NULL;
     return ret;
 }
 
@@ -1166,7 +1167,9 @@ BlockDriverState *bdrv_new_open_driver(BlockDriver *drv, const char *node_name,
     ret = bdrv_open_driver(bs, drv, node_name, bs->options, flags, errp);
     if (ret < 0) {
         QDECREF(bs->explicit_options);
+        bs->explicit_options = NULL;
         QDECREF(bs->options);
+        bs->options = NULL;
         bdrv_unref(bs);
         return NULL;
     }
@@ -2600,9 +2603,6 @@ static BlockDriverState *bdrv_open_inherit(const char *filename,
 
 fail:
     blk_unref(file);
-    if (bs->file != NULL) {
-        bdrv_unref_child(bs, bs->file);
-    }
     QDECREF(snapshot_options);
     QDECREF(bs->explicit_options);
     QDECREF(bs->options);
Signature · 1 line
2.13.3
author
#7 lore raw

[Qemu-devel] [PULL 09/15] qemu-iotests: Remove blkdebug.conf after tests

In reply to Kevin Wolf

qemu-iotests 074 and 179 left a blkdebug.conf behind in the scratch directory. Make sure to clean up after completing the tests.

---
 tests/qemu-iotests/074 | 1 +
 tests/qemu-iotests/179 | 1 +
 2 files changed, 2 insertions(+)
tests/qemu-iotests/074 +1 -0
index aba126cb69..b17866bd34 100755
@@ -32,6 +32,7 @@ _cleanup()
     echo "Cleanup"
     _cleanup_test_img
     rm "${TEST_IMG2}"
+    rm -f "$TEST_DIR/blkdebug.conf"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
tests/qemu-iotests/179 +1 -0
index 7bc8db8fe0..115944a753 100755
@@ -30,6 +30,7 @@ status=1	# failure is the default!
 _cleanup()
 {
 	_cleanup_test_img
+    rm -f "$TEST_DIR/blkdebug.conf"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
Signature · 1 line
2.13.3
author
#8 lore raw

[Qemu-devel] [PULL 10/15] qemu-iotests/141: Fix image cleanup

In reply to Kevin Wolf

qemu-iotests 141 attempted to use brace expansion to remove all images with a single command. However, for this to work, the braces shouldn't be quoted.

With this fix, the tests correctly cleans up its scratch images.

---
 tests/qemu-iotests/141 | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
tests/qemu-iotests/141 +1 -1
index 40a3405968..2f9d7b9bc2 100755
@@ -31,7 +31,7 @@ _cleanup()
 {
     _cleanup_qemu
     _cleanup_test_img
-    rm -f "$TEST_DIR/{b,m,o}.$IMGFMT"
+    rm -f "$TEST_DIR"/{b,m,o}.$IMGFMT
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
Signature · 1 line
2.13.3
author
#9 lore raw

[Qemu-devel] [PULL 08/15] qemu-iotests/041: Fix leaked scratch images

In reply to Kevin Wolf

qemu-iotests 041 left quorum_snapshot.img and target.img behind in the scratch directory. Make sure to clean up after completing the tests.

---
 tests/qemu-iotests/041 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
tests/qemu-iotests/041 +3 -1
index 4cda540735..a860a31e9a 100755
@@ -418,6 +418,7 @@ new_state = "1"
     def tearDown(self):
         self.vm.shutdown()
         os.remove(test_img)
+        os.remove(target_img)
         os.remove(backing_img)
         os.remove(self.blkdebug_file)
 
@@ -568,6 +569,7 @@ new_state = "1"
     def tearDown(self):
         self.vm.shutdown()
         os.remove(test_img)
+        os.remove(target_img)
         os.remove(backing_img)
         os.remove(self.blkdebug_file)
 
@@ -821,7 +823,7 @@ class TestRepairQuorum(iotests.QMPTestCase):
 
     def tearDown(self):
         self.vm.shutdown()
-        for i in self.IMAGES + [ quorum_repair_img ]:
+        for i in self.IMAGES + [ quorum_repair_img, quorum_snapshot_file ]:
             # Do a try/except because the test may have deleted some images
             try:
                 os.remove(i)
Signature · 1 line
2.13.3
author
#10 lore raw

[Qemu-devel] [PULL 13/15] qemu-iotests/063: Fix leaked image

In reply to Kevin Wolf

qemu-iotests 063 left t.raw.raw1 behind in the scratch directory because it used the wrong suffix. Make sure to clean it up after completing the test.

---
 tests/qemu-iotests/063 | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)
tests/qemu-iotests/063 +1 -3
index 352e78c778..e4f6ea9385 100755
@@ -31,7 +31,7 @@ status=1	# failure is the default!
 _cleanup()
 {
 	_cleanup_test_img
-	rm -f "$TEST_IMG.orig" "$TEST_IMG.raw" "$TEST_IMG.raw2"
+	rm -f "$TEST_IMG.orig" "$TEST_IMG.raw1" "$TEST_IMG.raw2"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
@@ -91,8 +91,6 @@ if $QEMU_IMG convert -f $IMGFMT -O $IMGFMT -n "$TEST_IMG.orig" "$TEST_IMG" >/dev
     exit 1
 fi
 
-rm -f "$TEST_IMG.orig" "$TEST_IMG.raw" "$TEST_IMG.raw2"
-
 echo "*** done"
 rm -f $seq.full
 status=0
Signature · 1 line
2.13.3
author
#11 lore raw

[Qemu-devel] [PULL 11/15] qemu-iotests/153: Fix leaked scratch images

In reply to Kevin Wolf

qemu-iotests 153 left t.qcow2.c behind in the scratch directory. Make sure to clean it up after completing the tests.

---
 tests/qemu-iotests/153 | 1 +
 1 file changed, 1 insertion(+)
tests/qemu-iotests/153 +1 -0
index 0b45d78ea3..fa25eb24bd 100755
@@ -35,6 +35,7 @@ _cleanup()
     rm -f "${TEST_IMG}.convert"
     rm -f "${TEST_IMG}.a"
     rm -f "${TEST_IMG}.b"
+    rm -f "${TEST_IMG}.c"
     rm -f "${TEST_IMG}.lnk"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
Signature · 1 line
2.13.3
author
#12 lore raw

[Qemu-devel] [PULL 12/15] qemu-iotests/162: Fix leaked temporary files

In reply to Kevin Wolf

qemu-iotests 162 left qemu-nbd.pid behind in the scratch directory, and potentially a file called '42' in the current directory. Make sure to clean it up after completing the tests.

---
 tests/qemu-iotests/162 | 7 +++++++
 1 file changed, 7 insertions(+)
tests/qemu-iotests/162 +7 -0
index cad2bd70ab..477a806360 100755
@@ -28,6 +28,13 @@ echo "QA output created by $seq"
 here="$PWD"
 status=1	# failure is the default!
 
+_cleanup()
+{
+    rm -f "${TEST_DIR}/qemu-nbd.pid"
+    rm -f 42
+}
+trap "_cleanup; exit \$status" 0 1 2 3 15
+
 # get standard environment, filters and checks
 . ./common.rc
 . ./common.filter
Signature · 1 line
2.13.3
author
#13 lore raw

[Qemu-devel] [PULL 15/15] block/qapi: Remove redundant NULL check to silence Coverity

In reply to Kevin Wolf

When skipping implicit nodes in bdrv_block_device_info(), we know that bs0 is always non-NULL; initially, because it's taken from a BdrvChild and a BdrvChild never has a NULL bs, and after the first iteration because implicit nodes always have a backing file.

Remove the NULL check and add an assertion that the implicit node does indeed have a backing file.

---
 block/qapi.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
block/qapi.c +2 -1
index d2b18ee9df..5f1a71f5d2 100644
@@ -145,8 +145,9 @@ BlockDeviceInfo *bdrv_block_device_info(BlockBackend *blk,
 
         /* Skip automatically inserted nodes that the user isn't aware of for
          * query-block (blk != NULL), but not for query-named-block-nodes */
-        while (blk && bs0 && bs0->drv && bs0->implicit) {
+        while (blk && bs0->drv && bs0->implicit) {
             bs0 = backing_bs(bs0);
+            assert(bs0);
         }
     }
 
Signature · 1 line
2.13.3
author
#14 lore raw

[Qemu-devel] [PULL 01/15] docs: add qemu-block-drivers(7) man page

In reply to Kevin Wolf

From: Stefan Hajnoczi <[email protected]>

Block driver documentation is available in qemu-doc.html. It would be convenient to have documentation for formats, protocols, and filter drivers in a man page.

Extract the relevant part of qemu-doc.html into a new file called docs/qemu-block-drivers.texi. This file can also be built as a stand-alone document (man, html, etc).

---
 Makefile                     |  23 +-
 docs/qemu-block-drivers.texi | 799 +++++++++++++++++++++++++++++++++++++++++++
 qemu-doc.texi                | 780 +-----------------------------------------
 3 files changed, 818 insertions(+), 784 deletions(-)
 create mode 100644 docs/qemu-block-drivers.texi
Makefile +18 -5
index 97a58a0f4e..aa40957967 100644
@@ -209,6 +209,9 @@ ifdef BUILD_DOCS
 DOCS=qemu-doc.html qemu-doc.txt qemu.1 qemu-img.1 qemu-nbd.8 qemu-ga.8
 DOCS+=docs/interop/qemu-qmp-ref.html docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7
 DOCS+=docs/interop/qemu-ga-ref.html docs/interop/qemu-ga-ref.txt docs/interop/qemu-ga-ref.7
+DOCS+=docs/qemu-block-drivers.html
+DOCS+=docs/qemu-block-drivers.txt
+DOCS+=docs/qemu-block-drivers.7
 ifdef CONFIG_VIRTFS
 DOCS+=fsdev/virtfs-proxy-helper.1
 endif
@@ -530,6 +533,8 @@ distclean: clean
 	rm -f docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
 	rm -f docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
 	rm -f docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
+	rm -f docs/qemu-block-drivers.7 docs/qemu-block-drivers.txt
+	rm -f docs/qemu-block-drivers.pdf docs/qemu-block-drivers.html
 	for d in $(TARGET_DIRS); do \
 	rm -rf $$d || exit 1 ; \
         done
@@ -570,11 +575,14 @@ install-doc: $(DOCS)
 	$(INSTALL_DATA) qemu-doc.txt "$(DESTDIR)$(qemu_docdir)"
 	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.html "$(DESTDIR)$(qemu_docdir)"
 	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.txt "$(DESTDIR)$(qemu_docdir)"
+	$(INSTALL_DATA) docs/qemu-block-drivers.html "$(DESTDIR)$(qemu_docdir)"
+	$(INSTALL_DATA) docs/qemu-block-drivers.txt "$(DESTDIR)$(qemu_docdir)"
 ifdef CONFIG_POSIX
 	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man1"
 	$(INSTALL_DATA) qemu.1 "$(DESTDIR)$(mandir)/man1"
 	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man7"
 	$(INSTALL_DATA) docs/interop/qemu-qmp-ref.7 "$(DESTDIR)$(mandir)/man7"
+	$(INSTALL_DATA) docs/qemu-block-drivers.7 "$(DESTDIR)$(mandir)/man7"
 ifneq ($(TOOLS),)
 	$(INSTALL_DATA) qemu-img.1 "$(DESTDIR)$(mandir)/man1"
 	$(INSTALL_DIR) "$(DESTDIR)$(mandir)/man8"
@@ -721,15 +729,15 @@ fsdev/virtfs-proxy-helper.1: fsdev/virtfs-proxy-helper.texi
 qemu-nbd.8: qemu-nbd.texi qemu-option-trace.texi
 qemu-ga.8: qemu-ga.texi
 
-html: qemu-doc.html docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html
-info: qemu-doc.info docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info
-pdf: qemu-doc.pdf docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf
-txt: qemu-doc.txt docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt
+html: qemu-doc.html docs/interop/qemu-qmp-ref.html docs/interop/qemu-ga-ref.html docs/qemu-block-drivers.html
+info: qemu-doc.info docs/interop/qemu-qmp-ref.info docs/interop/qemu-ga-ref.info docs/qemu-block-drivers.info
+pdf: qemu-doc.pdf docs/interop/qemu-qmp-ref.pdf docs/interop/qemu-ga-ref.pdf docs/qemu-block-drivers.pdf
+txt: qemu-doc.txt docs/interop/qemu-qmp-ref.txt docs/interop/qemu-ga-ref.txt docs/qemu-block-drivers.txt
 
 qemu-doc.html qemu-doc.info qemu-doc.pdf qemu-doc.txt: \
 	qemu-img.texi qemu-nbd.texi qemu-options.texi qemu-option-trace.texi \
 	qemu-monitor.texi qemu-img-cmds.texi qemu-ga.texi \
-	qemu-monitor-info.texi
+	qemu-monitor-info.texi docs/qemu-block-drivers.texi
 
 docs/interop/qemu-ga-ref.dvi docs/interop/qemu-ga-ref.html \
     docs/interop/qemu-ga-ref.info docs/interop/qemu-ga-ref.pdf \
@@ -741,6 +749,11 @@ docs/interop/qemu-qmp-ref.dvi docs/interop/qemu-qmp-ref.html \
     docs/interop/qemu-qmp-ref.txt docs/interop/qemu-qmp-ref.7: \
 	docs/interop/qemu-qmp-ref.texi docs/interop/qemu-qmp-qapi.texi
 
+docs/qemu-block-drivers.dvi docs/qemu-block-drivers.html \
+    docs/qemu-block-drivers.info docs/qemu-block-drivers.pdf \
+    docs/qemu-block-drivers.txt docs/qemu-block-drivers.7: \
+	docs/qemu-block-drivers.texi
+
 
 ifdef CONFIG_WIN32
 
docs/qemu-block-drivers.texi new file +799 -0

799 lines not on this page · raw message

qemu-doc.texi +1 -779

786 lines not on this page · raw message

Signature · 1 line
2.13.3
author
#15 lore raw

[Qemu-devel] [PULL 14/15] qemu-iotests/059: Fix leaked image files

In reply to Kevin Wolf

qemu-iotests 059 left a whole lot of image files behind in the scratch directory because VMDK creates additional files for extents and cleaning them up requires the original image intact (it parses qemu-img info output to find all extent files), but the image overwrote it many times like it works for all other image formats.

In addition, _use_sample_img overwrites the TEST_IMG variable, causing new images created afterwards to reuse the name of the sample file rather than the usual t.IMGFMT.

This patch adds an intermediate _cleanup_test_img after each subtest that created an image file with additional extent files, and also after each use of a sample image. _cleanup_test_img is also changed so that it resets TEST_IMG after a sample image is cleaned up.

Note that this test was failing before this commit and continues to do so after it. This failure was introduced in commit 9877860 ('block/vmdk:
Report failures in vmdk_read_cid()') and needs to be dealt with separately.

---
 tests/qemu-iotests/059       | 11 ++++++++++-
 tests/qemu-iotests/059.out   | 22 +++++++++++-----------
 tests/qemu-iotests/common.rc |  3 +++
 3 files changed, 24 insertions(+), 12 deletions(-)
tests/qemu-iotests/059 +10 -1
index 6655aaf384..a1c34eeb7c 100755
@@ -29,7 +29,8 @@ status=1	# failure is the default!
 
 _cleanup()
 {
-	_cleanup_test_img
+    _cleanup_test_img
+    rm -f "$TEST_IMG.qcow2"
 }
 trap "_cleanup; exit \$status" 0 1 2 3 15
 
@@ -72,15 +73,18 @@ echo
 echo "=== Testing monolithicFlat creation and opening ==="
 IMGOPTS="subformat=monolithicFlat" _make_test_img 2G
 _img_info
+_cleanup_test_img
 
 echo
 echo "=== Testing monolithicFlat with zeroed_grain ==="
 IMGOPTS="subformat=monolithicFlat,zeroed_grain=on" _make_test_img 2G
+_cleanup_test_img
 
 echo
 echo "=== Testing big twoGbMaxExtentFlat ==="
 IMGOPTS="subformat=twoGbMaxExtentFlat" _make_test_img 1000G
 $QEMU_IMG info $TEST_IMG | _filter_testdir | sed -e 's/cid: [0-9]*/cid: XXXXXXXX/'
+_cleanup_test_img
 
 echo
 echo "=== Testing malformed VMFS extent description line ==="
@@ -114,6 +118,7 @@ echo "=== Testing monolithicFlat with internally generated JSON file name ==="
 IMGOPTS="subformat=monolithicFlat" _make_test_img 64M
 $QEMU_IO -c "open -o driver=$IMGFMT,file.driver=blkdebug,file.image.filename=$TEST_IMG,file.inject-error.0.event=read_aio" 2>&1 \
     | _filter_testdir | _filter_imgfmt
+_cleanup_test_img
 
 echo
 echo "=== Testing version 3 ==="
@@ -123,6 +128,7 @@ for i in {0..99}; do
     $QEMU_IO -r -c "read -P $(( i % 10 + 0x30 )) $(( i * 64 * 1024 * 10 + i * 512 )) 512" $TEST_IMG \
         | _filter_qemu_io
 done
+_cleanup_test_img
 
 echo
 echo "=== Testing 4TB monolithicFlat creation and IO ==="
@@ -130,6 +136,7 @@ IMGOPTS="subformat=monolithicFlat" _make_test_img 4T
 _img_info
 $QEMU_IO -c "write -P 0xa 900G 512" "$TEST_IMG" | _filter_qemu_io
 $QEMU_IO -c "read -v 900G 1024" "$TEST_IMG" | _filter_qemu_io
+_cleanup_test_img
 
 echo
 echo "=== Testing qemu-img map on extents ==="
@@ -139,12 +146,14 @@ for fmt in monolithicSparse twoGbMaxExtentSparse; do
     $QEMU_IO -c "write 2147483136 1k" "$TEST_IMG" | _filter_qemu_io
     $QEMU_IO -c "write 5G 1k" "$TEST_IMG" | _filter_qemu_io
     $QEMU_IMG map "$TEST_IMG" | _filter_testdir
+    _cleanup_test_img
 done
 
 echo
 echo "=== Testing afl image with a very large capacity ==="
 _use_sample_img afl9.vmdk.bz2
 _img_info
+_cleanup_test_img
 
 # success, all done
 echo "*** done"
tests/qemu-iotests/059.out +11 -11
index 6154509bc3..f6dce7947c 100644
@@ -2259,8 +2259,8 @@ read 512/512 bytes at offset 64931328
 512 bytes, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
 === Testing 4TB monolithicFlat creation and IO ===
-Formatting 'TEST_DIR/iotest-version3.IMGFMT', fmt=IMGFMT size=4398046511104 subformat=monolithicFlat
-image: TEST_DIR/iotest-version3.IMGFMT
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=4398046511104 subformat=monolithicFlat
+image: TEST_DIR/t.IMGFMT
 file format: IMGFMT
 virtual size: 4.0T (4398046511104 bytes)
 wrote 512/512 bytes at offset 966367641600
@@ -2333,7 +2333,7 @@ read 1024/1024 bytes at offset 966367641600
 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 
 === Testing qemu-img map on extents ===
-Formatting 'TEST_DIR/iotest-version3.IMGFMT', fmt=IMGFMT size=33285996544 subformat=monolithicSparse
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=33285996544 subformat=monolithicSparse
 wrote 1024/1024 bytes at offset 65024
 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 1024/1024 bytes at offset 2147483136
@@ -2341,10 +2341,10 @@ wrote 1024/1024 bytes at offset 2147483136
 wrote 1024/1024 bytes at offset 5368709120
 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 Offset          Length          Mapped to       File
-0               0x20000         0x3f0000        TEST_DIR/iotest-version3.vmdk
-0x7fff0000      0x20000         0x410000        TEST_DIR/iotest-version3.vmdk
-0x140000000     0x10000         0x430000        TEST_DIR/iotest-version3.vmdk
-Formatting 'TEST_DIR/iotest-version3.IMGFMT', fmt=IMGFMT size=33285996544 subformat=twoGbMaxExtentSparse
+0               0x20000         0x3f0000        TEST_DIR/t.vmdk
+0x7fff0000      0x20000         0x410000        TEST_DIR/t.vmdk
+0x140000000     0x10000         0x430000        TEST_DIR/t.vmdk
+Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=33285996544 subformat=twoGbMaxExtentSparse
 wrote 1024/1024 bytes at offset 65024
 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 wrote 1024/1024 bytes at offset 2147483136
@@ -2352,10 +2352,10 @@ wrote 1024/1024 bytes at offset 2147483136
 wrote 1024/1024 bytes at offset 5368709120
 1 KiB, X ops; XX:XX:XX.X (XXX YYY/sec and XXX ops/sec)
 Offset          Length          Mapped to       File
-0               0x20000         0x50000         TEST_DIR/iotest-version3-s001.vmdk
-0x7fff0000      0x10000         0x70000         TEST_DIR/iotest-version3-s001.vmdk
-0x80000000      0x10000         0x50000         TEST_DIR/iotest-version3-s002.vmdk
-0x140000000     0x10000         0x50000         TEST_DIR/iotest-version3-s003.vmdk
+0               0x20000         0x50000         TEST_DIR/t-s001.vmdk
+0x7fff0000      0x10000         0x70000         TEST_DIR/t-s001.vmdk
+0x80000000      0x10000         0x50000         TEST_DIR/t-s002.vmdk
+0x140000000     0x10000         0x50000         TEST_DIR/t-s003.vmdk
 
 === Testing afl image with a very large capacity ===
 qemu-img: Can't get image size 'TEST_DIR/afl9.IMGFMT': File too large
tests/qemu-iotests/common.rc +3 -0
index 2548e58b99..bfbc80e5f6 100644
@@ -92,6 +92,7 @@ else
         TEST_IMG=$IMGPROTO:$TEST_DIR/t.$IMGFMT
     fi
 fi
+ORIG_TEST_IMG="$TEST_IMG"
 
 _optstr_add()
 {
@@ -228,6 +229,8 @@ _cleanup_test_img()
             if [ -n "$SAMPLE_IMG_FILE" ]
             then
                 rm -f "$TEST_DIR/$SAMPLE_IMG_FILE"
+                SAMPLE_IMG_FILE=
+                TEST_IMG="$ORIG_TEST_IMG"
             fi
             ;;
 
Signature · 1 line
2.13.3
#16 lore raw
In reply to Kevin Wolf
Quoted 8 lines · Kevin Wolf

The following changes since commit 5619c179057e24195ff19c8fe6d6a6cbcb16ed28:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20170731' into staging (2017-07-31 14:45:42 +0100)

are available in the git repository at:

git://repo.or.cz/qemu/kevin.git tags/for-upstream

Quoted 8 lines

for you to fetch changes up to 9ae03670701fea9124f4f1a6d4b6d1badbf9e485:

block/qapi: Remove redundant NULL check to silence Coverity (2017-08-01 15:26:04 +0200)

----------------------------------------------------------------
Block layer patches for 2.10.0-rc1

----------------------------------------------------------------

Hi; I'm afraid the docs changes in this pull upset some of my test machines:

NetBSD, OpenBSD, OSX:

GEN docs/qemu-block-drivers.html
/root/qemu/docs/qemu-block-drivers.texi:800: Unmatched `@end'.
makeinfo: Removing output file `docs/qemu-block-drivers.html' due to errors; use --force to preserve.
Makefile:692: recipe for target 'docs/qemu-block-drivers.html' failed

(and same error again trying to build the .txt file)

S390x, PPC64 Linux give a warning:
GEN docs/qemu-block-drivers.html
/home/linux1/qemu/docs/qemu-block-drivers.texi: warning: must specify a title with a title command or @top

(Other hosts still running the build job.)

thanks
-- PMM

author
#17 lore raw

Am 01.08.2017 um 18:01 hat Peter Maydell geschrieben:

Quoted 29 lines · Kevin Wolf
Quoted 8 lines

The following changes since commit 5619c179057e24195ff19c8fe6d6a6cbcb16ed28:

Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20170731' into staging (2017-07-31 14:45:42 +0100)

are available in the git repository at:

git://repo.or.cz/qemu/kevin.git tags/for-upstream

Quoted 8 lines

for you to fetch changes up to 9ae03670701fea9124f4f1a6d4b6d1badbf9e485:

block/qapi: Remove redundant NULL check to silence Coverity (2017-08-01 15:26:04 +0200)

----------------------------------------------------------------
Block layer patches for 2.10.0-rc1

----------------------------------------------------------------

Hi; I'm afraid the docs changes in this pull upset some of my test machines:

NetBSD, OpenBSD, OSX:

GEN docs/qemu-block-drivers.html
/root/qemu/docs/qemu-block-drivers.texi:800: Unmatched `@end'.
makeinfo: Removing output file `docs/qemu-block-drivers.html' due to errors; use --force to preserve.
Makefile:692: recipe for target 'docs/qemu-block-drivers.html' failed

Quoted 8 lines

(and same error again trying to build the .txt file)

S390x, PPC64 Linux give a warning:
GEN docs/qemu-block-drivers.html
/home/linux1/qemu/docs/qemu-block-drivers.texi: warning: must specify a title with a title command or @top

(Other hosts still running the build job.)

I'm dropping the patch and sending v2.

Kevin