get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 57041,
    "url": "http://patches.dpdk.org/api/patches/57041/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/e76dcac7fe4ecd9f588253950b6496990581440a.1563984251.git.anatoly.burakov@intel.com/",
    "project": {
        "id": 1,
        "url": "http://patches.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": "<e76dcac7fe4ecd9f588253950b6496990581440a.1563984251.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/e76dcac7fe4ecd9f588253950b6496990581440a.1563984251.git.anatoly.burakov@intel.com",
    "date": "2019-07-24T16:04:17",
    "name": "[v3] eal: fix proc type auto detection",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "ef0747bf1178b544ae7a34ca1758e1bb3d5fd4d2",
    "submitter": {
        "id": 4,
        "url": "http://patches.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/e76dcac7fe4ecd9f588253950b6496990581440a.1563984251.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 5715,
            "url": "http://patches.dpdk.org/api/series/5715/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5715",
            "date": "2019-07-24T16:04:17",
            "name": "[v3] eal: fix proc type auto detection",
            "version": 3,
            "mbox": "http://patches.dpdk.org/series/5715/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/57041/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/57041/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 7BDBC1C217;\n\tWed, 24 Jul 2019 18:04:21 +0200 (CEST)",
            "from mga14.intel.com (mga14.intel.com [192.55.52.115])\n\tby dpdk.org (Postfix) with ESMTP id 0951B1C211;\n\tWed, 24 Jul 2019 18:04:19 +0200 (CEST)",
            "from fmsmga007.fm.intel.com ([10.253.24.52])\n\tby fmsmga103.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t24 Jul 2019 09:04:19 -0700",
            "from silpixa00399498.ir.intel.com (HELO\n\tsilpixa00399498.ger.corp.intel.com) ([10.237.223.125])\n\tby fmsmga007.fm.intel.com with ESMTP; 24 Jul 2019 09:04:17 -0700"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.64,303,1559545200\"; d=\"scan'208\";a=\"171540289\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "Bruce Richardson <bruce.richardson@intel.com>, stephen@networkplumber.org,\n\tstable@dpdk.org",
        "Date": "Wed, 24 Jul 2019 17:04:17 +0100",
        "Message-Id": "<e76dcac7fe4ecd9f588253950b6496990581440a.1563984251.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<6b3b660d00b77d267594781fa1ab52607c209799.1563962656.git.anatoly.burakov@intel.com>",
        "References": "<6b3b660d00b77d267594781fa1ab52607c209799.1563962656.git.anatoly.burakov@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v3] eal: fix proc type auto detection",
        "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": "Currently, primary process holds an exclusive lock on the config\nfile, thereby preventing other primaries from spinning up. However,\nwhen the primary dies, the lock is no longer being held, even though\nthere might be other secondary processes still running.\n\nThe fix is two-fold. First of all, downgrade the primary process's\nexclusive lock to a shared lock once we have it. Second of all,\nalso take out shared locks on the config from the secondaries. We\nare using fcntl() locks, which get dropped when the file handle is\nclosed, so also remove the closure of config file handle.\n\nFixes: af75078fece3 (\"first public release\")\nCc: stable@dpdk.org\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n\nNotes:\n    v3:\n    - Added similar changes to FreeBSD version\n    \n    v2:\n    - Adjusted indentation\n\n lib/librte_eal/freebsd/eal/eal.c | 32 +++++++++++++++++++++++++--\n lib/librte_eal/linux/eal/eal.c   | 37 +++++++++++++++++++++++++++-----\n 2 files changed, 62 insertions(+), 7 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c\nindex d53f0fe69..bc00abcf3 100644\n--- a/lib/librte_eal/freebsd/eal/eal.c\n+++ b/lib/librte_eal/freebsd/eal/eal.c\n@@ -72,6 +72,13 @@ static struct flock wr_lock = {\n \t\t.l_len = sizeof(early_mem_config.memsegs),\n };\n \n+static struct flock rd_lock = {\n+\t.l_type = F_RDLCK,\n+\t.l_whence = SEEK_SET,\n+\t.l_start = offsetof(struct rte_mem_config, memsegs),\n+\t.l_len = sizeof(early_mem_config.memsegs),\n+};\n+\n /* Address of global and public configuration */\n static struct rte_config rte_config = {\n \t\t.mem_config = &early_mem_config,\n@@ -254,6 +261,19 @@ rte_eal_config_create(void)\n \t\treturn -1;\n \t}\n \n+\t/* we hold an exclusive lock - now downgrade it to a read lock to allow\n+\t * other processes to also hold onto this file while preventing other\n+\t * primaries from spinning up.\n+\t */\n+\tretval = fcntl(mem_cfg_fd, F_SETLK, &rd_lock);\n+\tif (retval < 0) {\n+\t\tclose(mem_cfg_fd);\n+\t\tmem_cfg_fd = -1;\n+\t\tRTE_LOG(ERR, EAL, \"Cannot downgrade to shared lock on '%s': %s\\n\",\n+\t\t\tpathname, strerror(errno));\n+\t\treturn -1;\n+\t}\n+\n \trte_mem_cfg_addr = mmap(NULL, sizeof(*rte_config.mem_config),\n \t\t\t\tPROT_READ | PROT_WRITE, MAP_SHARED, mem_cfg_fd, 0);\n \n@@ -292,6 +312,16 @@ rte_eal_config_attach(void)\n \t\t\treturn -1;\n \t\t}\n \t}\n+\t/* lock the file to prevent primary from initializing while this\n+\t * process is still running.\n+\t */\n+\tif (fcntl(mem_cfg_fd, F_SETLK, &rd_lock) < 0) {\n+\t\tclose(mem_cfg_fd);\n+\t\tmem_cfg_fd = -1;\n+\t\tRTE_LOG(ERR, EAL, \"Cannot create shared lock on '%s': %s\\n\",\n+\t\t\t\tpathname, strerror(errno));\n+\t\treturn -1;\n+\t}\n \n \trte_mem_cfg_addr = mmap(NULL, sizeof(*rte_config.mem_config),\n \t\t\t\tPROT_READ, MAP_SHARED, mem_cfg_fd, 0);\n@@ -330,8 +360,6 @@ rte_eal_config_reattach(void)\n \tmem_config = (struct rte_mem_config *) mmap(rte_mem_cfg_addr,\n \t\t\tsizeof(*mem_config), PROT_READ | PROT_WRITE, MAP_SHARED,\n \t\t\tmem_cfg_fd, 0);\n-\tclose(mem_cfg_fd);\n-\tmem_cfg_fd = -1;\n \n \tif (mem_config == MAP_FAILED) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot mmap memory for rte_config! error %i (%s)\\n\",\ndiff --git a/lib/librte_eal/linux/eal/eal.c b/lib/librte_eal/linux/eal/eal.c\nindex 34db78753..0f0726703 100644\n--- a/lib/librte_eal/linux/eal/eal.c\n+++ b/lib/librte_eal/linux/eal/eal.c\n@@ -83,6 +83,13 @@ static struct flock wr_lock = {\n \t\t.l_len = sizeof(early_mem_config.memsegs),\n };\n \n+static struct flock rd_lock = {\n+\t.l_type = F_RDLCK,\n+\t.l_whence = SEEK_SET,\n+\t.l_start = offsetof(struct rte_mem_config, memsegs),\n+\t.l_len = sizeof(early_mem_config.memsegs),\n+};\n+\n /* Address of global and public configuration */\n static struct rte_config rte_config = {\n \t\t.mem_config = &early_mem_config,\n@@ -343,8 +350,21 @@ rte_eal_config_create(void)\n \tif (retval < 0){\n \t\tclose(mem_cfg_fd);\n \t\tmem_cfg_fd = -1;\n-\t\tRTE_LOG(ERR, EAL, \"Cannot create lock on '%s'. Is another primary \"\n-\t\t\t\"process running?\\n\", pathname);\n+\t\tRTE_LOG(ERR, EAL, \"Cannot create exclusive lock on '%s'. \"\n+\t\t\t\"Is another process running?\\n\", pathname);\n+\t\treturn -1;\n+\t}\n+\n+\t/* we hold an exclusive lock - now downgrade it to a read lock to allow\n+\t * other processes to also hold onto this file while preventing other\n+\t * primaries from spinning up.\n+\t */\n+\tretval = fcntl(mem_cfg_fd, F_SETLK, &rd_lock);\n+\tif (retval < 0) {\n+\t\tclose(mem_cfg_fd);\n+\t\tmem_cfg_fd = -1;\n+\t\tRTE_LOG(ERR, EAL, \"Cannot downgrade to shared lock on '%s': %s\\n\",\n+\t\t\tpathname, strerror(errno));\n \t\treturn -1;\n \t}\n \n@@ -389,6 +409,16 @@ rte_eal_config_attach(void)\n \t\t\treturn -1;\n \t\t}\n \t}\n+\t/* lock the file to prevent primary from initializing while this\n+\t * process is still running.\n+\t */\n+\tif (fcntl(mem_cfg_fd, F_SETLK, &rd_lock) < 0) {\n+\t\tclose(mem_cfg_fd);\n+\t\tmem_cfg_fd = -1;\n+\t\tRTE_LOG(ERR, EAL, \"Cannot create shared lock on '%s': %s\\n\",\n+\t\t\t\tpathname, strerror(errno));\n+\t\treturn -1;\n+\t}\n \n \t/* map it as read-only first */\n \tmem_config = (struct rte_mem_config *) mmap(NULL, sizeof(*mem_config),\n@@ -427,9 +457,6 @@ rte_eal_config_reattach(void)\n \t\t\tsizeof(*mem_config), PROT_READ | PROT_WRITE, MAP_SHARED,\n \t\t\tmem_cfg_fd, 0);\n \n-\tclose(mem_cfg_fd);\n-\tmem_cfg_fd = -1;\n-\n \tif (mem_config == MAP_FAILED || mem_config != rte_mem_cfg_addr) {\n \t\tif (mem_config != MAP_FAILED) {\n \t\t\t/* errno is stale, don't use */\n",
    "prefixes": [
        "v3"
    ]
}