Commit 277ba8a6 authored by Anthony Liguori's avatar Anthony Liguori
Browse files

Merge remote-tracking branch 'kwolf/for-anthony' into staging

# By Stefan Hajnoczi (2) and others
# Via Kevin Wolf
* kwolf/for-anthony:
  virtio-blk: Do not segfault fault if failed to initialize dataplane
  qemu-iotests: add 052 BDRV_O_SNAPSHOT test
  block: fix BDRV_O_SNAPSHOT protocol detection
  qcow2: Fix segfault in qcow2_invalidate_cache
  sheepdog: show error message for halt status
parents 2c8a5942 a8e5cc0c
Loading
Loading
Loading
Loading
+1 −5
Original line number Diff line number Diff line
@@ -830,7 +830,6 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options,
    if (flags & BDRV_O_SNAPSHOT) {
        BlockDriverState *bs1;
        int64_t total_size;
        int is_protocol = 0;
        BlockDriver *bdrv_qcow2;
        QEMUOptionParameter *options;
        char backing_filename[PATH_MAX];
@@ -847,9 +846,6 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options,
        }
        total_size = bdrv_getlength(bs1) & BDRV_SECTOR_MASK;

        if (bs1->drv && bs1->drv->protocol_name)
            is_protocol = 1;

        bdrv_delete(bs1);

        ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename));
@@ -858,7 +854,7 @@ int bdrv_open(BlockDriverState *bs, const char *filename, QDict *options,
        }

        /* Real path is meaningless for protocols */
        if (is_protocol) {
        if (path_has_protocol(filename)) {
            snprintf(backing_filename, sizeof(backing_filename),
                     "%s", filename);
        } else if (!realpath(filename, backing_filename)) {
+10 −2
Original line number Diff line number Diff line
@@ -29,6 +29,7 @@
#include "block/qcow2.h"
#include "qemu/error-report.h"
#include "qapi/qmp/qerror.h"
#include "qapi/qmp/qbool.h"
#include "trace.h"

/*
@@ -520,7 +521,7 @@ static int qcow2_open(BlockDriverState *bs, QDict *options, int flags)
        goto fail;
    }

    s->use_lazy_refcounts = qemu_opt_get_bool(opts, "lazy_refcounts",
    s->use_lazy_refcounts = qemu_opt_get_bool(opts, QCOW2_OPT_LAZY_REFCOUNTS,
        (s->compatible_features & QCOW2_COMPAT_LAZY_REFCOUNTS));

    qemu_opts_del(opts);
@@ -930,6 +931,7 @@ static void qcow2_invalidate_cache(BlockDriverState *bs)
    AES_KEY aes_encrypt_key;
    AES_KEY aes_decrypt_key;
    uint32_t crypt_method = 0;
    QDict *options;

    /*
     * Backing files are read-only which makes all of their metadata immutable,
@@ -944,8 +946,14 @@ static void qcow2_invalidate_cache(BlockDriverState *bs)

    qcow2_close(bs);

    options = qdict_new();
    qdict_put(options, QCOW2_OPT_LAZY_REFCOUNTS,
              qbool_from_int(s->use_lazy_refcounts));

    memset(s, 0, sizeof(BDRVQcowState));
    qcow2_open(bs, NULL, flags);
    qcow2_open(bs, options, flags);

    QDECREF(options);

    if (crypt_method) {
        s->crypt_method = crypt_method;
+3 −0
Original line number Diff line number Diff line
@@ -58,6 +58,9 @@

#define DEFAULT_CLUSTER_SIZE 65536


#define QCOW2_OPT_LAZY_REFCOUNTS "lazy_refcounts"

typedef struct QCowHeader {
    uint32_t magic;
    uint32_t version;
+2 −0
Original line number Diff line number Diff line
@@ -65,6 +65,7 @@
#define SD_RES_WAIT_FOR_FORMAT  0x16 /* Waiting for a format operation */
#define SD_RES_WAIT_FOR_JOIN    0x17 /* Waiting for other nodes joining */
#define SD_RES_JOIN_FAILED   0x18 /* Target node had failed to join sheepdog */
#define SD_RES_HALT          0x19 /* Sheepdog is stopped serving IO request */

/*
 * Object ID rules
@@ -344,6 +345,7 @@ static const char * sd_strerror(int err)
        {SD_RES_WAIT_FOR_FORMAT, "Sheepdog is waiting for a format operation"},
        {SD_RES_WAIT_FOR_JOIN, "Sheepdog is waiting for other nodes joining"},
        {SD_RES_JOIN_FAILED, "Target node had failed to join sheepdog"},
        {SD_RES_HALT, "Sheepdog is stopped serving IO request"},
    };

    for (i = 0; i < ARRAY_SIZE(errors); ++i) {
+1 −1
Original line number Diff line number Diff line
@@ -663,7 +663,7 @@ static int virtio_blk_device_init(VirtIODevice *vdev)
    s->vq = virtio_add_queue(vdev, 128, virtio_blk_handle_output);
#ifdef CONFIG_VIRTIO_BLK_DATA_PLANE
    if (!virtio_blk_data_plane_create(vdev, blk, &s->dataplane)) {
        virtio_cleanup(vdev);
        virtio_common_cleanup(vdev);
        return -1;
    }
#endif
Loading