get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/814197/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 814197,
    "url": "http://patchwork.ozlabs.org/api/patches/814197/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20170915101008.16646-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": "<20170915101008.16646-3-kwolf@redhat.com>",
    "list_archive_url": null,
    "date": "2017-09-15T10:10:04",
    "name": "[2/6] block: Add reopen_queue to bdrv_child_perm()",
    "commit_ref": null,
    "pull_url": null,
    "state": "new",
    "archived": false,
    "hash": "5019c9862eb03e8ea95630495f080a5ce6f838d5",
    "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/20170915101008.16646-3-kwolf@redhat.com/mbox/",
    "series": [
        {
            "id": 3264,
            "url": "http://patchwork.ozlabs.org/api/series/3264/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=3264",
            "date": "2017-09-15T10:10:02",
            "name": "block: Fix permissions after ro/rw reopen",
            "version": 1,
            "mbox": "http://patchwork.ozlabs.org/series/3264/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/814197/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/814197/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 3xtrp46YXlz9sxR\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri, 15 Sep 2017 20:13:32 +1000 (AEST)",
            "from localhost ([::1]:52349 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 1dsnco-0005Hw-Vb\n\tfor incoming@patchwork.ozlabs.org; Fri, 15 Sep 2017 06:13:31 -0400",
            "from eggs.gnu.org ([2001:4830:134:3::10]:37328)\n\tby lists.gnu.org with esmtp (Exim 4.71)\n\t(envelope-from <kwolf@redhat.com>) id 1dsnZw-0002Do-D2\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 06:10:35 -0400",
            "from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)\n\t(envelope-from <kwolf@redhat.com>) id 1dsnZs-0004NV-2l\n\tfor qemu-devel@nongnu.org; Fri, 15 Sep 2017 06:10:32 -0400",
            "from mx1.redhat.com ([209.132.183.28]:42840)\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 1dsnZj-0004DB-Qo; Fri, 15 Sep 2017 06:10:20 -0400",
            "from smtp.corp.redhat.com\n\t(int-mx06.intmail.prod.int.phx2.redhat.com [10.5.11.16])\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 D91D8C0587F5;\n\tFri, 15 Sep 2017 10:10:18 +0000 (UTC)",
            "from localhost.localdomain.com (ovpn-117-157.ams2.redhat.com\n\t[10.36.117.157])\n\tby smtp.corp.redhat.com (Postfix) with ESMTP id 0023466D5F;\n\tFri, 15 Sep 2017 10:10:16 +0000 (UTC)"
        ],
        "DMARC-Filter": "OpenDMARC Filter v1.3.2 mx1.redhat.com D91D8C0587F5",
        "From": "Kevin Wolf <kwolf@redhat.com>",
        "To": "qemu-block@nongnu.org",
        "Date": "Fri, 15 Sep 2017 12:10:04 +0200",
        "Message-Id": "<20170915101008.16646-3-kwolf@redhat.com>",
        "In-Reply-To": "<20170915101008.16646-1-kwolf@redhat.com>",
        "References": "<20170915101008.16646-1-kwolf@redhat.com>",
        "X-Scanned-By": "MIMEDefang 2.79 on 10.5.11.16",
        "X-Greylist": "Sender IP whitelisted, not delayed by milter-greylist-4.5.16\n\t(mx1.redhat.com [10.5.110.32]);\n\tFri, 15 Sep 2017 10:10:19 +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/6] block: Add reopen_queue to\n\tbdrv_child_perm()",
        "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, famz@redhat.com, qemu-devel@nongnu.org,\n\tmreitz@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": "In the context of bdrv_reopen(), we'll have to look at the state of the\ngraph as it will be after the reopen. This interface addition is in\npreparation for the change.\n\nSigned-off-by: Kevin Wolf <kwolf@redhat.com>\n---\n include/block/block_int.h |  7 +++++++\n block.c                   | 19 ++++++++++++-------\n block/commit.c            |  1 +\n block/mirror.c            |  1 +\n block/replication.c       |  1 +\n block/vvfat.c             |  1 +\n 6 files changed, 23 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/include/block/block_int.h b/include/block/block_int.h\nindex ba4c383393..99abe2ce74 100644\n--- a/include/block/block_int.h\n+++ b/include/block/block_int.h\n@@ -411,9 +411,14 @@ struct BlockDriver {\n      *\n      * If @c is NULL, return the permissions for attaching a new child for the\n      * given @role.\n+     *\n+     * If @reopen_queue is non-NULL, don't return the currently needed\n+     * permissions, but those that will be needed after applying the\n+     * @reopen_queue.\n      */\n      void (*bdrv_child_perm)(BlockDriverState *bs, BdrvChild *c,\n                              const BdrvChildRole *role,\n+                             BlockReopenQueue *reopen_queue,\n                              uint64_t parent_perm, uint64_t parent_shared,\n                              uint64_t *nperm, uint64_t *nshared);\n \n@@ -983,6 +988,7 @@ int bdrv_child_try_set_perm(BdrvChild *c, uint64_t perm, uint64_t shared,\n  * all children */\n void bdrv_filter_default_perms(BlockDriverState *bs, BdrvChild *c,\n                                const BdrvChildRole *role,\n+                               BlockReopenQueue *reopen_queue,\n                                uint64_t perm, uint64_t shared,\n                                uint64_t *nperm, uint64_t *nshared);\n \n@@ -992,6 +998,7 @@ void bdrv_filter_default_perms(BlockDriverState *bs, BdrvChild *c,\n  * CONSISTENT_READ and doesn't share WRITE. */\n void bdrv_format_default_perms(BlockDriverState *bs, BdrvChild *c,\n                                const BdrvChildRole *role,\n+                               BlockReopenQueue *reopen_queue,\n                                uint64_t perm, uint64_t shared,\n                                uint64_t *nperm, uint64_t *nshared);\n \ndiff --git a/block.c b/block.c\nindex 6dd47e414e..c7724c85e3 100644\n--- a/block.c\n+++ b/block.c\n@@ -1537,16 +1537,17 @@ static void bdrv_child_abort_perm_update(BdrvChild *c);\n static void bdrv_child_set_perm(BdrvChild *c, uint64_t perm, uint64_t shared);\n \n static void bdrv_child_perm(BlockDriverState *bs, BlockDriverState *child_bs,\n-                            BdrvChild *c,\n-                            const BdrvChildRole *role,\n+                            BdrvChild *c, const BdrvChildRole *role,\n+                            BlockReopenQueue *reopen_queue,\n                             uint64_t parent_perm, uint64_t parent_shared,\n                             uint64_t *nperm, uint64_t *nshared)\n {\n     if (bs->drv && bs->drv->bdrv_child_perm) {\n-        bs->drv->bdrv_child_perm(bs, c, role,\n+        bs->drv->bdrv_child_perm(bs, c, role, reopen_queue,\n                                  parent_perm, parent_shared,\n                                  nperm, nshared);\n     }\n+    /* TODO Take force_share from reopen_queue */\n     if (child_bs && child_bs->force_share) {\n         *nshared = BLK_PERM_ALL;\n     }\n@@ -1596,7 +1597,7 @@ static int bdrv_check_perm(BlockDriverState *bs, uint64_t cumulative_perms,\n     /* Check all children */\n     QLIST_FOREACH(c, &bs->children, next) {\n         uint64_t cur_perm, cur_shared;\n-        bdrv_child_perm(bs, c->bs, c, c->role,\n+        bdrv_child_perm(bs, c->bs, c, c->role, NULL,\n                         cumulative_perms, cumulative_shared_perms,\n                         &cur_perm, &cur_shared);\n         ret = bdrv_child_check_perm(c, cur_perm, cur_shared, ignore_children,\n@@ -1658,7 +1659,7 @@ static void bdrv_set_perm(BlockDriverState *bs, uint64_t cumulative_perms,\n     /* Update all children */\n     QLIST_FOREACH(c, &bs->children, next) {\n         uint64_t cur_perm, cur_shared;\n-        bdrv_child_perm(bs, c->bs, c, c->role,\n+        bdrv_child_perm(bs, c->bs, c, c->role, NULL,\n                         cumulative_perms, cumulative_shared_perms,\n                         &cur_perm, &cur_shared);\n         bdrv_child_set_perm(c, cur_perm, cur_shared);\n@@ -1827,6 +1828,7 @@ int bdrv_child_try_set_perm(BdrvChild *c, uint64_t perm, uint64_t shared,\n \n void bdrv_filter_default_perms(BlockDriverState *bs, BdrvChild *c,\n                                const BdrvChildRole *role,\n+                               BlockReopenQueue *reopen_queue,\n                                uint64_t perm, uint64_t shared,\n                                uint64_t *nperm, uint64_t *nshared)\n {\n@@ -1844,6 +1846,7 @@ void bdrv_filter_default_perms(BlockDriverState *bs, BdrvChild *c,\n \n void bdrv_format_default_perms(BlockDriverState *bs, BdrvChild *c,\n                                const BdrvChildRole *role,\n+                               BlockReopenQueue *reopen_queue,\n                                uint64_t perm, uint64_t shared,\n                                uint64_t *nperm, uint64_t *nshared)\n {\n@@ -1853,9 +1856,11 @@ void bdrv_format_default_perms(BlockDriverState *bs, BdrvChild *c,\n     if (!backing) {\n         /* Apart from the modifications below, the same permissions are\n          * forwarded and left alone as for filters */\n-        bdrv_filter_default_perms(bs, c, role, perm, shared, &perm, &shared);\n+        bdrv_filter_default_perms(bs, c, role, reopen_queue, perm, shared,\n+                                  &perm, &shared);\n \n         /* Format drivers may touch metadata even if the guest doesn't write */\n+        /* TODO Take flags from reopen_queue */\n         if (bdrv_is_writable(bs)) {\n             perm |= BLK_PERM_WRITE | BLK_PERM_RESIZE;\n         }\n@@ -1999,7 +2004,7 @@ BdrvChild *bdrv_attach_child(BlockDriverState *parent_bs,\n \n     assert(parent_bs->drv);\n     assert(bdrv_get_aio_context(parent_bs) == bdrv_get_aio_context(child_bs));\n-    bdrv_child_perm(parent_bs, child_bs, NULL, child_role,\n+    bdrv_child_perm(parent_bs, child_bs, NULL, child_role, NULL,\n                     perm, shared_perm, &perm, &shared_perm);\n \n     child = bdrv_root_attach_child(child_bs, child_name, child_role,\ndiff --git a/block/commit.c b/block/commit.c\nindex 898d91f653..8f0e83578a 100644\n--- a/block/commit.c\n+++ b/block/commit.c\n@@ -257,6 +257,7 @@ static void bdrv_commit_top_close(BlockDriverState *bs)\n \n static void bdrv_commit_top_child_perm(BlockDriverState *bs, BdrvChild *c,\n                                        const BdrvChildRole *role,\n+                                       BlockReopenQueue *reopen_queue,\n                                        uint64_t perm, uint64_t shared,\n                                        uint64_t *nperm, uint64_t *nshared)\n {\ndiff --git a/block/mirror.c b/block/mirror.c\nindex 6531652d73..6f5cb9f26c 100644\n--- a/block/mirror.c\n+++ b/block/mirror.c\n@@ -1084,6 +1084,7 @@ static void bdrv_mirror_top_close(BlockDriverState *bs)\n \n static void bdrv_mirror_top_child_perm(BlockDriverState *bs, BdrvChild *c,\n                                        const BdrvChildRole *role,\n+                                       BlockReopenQueue *reopen_queue,\n                                        uint64_t perm, uint64_t shared,\n                                        uint64_t *nperm, uint64_t *nshared)\n {\ndiff --git a/block/replication.c b/block/replication.c\nindex bf4462c8e7..3a4e6822e4 100644\n--- a/block/replication.c\n+++ b/block/replication.c\n@@ -157,6 +157,7 @@ static void replication_close(BlockDriverState *bs)\n \n static void replication_child_perm(BlockDriverState *bs, BdrvChild *c,\n                                    const BdrvChildRole *role,\n+                                   BlockReopenQueue *reopen_queue,\n                                    uint64_t perm, uint64_t shared,\n                                    uint64_t *nperm, uint64_t *nshared)\n {\ndiff --git a/block/vvfat.c b/block/vvfat.c\nindex c54fa94651..ee894bbe98 100644\n--- a/block/vvfat.c\n+++ b/block/vvfat.c\n@@ -3210,6 +3210,7 @@ err:\n \n static void vvfat_child_perm(BlockDriverState *bs, BdrvChild *c,\n                              const BdrvChildRole *role,\n+                             BlockReopenQueue *reopen_queue,\n                              uint64_t perm, uint64_t shared,\n                              uint64_t *nperm, uint64_t *nshared)\n {\n",
    "prefixes": [
        "2/6"
    ]
}