Commit a41b2c99 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/stefanha/tags/block-pull-request' into staging



Block pull request

# gpg: Signature made Fri 25 Apr 2014 17:05:13 BST using RSA key ID 81AB73C8
# gpg: Good signature from "Stefan Hajnoczi <stefanha@redhat.com>"
# gpg:                 aka "Stefan Hajnoczi <stefanha@gmail.com>"

* remotes/stefanha/tags/block-pull-request:
  iscsi: Don't use error_is_set() to suppress additional errors
  blockdev: Clean up fragile use of error_is_set()
  nbd: Use return values instead of error_is_set(errp)
  qemu-img: Consistently name Error * objects err, and not errp
  Use error_is_set() only when necessary (again)
  block: Expose host_* drivers in blockdev-add
  MAINTAINERS: Add qemu-img/io to block subsystem
  qemu-iotests: Improve and make use of QMPTestCase.wait_until_completed()
  doc: add -drive rerror=,werror= to qemu --help output
  block: Prevent coroutine stack overflow when recursing in bdrv_open_backing_file.

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents d09a18d4 172fc4dd
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -674,6 +674,8 @@ S: Supported
F: block*
F: block/
F: hw/block/
F: qemu-img*
F: qemu-io*
T: git git://repo.or.cz/qemu/kevin.git block
T: git git://github.com/stefanha/qemu.git block

+19 −16
Original line number Diff line number Diff line
@@ -864,7 +864,7 @@ static int bdrv_open_common(BlockDriverState *bs, BlockDriverState *file,

    node_name = qdict_get_try_str(options, "node-name");
    bdrv_assign_node_name(bs, node_name, &local_err);
    if (error_is_set(&local_err)) {
    if (local_err) {
        error_propagate(errp, local_err);
        return -EINVAL;
    }
@@ -1068,14 +1068,14 @@ fail:
 */
int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
{
    char backing_filename[PATH_MAX];
    int back_flags, ret;
    char *backing_filename = g_malloc0(PATH_MAX);
    int back_flags, ret = 0;
    BlockDriver *back_drv = NULL;
    Error *local_err = NULL;

    if (bs->backing_hd != NULL) {
        QDECREF(options);
        return 0;
        goto free_exit;
    }

    /* NULL means an empty set of options */
@@ -1088,10 +1088,9 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
        backing_filename[0] = '\0';
    } else if (bs->backing_file[0] == '\0' && qdict_size(options) == 0) {
        QDECREF(options);
        return 0;
        goto free_exit;
    } else {
        bdrv_get_full_backing_filename(bs, backing_filename,
                                       sizeof(backing_filename));
        bdrv_get_full_backing_filename(bs, backing_filename, PATH_MAX);
    }

    if (bs->backing_format[0] != '\0') {
@@ -1112,7 +1111,7 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
        error_setg(errp, "Could not open backing file: %s",
                   error_get_pretty(local_err));
        error_free(local_err);
        return ret;
        goto free_exit;
    }

    if (bs->backing_hd->file) {
@@ -1123,7 +1122,9 @@ int bdrv_open_backing_file(BlockDriverState *bs, QDict *options, Error **errp)
    /* Recalculate the BlockLimits with the backing file */
    bdrv_refresh_limits(bs);

    return 0;
free_exit:
    g_free(backing_filename);
    return ret;
}

/*
@@ -1180,8 +1181,7 @@ done:
void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp)
{
    /* TODO: extra byte is a hack to ensure MAX_PATH space on Windows. */
    char tmp_filename[PATH_MAX + 1];

    char *tmp_filename = g_malloc0(PATH_MAX + 1);
    int64_t total_size;
    BlockDriver *bdrv_qcow2;
    QEMUOptionParameter *create_options;
@@ -1197,15 +1197,15 @@ void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp)
    total_size = bdrv_getlength(bs);
    if (total_size < 0) {
        error_setg_errno(errp, -total_size, "Could not get image size");
        return;
        goto out;
    }
    total_size &= BDRV_SECTOR_MASK;

    /* Create the temporary image */
    ret = get_tmp_filename(tmp_filename, sizeof(tmp_filename));
    ret = get_tmp_filename(tmp_filename, PATH_MAX + 1);
    if (ret < 0) {
        error_setg_errno(errp, -ret, "Could not get temporary filename");
        return;
        goto out;
    }

    bdrv_qcow2 = bdrv_find_format("qcow2");
@@ -1221,7 +1221,7 @@ void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp)
                         "'%s': %s", tmp_filename,
                         error_get_pretty(local_err));
        error_free(local_err);
        return;
        goto out;
    }

    /* Prepare a new options QDict for the temporary file */
@@ -1238,10 +1238,13 @@ void bdrv_append_temp_snapshot(BlockDriverState *bs, Error **errp)
                    bs->open_flags & ~BDRV_O_SNAPSHOT, bdrv_qcow2, &local_err);
    if (ret < 0) {
        error_propagate(errp, local_err);
        return;
        goto out;
    }

    bdrv_append(bs_snapshot, bs);

out:
    g_free(tmp_filename);
}

/*
+4 −5
Original line number Diff line number Diff line
@@ -1095,16 +1095,15 @@ static struct scsi_task *iscsi_do_inquiry(struct iscsi_context *iscsi, int lun,
    *inq = scsi_datain_unmarshall(task);
    if (*inq == NULL) {
        error_setg(errp, "iSCSI: failed to unmarshall inquiry datain blob");
        goto fail;
        goto fail_with_err;
    }

    return task;

fail:
    if (!error_is_set(errp)) {
    error_setg(errp, "iSCSI: Inquiry command failed : %s",
               iscsi_get_error(iscsi));
    }
fail_with_err:
    if (task != NULL) {
        scsi_free_scsi_task(task);
    }
+1 −1
Original line number Diff line number Diff line
@@ -680,7 +680,7 @@ void commit_active_start(BlockDriverState *bs, BlockDriverState *base,
    mirror_start_job(bs, base, speed, 0, 0,
                     on_error, on_error, cb, opaque, &local_err,
                     &commit_active_job_driver, false, base);
    if (error_is_set(&local_err)) {
    if (local_err) {
        error_propagate(errp, local_err);
        goto error_restore_flags;
    }
+1 −1
Original line number Diff line number Diff line
@@ -175,7 +175,7 @@ static void nbd_parse_filename(const char *filename, QDict *options,
        InetSocketAddress *addr = NULL;

        addr = inet_parse(host_spec, errp);
        if (error_is_set(errp)) {
        if (!addr) {
            goto out;
        }

Loading