get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 47801,
    "url": "http://patchwork.dpdk.org/api/patches/47801/?format=api",
    "web_url": "http://patchwork.dpdk.org/project/dpdk/patch/20181105070447.67700-3-dariusz.stojaczyk@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20181105070447.67700-3-dariusz.stojaczyk@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20181105070447.67700-3-dariusz.stojaczyk@intel.com",
    "date": "2018-11-05T07:04:47",
    "name": "[3/3] eal: handle bus rescan failures during hotplug",
    "commit_ref": null,
    "pull_url": null,
    "state": "rejected",
    "archived": true,
    "hash": "e0d74a08d701a5696910e9f2a9a061c6795f2c73",
    "submitter": {
        "id": 1123,
        "url": "http://patchwork.dpdk.org/api/people/1123/?format=api",
        "name": "Stojaczyk, Dariusz",
        "email": "dariusz.stojaczyk@intel.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patchwork.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patchwork.dpdk.org/project/dpdk/patch/20181105070447.67700-3-dariusz.stojaczyk@intel.com/mbox/",
    "series": [
        {
            "id": 2249,
            "url": "http://patchwork.dpdk.org/api/series/2249/?format=api",
            "web_url": "http://patchwork.dpdk.org/project/dpdk/list/?series=2249",
            "date": "2018-11-05T07:04:45",
            "name": "[1/3] bus/pci: update device devargs on each rescan",
            "version": 1,
            "mbox": "http://patchwork.dpdk.org/series/2249/mbox/"
        }
    ],
    "comments": "http://patchwork.dpdk.org/api/patches/47801/comments/",
    "check": "success",
    "checks": "http://patchwork.dpdk.org/api/patches/47801/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id B14FE5424;\n\tMon,  5 Nov 2018 08:08:18 +0100 (CET)",
            "from mga12.intel.com (mga12.intel.com [192.55.52.136])\n\tby dpdk.org (Postfix) with ESMTP id C7D394CA2\n\tfor <dev@dpdk.org>; Mon,  5 Nov 2018 08:08:14 +0100 (CET)",
            "from fmsmga001.fm.intel.com ([10.253.24.23])\n\tby fmsmga106.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t04 Nov 2018 23:08:13 -0800",
            "from violet.igk.intel.com ([10.102.54.137])\n\tby fmsmga001.fm.intel.com with ESMTP; 04 Nov 2018 23:08:12 -0800"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.54,467,1534834800\"; d=\"scan'208\";a=\"105308435\"",
        "From": "Darek Stojaczyk <dariusz.stojaczyk@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "thomas@monjalon.net, Darek Stojaczyk <dariusz.stojaczyk@intel.com>,\n\tgaetan.rivet@6wind.com, qi.z.zhang@intel.com",
        "Date": "Mon,  5 Nov 2018 08:04:47 +0100",
        "Message-Id": "<20181105070447.67700-3-dariusz.stojaczyk@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<20181105070447.67700-1-dariusz.stojaczyk@intel.com>",
        "References": "<20181105070447.67700-1-dariusz.stojaczyk@intel.com>",
        "Subject": "[dpdk-dev] [PATCH 3/3] eal: handle bus rescan failures during\n\thotplug",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Fixes for devargs dangling pointers and various segfaults\ncaused by failed hotplug requests.\n\nIf rescan failed, we have one the following scenarios\nto cover:\n a) the device was never scanned at all; the devargs that\n    were just allocated are not referenced anywhere and\n    can be removed straight away. Previous devargs (if any)\n    need to be re-inserted as they are still in use.\n b) the device was scanned before, but the rescan failed\n    before it reached our device, meaning that its devargs\n    were not overridden and we can remove our newly allocated\n    ones. Previous devargs need to be re-inserted.\n c) we managed to rescan our device and only failed on\n    something after that, which means we have to free the\n    memory of previous devargs and stick with the new ones,\n    despite the fact that the hotplug still needs to be\n    failed.\n\nFixes: 7e8b26650146 (\"eal: fix hotplug add / remove\")\nCc: gaetan.rivet@6wind.com\nCc: qi.z.zhang@intel.com\n\nSigned-off-by: Darek Stojaczyk <dariusz.stojaczyk@intel.com>\n---\n lib/librte_eal/common/eal_common_dev.c | 30 ++++++++++++++++++--------\n 1 file changed, 21 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/common/eal_common_dev.c b/lib/librte_eal/common/eal_common_dev.c\nindex 4cb424df1..b090295b9 100644\n--- a/lib/librte_eal/common/eal_common_dev.c\n+++ b/lib/librte_eal/common/eal_common_dev.c\n@@ -7,6 +7,7 @@\n #include <string.h>\n #include <inttypes.h>\n #include <sys/queue.h>\n+#include <assert.h>\n \n #include <rte_compat.h>\n #include <rte_bus.h>\n@@ -141,32 +142,33 @@ local_dev_probe(const char *devargs, struct rte_device **new_dev)\n \n \tret = rte_devargs_parse(da, devargs);\n \tif (ret)\n-\t\tgoto err_devarg;\n+\t\tgoto err_remove_devargs;\n \n \tif (da->bus->plug == NULL) {\n \t\tRTE_LOG(ERR, EAL, \"Function plug not supported by bus (%s)\\n\",\n \t\t\tda->bus->name);\n \t\tret = -ENOTSUP;\n-\t\tgoto err_devarg;\n+\t\tgoto err_remove_devargs;\n \t}\n \n \trte_devargs_insert(da, &prev_da);\n \n+\tret = da->bus->scan();\n+\tif (ret)\n+\t\tgoto err_rollback_devargs;\n+\n \tif (prev_da != NULL) {\n \t\tfree(prev_da->args);\n \t\tfree(prev_da);\n+\t\tprev_da = NULL;\n \t}\n \n-\tret = da->bus->scan();\n-\tif (ret)\n-\t\tgoto err_devarg;\n-\n \tdev = da->bus->find_device(NULL, cmp_dev_name, da->name);\n \tif (dev == NULL) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot find device (%s)\\n\",\n \t\t\tda->name);\n \t\tret = -ENODEV;\n-\t\tgoto err_devarg;\n+\t\tgoto err_remove_devargs;\n \t}\n \n \tret = dev->bus->plug(dev);\n@@ -175,13 +177,23 @@ local_dev_probe(const char *devargs, struct rte_device **new_dev)\n \t\t\treturn ret; /* no rollback */\n \t\tRTE_LOG(ERR, EAL, \"Driver cannot attach the device (%s)\\n\",\n \t\t\tdev->name);\n-\t\tgoto err_devarg;\n+\t\tgoto err_remove_devargs;\n \t}\n \n \t*new_dev = dev;\n \treturn 0;\n \n-err_devarg:\n+err_rollback_devargs:\n+\tdev = da->bus->find_device(NULL, cmp_dev_name, da->name);\n+\tif (prev_da != NULL && (dev == NULL || dev->devargs != da)) {\n+\t\t/* either the device wasn't scanned, or we didn't\n+\t\t * manage yet to update its devargs.\n+\t\t */\n+\t\trte_devargs_insert(prev_da, &da);\n+\t\tassert(da != NULL);\n+\t}\n+\n+err_remove_devargs:\n \tif (rte_devargs_remove(da) != 0) {\n \t\tfree(da->args);\n \t\tfree(da);\n",
    "prefixes": [
        "3/3"
    ]
}