Commit 4fd0295c authored by Kevin Wolf's avatar Kevin Wolf
Browse files

Merge remote-tracking branch 'mreitz/tags/pull-block-2017-11-21' into queue-block



Block patches for 2.11.0-rc2

# gpg: Signature made Tue Nov 21 14:54:28 2017 CET
# gpg:                using RSA key F407DB0061D5CF40
# gpg: Good signature from "Max Reitz <mreitz@redhat.com>"
# Primary key fingerprint: 91BE B60A 30DB 3E88 57D1  1829 F407 DB00 61D5 CF40

* mreitz/tags/pull-block-2017-11-21:
  iotests: Fix 176 on 32-bit host
  block: Close a BlockDriverState completely even when bs->drv is NULL

Signed-off-by: default avatarKevin Wolf <kwolf@redhat.com>
parents 70a5afed 2807746f
Loading
Loading
Loading
Loading
+28 −29
Original line number Diff line number Diff line
@@ -3198,6 +3198,7 @@ void bdrv_reopen_abort(BDRVReopenState *reopen_state)
static void bdrv_close(BlockDriverState *bs)
{
    BdrvAioNotifier *ban, *ban_next;
    BdrvChild *child, *next;

    assert(!bs->job);
    assert(!bs->refcnt);
@@ -3207,10 +3208,9 @@ static void bdrv_close(BlockDriverState *bs)
    bdrv_drain(bs); /* in case flush left pending I/O */

    if (bs->drv) {
        BdrvChild *child, *next;

        bs->drv->bdrv_close(bs);
        bs->drv = NULL;
    }

    bdrv_set_backing_hd(bs, NULL, &error_abort);

@@ -3242,7 +3242,6 @@ static void bdrv_close(BlockDriverState *bs)
    bs->explicit_options = NULL;
    QDECREF(bs->full_open_options);
    bs->full_open_options = NULL;
    }

    bdrv_release_named_dirty_bitmaps(bs);
    assert(QLIST_EMPTY(&bs->dirty_bitmaps));
+13 −0
Original line number Diff line number Diff line
@@ -426,6 +426,19 @@ echo '--- Repairing ---'
_check_test_img -q -r all
_check_test_img -r all

echo
echo "=== Testing the QEMU shutdown with a corrupted image ==="
echo
_make_test_img 64M
poke_file "$TEST_IMG" "$rt_offset"        "\x00\x00\x00\x00\x00\x00\x00\x00"
echo "{'execute': 'qmp_capabilities'}
      {'execute': 'human-monitor-command',
       'arguments': {'command-line': 'qemu-io drive \"write 0 512\"'}}
      {'execute': 'quit'}" \
    | $QEMU -qmp stdio -nographic -nodefaults \
            -drive if=none,node-name=drive,file="$TEST_IMG",driver=qcow2 \
    | _filter_qmp | _filter_qemu_io

# success, all done
echo "*** done"
rm -f $seq.full
+12 −0
Original line number Diff line number Diff line
@@ -399,4 +399,16 @@ The following inconsistencies were found and repaired:

Double checking the fixed image now...
No errors were found on the image.

=== Testing the QEMU shutdown with a corrupted image ===

Formatting 'TEST_DIR/t.IMGFMT', fmt=IMGFMT size=67108864
qcow2: Marking image as corrupt: Preventing invalid write on metadata (overlaps with refcount table); further corruption events will be suppressed
QMP_VERSION
{"return": {}}
{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "BLOCK_IMAGE_CORRUPTED", "data": {"device": "none0", "msg": "Preventing invalid write on metadata (overlaps with refcount table)", "offset": 65536, "node-name": "drive", "fatal": true, "size": 65536}}
write failed: Input/output error
{"return": ""}
{"return": {}}
{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
*** done
+2 −1
Original line number Diff line number Diff line
@@ -52,7 +52,8 @@ _supported_os Linux
function run_qemu()
{
    $QEMU -nographic -qmp stdio -serial none "$@" 2>&1 \
	| _filter_testdir | _filter_qmp | _filter_qemu
	| _filter_testdir | _filter_qmp | _filter_qemu \
        | sed 's/"sha256": ".\{64\}"/"sha256": HASH/'
}

for reason in snapshot bitmap; do
+4 −4
Original line number Diff line number Diff line
@@ -205,7 +205,7 @@ Offset Length File
QMP_VERSION
{"return": {}}
{"return": {}}
{"return": {"sha256": "e12600978d86b5a453861ae5c17d275204673fef3874b7c3c5433c6153d84706"}}
{"return": {"sha256": HASH}}
{"return": {}}
{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}

@@ -255,7 +255,7 @@ Offset Length File
QMP_VERSION
{"return": {}}
{"return": {}}
{"return": {"sha256": "e12600978d86b5a453861ae5c17d275204673fef3874b7c3c5433c6153d84706"}}
{"return": {"sha256": HASH}}
{"return": {}}
{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}

@@ -305,7 +305,7 @@ Offset Length File
QMP_VERSION
{"return": {}}
{"return": {}}
{"return": {"sha256": "e12600978d86b5a453861ae5c17d275204673fef3874b7c3c5433c6153d84706"}}
{"return": {"sha256": HASH}}
{"return": {}}
{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}

@@ -352,7 +352,7 @@ Offset Length File
QMP_VERSION
{"return": {}}
{"return": {}}
{"return": {"sha256": "e12600978d86b5a453861ae5c17d275204673fef3874b7c3c5433c6153d84706"}}
{"return": {"sha256": HASH}}
{"return": {}}
{"timestamp": {"seconds":  TIMESTAMP, "microseconds":  TIMESTAMP}, "event": "SHUTDOWN", "data": {"guest": false}}
*** done