Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/818220/?format=api
{ "id": 818220, "url": "http://patchwork.ozlabs.org/api/patches/818220/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170925122808.14561-3-kwolf@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20170925122808.14561-3-kwolf@redhat.com>", "list_archive_url": null, "date": "2017-09-25T12:28:05", "name": "[2/5] commit: Support multiple roots above top node", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "87f07cdb0ed339a392c769f0b0f33e100729dcbd", "submitter": { "id": 2714, "url": "http://patchwork.ozlabs.org/api/people/2714/?format=api", "name": "Kevin Wolf", "email": "kwolf@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170925122808.14561-3-kwolf@redhat.com/mbox/", "series": [ { "id": 4949, "url": "http://patchwork.ozlabs.org/api/series/4949/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=4949", "date": "2017-09-25T12:28:05", "name": "commit: Support multiple roots above top node", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/4949/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/818220/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/818220/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org", "Authentication-Results": [ "ozlabs.org;\n\tspf=pass (mailfrom) smtp.mailfrom=nongnu.org\n\t(client-ip=2001:4830:134:3::11; helo=lists.gnu.org;\n\tenvelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n\treceiver=<UNKNOWN>)", "ext-mx08.extmail.prod.ext.phx2.redhat.com;\n\tdmarc=none (p=none dis=none) header.from=redhat.com", "ext-mx08.extmail.prod.ext.phx2.redhat.com;\n\tspf=fail smtp.mailfrom=kwolf@redhat.com" ], "Received": [ "from lists.gnu.org (lists.gnu.org [IPv6:2001:4830:134:3::11])\n\t(using TLSv1 with cipher AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 3y13Kx2QmVz9t62\n\tfor <incoming@patchwork.ozlabs.org>;\n\tMon, 25 Sep 2017 22:29:08 +1000 (AEST)", "from localhost ([::1]:42256 helo=lists.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.71) (envelope-from\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>)\n\tid 1dwSVV-0003XH-S2\n\tfor incoming@patchwork.ozlabs.org; Mon, 25 Sep 2017 08:29:05 -0400", "from eggs.gnu.org ([2001:4830:134:3::10]:47221)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <kwolf@redhat.com>) id 1dwSUn-0003VJ-OH\n\tfor qemu-devel@nongnu.org; Mon, 25 Sep 2017 08:28:22 -0400", "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <kwolf@redhat.com>) id 1dwSUm-00065G-L5\n\tfor qemu-devel@nongnu.org; Mon, 25 Sep 2017 08:28:21 -0400", "from mx1.redhat.com ([209.132.183.28]:45286)\n\tby eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32)\n\t(Exim 4.71) (envelope-from <kwolf@redhat.com>)\n\tid 1dwSUi-00062f-6w; Mon, 25 Sep 2017 08:28:16 -0400", "from smtp.corp.redhat.com\n\t(int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12])\n\t(using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits))\n\t(No client certificate requested)\n\tby mx1.redhat.com (Postfix) with ESMTPS id 4CF4CC0587DE;\n\tMon, 25 Sep 2017 12:28:15 +0000 (UTC)", "from localhost.localdomain.com (ovpn-116-119.ams2.redhat.com\n\t[10.36.116.119])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 1370F70A10;\n\tMon, 25 Sep 2017 12:28:13 +0000 (UTC)" ], "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com 4CF4CC0587DE", "From": "Kevin Wolf <kwolf@redhat.com>", "To": "qemu-block@nongnu.org", "Date": "Mon, 25 Sep 2017 14:28:05 +0200", "Message-Id": "<20170925122808.14561-3-kwolf@redhat.com>", "In-Reply-To": "<20170925122808.14561-1-kwolf@redhat.com>", "References": "<20170925122808.14561-1-kwolf@redhat.com>", "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.12", "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.32]);\n\tMon, 25 Sep 2017 12:28:15 +0000 (UTC)", "X-detected-operating-system": "by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic]\n\t[fuzzy]", "X-Received-From": "209.132.183.28", "Subject": "[Qemu-devel] [PATCH 2/5] commit: Support multiple roots above top\n\tnode", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.21", "Precedence": "list", "List-Id": "<qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<http://lists.nongnu.org/archive/html/qemu-devel/>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n\t<mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Cc": "kwolf@redhat.com, qemu-devel@nongnu.org, mreitz@redhat.com", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "\"Qemu-devel\"\n\t<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>" }, "content": "This changes the commit block job to support operation in a graph where\nthere is more than a single active layer that references the top node.\n\nThis involves inserting the commit filter node not only on the path\nbetween the given active node and the top node, but between the top node\nand all of its parents.\n\nOn completion, bdrv_drop_intermediate() must consider all parents for\nupdating the backing file link. These parents may be backing files\nthemselves and such read-only; reopen them temporarily if necessary.\nPreviously this was achieved by the bdrv_reopen() calls in the commit\nblock job that made overlay_bs read-write for the whole duration of the\nblock job, even though write access is only needed on completion.\n\nNow that we consider all parents, overlay_bs is meaningless. It is left\nin place in this commit, but we'll remove it soon.\n\nSigned-off-by: Kevin Wolf <kwolf@redhat.com>\n---\n block.c | 68 ++++++++++++++++++++++++++++++++++------------------------\n block/commit.c | 2 +-\n 2 files changed, 41 insertions(+), 29 deletions(-)", "diff": "diff --git a/block.c b/block.c\nindex 7ac8cd521b..e57fab501d 100644\n--- a/block.c\n+++ b/block.c\n@@ -985,14 +985,26 @@ static int bdrv_backing_update_filename(BdrvChild *c, BlockDriverState *base,\n const char *filename, Error **errp)\n {\n BlockDriverState *parent = c->opaque;\n+ int orig_flags = bdrv_get_flags(parent);\n int ret;\n \n+ if (!(orig_flags & BDRV_O_RDWR)) {\n+ ret = bdrv_reopen(parent, orig_flags | BDRV_O_RDWR, errp);\n+ if (ret < 0) {\n+ return ret;\n+ }\n+ }\n+\n ret = bdrv_change_backing_file(parent, filename,\n base->drv ? base->drv->format_name : \"\");\n if (ret < 0) {\n error_setg_errno(errp, ret, \"Could not update backing file link\");\n }\n \n+ if (!(orig_flags & BDRV_O_RDWR)) {\n+ bdrv_reopen(parent, orig_flags, NULL);\n+ }\n+\n return ret;\n }\n \n@@ -3482,7 +3494,7 @@ BlockDriverState *bdrv_find_base(BlockDriverState *bs)\n int bdrv_drop_intermediate(BlockDriverState *active, BlockDriverState *top,\n BlockDriverState *base, const char *backing_file_str)\n {\n- BlockDriverState *new_top_bs = NULL;\n+ BdrvChild *c, *next;\n Error *local_err = NULL;\n int ret = -EIO;\n \n@@ -3492,42 +3504,42 @@ int bdrv_drop_intermediate(BlockDriverState *active, BlockDriverState *top,\n goto exit;\n }\n \n- new_top_bs = bdrv_find_overlay(active, top);\n-\n- if (new_top_bs == NULL) {\n- /* we could not find the image above 'top', this is an error */\n- goto exit;\n- }\n-\n- /* special case of new_top_bs->backing->bs already pointing to base - nothing\n- * to do, no intermediate images */\n- if (backing_bs(new_top_bs) == base) {\n- ret = 0;\n- goto exit;\n- }\n-\n /* Make sure that base is in the backing chain of top */\n if (!bdrv_chain_contains(top, base)) {\n goto exit;\n }\n \n /* success - we can delete the intermediate states, and link top->base */\n- if (new_top_bs->backing->role->update_filename) {\n- backing_file_str = backing_file_str ? backing_file_str : base->filename;\n- ret = new_top_bs->backing->role->update_filename(new_top_bs->backing,\n- base, backing_file_str,\n- &local_err);\n- if (ret < 0) {\n- bdrv_set_backing_hd(new_top_bs, top, &error_abort);\n+ backing_file_str = backing_file_str ? backing_file_str : base->filename;\n+\n+ QLIST_FOREACH_SAFE(c, &top->parents, next_parent, next) {\n+ /* Check whether we are allowed to switch c from top to base */\n+ GSList *ignore_children = g_slist_prepend(NULL, c);\n+ bdrv_check_update_perm(base, NULL, c->perm, c->shared_perm,\n+ ignore_children, &local_err);\n+ if (local_err) {\n+ ret = -EPERM;\n+ error_report_err(local_err);\n goto exit;\n }\n- }\n+ g_slist_free(ignore_children);\n \n- bdrv_set_backing_hd(new_top_bs, base, &local_err);\n- if (local_err) {\n- ret = -EPERM;\n- error_report_err(local_err);\n- goto exit;\n+ /* If so, update the backing file path in the image file */\n+ if (c->role->update_filename) {\n+ ret = c->role->update_filename(c, base, backing_file_str,\n+ &local_err);\n+ if (ret < 0) {\n+ bdrv_abort_perm_update(base);\n+ error_report_err(local_err);\n+ goto exit;\n+ }\n+ }\n+\n+ /* Do the actual switch in the in-memory graph.\n+ * Completes bdrv_check_update_perm() transaction internally. */\n+ bdrv_ref(base);\n+ bdrv_replace_child(c, base);\n+ bdrv_unref(top);\n }\n \n ret = 0;\ndiff --git a/block/commit.c b/block/commit.c\nindex 8f0e83578a..610e1cd8f5 100644\n--- a/block/commit.c\n+++ b/block/commit.c\n@@ -350,7 +350,7 @@ void commit_start(const char *job_id, BlockDriverState *bs,\n error_propagate(errp, local_err);\n goto fail;\n }\n- bdrv_set_backing_hd(overlay_bs, commit_top_bs, &local_err);\n+ bdrv_replace_node(top, commit_top_bs, &local_err);\n if (local_err) {\n bdrv_unref(commit_top_bs);\n commit_top_bs = NULL;\n", "prefixes": [ "2/5" ] }