get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 57042,
    "url": "http://patches.dpdk.org/api/patches/57042/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/67a795e77bc9f5ac79ab78a878ae19abbead9f50.1563984454.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": "<67a795e77bc9f5ac79ab78a878ae19abbead9f50.1563984454.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/67a795e77bc9f5ac79ab78a878ae19abbead9f50.1563984454.git.anatoly.burakov@intel.com",
    "date": "2019-07-24T16:07:41",
    "name": "[v4] eal: fix proc type auto detection",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": true,
    "hash": "525e0f90178bb8a77a00e0fe0e978c7f4476bcfd",
    "submitter": {
        "id": 4,
        "url": "http://patches.dpdk.org/api/people/4/?format=api",
        "name": "Anatoly Burakov",
        "email": "anatoly.burakov@intel.com"
    },
    "delegate": {
        "id": 24651,
        "url": "http://patches.dpdk.org/api/users/24651/?format=api",
        "username": "dmarchand",
        "first_name": "David",
        "last_name": "Marchand",
        "email": "david.marchand@redhat.com"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/67a795e77bc9f5ac79ab78a878ae19abbead9f50.1563984454.git.anatoly.burakov@intel.com/mbox/",
    "series": [
        {
            "id": 5716,
            "url": "http://patches.dpdk.org/api/series/5716/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=5716",
            "date": "2019-07-24T16:07:41",
            "name": "[v4] eal: fix proc type auto detection",
            "version": 4,
            "mbox": "http://patches.dpdk.org/series/5716/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/57042/comments/",
    "check": "success",
    "checks": "http://patches.dpdk.org/api/patches/57042/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 9F87B1C217;\n\tWed, 24 Jul 2019 18:07:47 +0200 (CEST)",
            "from mga01.intel.com (mga01.intel.com [192.55.52.88])\n\tby dpdk.org (Postfix) with ESMTP id 8EE9A2BAC;\n\tWed, 24 Jul 2019 18:07:44 +0200 (CEST)",
            "from orsmga002.jf.intel.com ([10.7.209.21])\n\tby fmsmga101.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t24 Jul 2019 09:07:43 -0700",
            "from silpixa00399498.ir.intel.com (HELO\n\tsilpixa00399498.ger.corp.intel.com) ([10.237.223.125])\n\tby orsmga002.jf.intel.com with ESMTP; 24 Jul 2019 09:07:42 -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=\"181149023\"",
        "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:07:41 +0100",
        "Message-Id": "<67a795e77bc9f5ac79ab78a878ae19abbead9f50.1563984454.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 2.17.1",
        "In-Reply-To": "<e76dcac7fe4ecd9f588253950b6496990581440a.1563984251.git.anatoly.burakov@intel.com>",
        "References": "<e76dcac7fe4ecd9f588253950b6496990581440a.1563984251.git.anatoly.burakov@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v4] 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    v4:\n    - Fixed FreeBSD log message to match Linux version\n    \n    v3:\n    - Added similar changes to FreeBSD version\n    \n    v2:\n    - Adjusted indentation\n\n lib/librte_eal/freebsd/eal/eal.c | 36 +++++++++++++++++++++++++++----\n lib/librte_eal/linux/eal/eal.c   | 37 +++++++++++++++++++++++++++-----\n 2 files changed, 64 insertions(+), 9 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/freebsd/eal/eal.c b/lib/librte_eal/freebsd/eal/eal.c\nindex d53f0fe69..69995bf8f 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@@ -249,8 +256,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@@ -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": [
        "v4"
    ]
}