Commit 3b64f272 authored by Peter Maydell's avatar Peter Maydell
Browse files

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



Block layer patches for 2.10.0-rc1

# gpg: Signature made Tue 01 Aug 2017 17:10:52 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/qapi: Remove redundant NULL check to silence Coverity
  qemu-iotests/059: Fix leaked image files
  qemu-iotests/063: Fix leaked image
  qemu-iotests/162: Fix leaked temporary files
  qemu-iotests/153: Fix leaked scratch images
  qemu-iotests/141: Fix image cleanup
  qemu-iotests: Remove blkdebug.conf after tests
  qemu-iotests/041: Fix leaked scratch images
  block: fix leaks in bdrv_open_driver()
  block: fix dangling bs->explicit_options in block.c
  iotests: Add test of recent fix to 'qemu-img measure'
  iotests: Check dirty bitmap statistics in 124
  iotests: Redirect stderr to stdout in 186
  iotests: Fix test 156

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 7d48cf81 8e8eb0a9
Loading
Loading
Loading
Loading
+13 −11
Original line number Diff line number Diff line
@@ -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,14 +2603,12 @@ 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);
    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;
    }
+2 −1
Original line number Diff line number Diff line
@@ -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);
        }
    }

+3 −1
Original line number Diff line number Diff line
@@ -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)
+10 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ status=1 # failure is the default!
_cleanup()
{
    _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"
+11 −11
Original line number Diff line number Diff line
@@ -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
Loading