get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 35715,
    "url": "http://patches.dpdk.org/api/patches/35715/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/51c150f8e4d662881f4f39f3f3ad175c3ac058f9.1520424998.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": "<51c150f8e4d662881f4f39f3f3ad175c3ac058f9.1520424998.git.anatoly.burakov@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/51c150f8e4d662881f4f39f3f3ad175c3ac058f9.1520424998.git.anatoly.burakov@intel.com",
    "date": "2018-03-07T16:56:51",
    "name": "[dpdk-dev,v5,4/6] eal: lock IPC directory on init and send",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "8dd85fcd10a87146b8e06214d82983a0b62b58e3",
    "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/51c150f8e4d662881f4f39f3f3ad175c3ac058f9.1520424998.git.anatoly.burakov@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/35715/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/35715/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 5AE435F1D;\n\tWed,  7 Mar 2018 17:57:03 +0100 (CET)",
            "from mga06.intel.com (mga06.intel.com [134.134.136.31])\n\tby dpdk.org (Postfix) with ESMTP id D35C64C8F\n\tfor <dev@dpdk.org>; Wed,  7 Mar 2018 17:56:58 +0100 (CET)",
            "from fmsmga003.fm.intel.com ([10.253.24.29])\n\tby orsmga104.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384;\n\t07 Mar 2018 08:56:56 -0800",
            "from irvmail001.ir.intel.com ([163.33.26.43])\n\tby FMSMGA003.fm.intel.com with ESMTP; 07 Mar 2018 08:56:55 -0800",
            "from sivswdev01.ir.intel.com (sivswdev01.ir.intel.com\n\t[10.237.217.45])\n\tby irvmail001.ir.intel.com (8.14.3/8.13.6/MailSET/Hub) with ESMTP id\n\tw27Gus4I032297; Wed, 7 Mar 2018 16:56:54 GMT",
            "from sivswdev01.ir.intel.com (localhost [127.0.0.1])\n\tby sivswdev01.ir.intel.com with ESMTP id w27GusAG006134;\n\tWed, 7 Mar 2018 16:56:54 GMT",
            "(from aburakov@localhost)\n\tby sivswdev01.ir.intel.com with LOCAL id w27Gusww006130;\n\tWed, 7 Mar 2018 16:56:54 GMT"
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.47,436,1515484800\"; d=\"scan'208\";a=\"32086265\"",
        "From": "Anatoly Burakov <anatoly.burakov@intel.com>",
        "To": "dev@dpdk.org",
        "Cc": "jianfeng.tan@intel.com, keith.wiles@intel.com,\n\tkonstantin.ananyev@intel.com",
        "Date": "Wed,  7 Mar 2018 16:56:51 +0000",
        "Message-Id": "<51c150f8e4d662881f4f39f3f3ad175c3ac058f9.1520424998.git.anatoly.burakov@intel.com>",
        "X-Mailer": "git-send-email 1.7.0.7",
        "In-Reply-To": [
            "<cover.1520424998.git.anatoly.burakov@intel.com>",
            "<cover.1520424998.git.anatoly.burakov@intel.com>"
        ],
        "References": [
            "<cover.1520424998.git.anatoly.burakov@intel.com>",
            "<a9cae982af2307c7fa59406723bca84004de5ff6.1520000413.git.anatoly.burakov@intel.com>\n\t<cover.1520424998.git.anatoly.burakov@intel.com>"
        ],
        "Subject": "[dpdk-dev] [PATCH v5 4/6] eal: lock IPC directory on init and send",
        "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://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "When sending IPC messages, prevent new sockets from initializing.\n\nSigned-off-by: Anatoly Burakov <anatoly.burakov@intel.com>\n---\n\nNotes:\n    v5: removed init files introduced in v4\n    \n    v4: fixed resource leaks and added support for init files\n        introduced in v4 series\n\n lib/librte_eal/common/eal_common_proc.c | 59 +++++++++++++++++++++++++++++++--\n 1 file changed, 56 insertions(+), 3 deletions(-)",
    "diff": "diff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c\nindex 9587211..c6fef75 100644\n--- a/lib/librte_eal/common/eal_common_proc.c\n+++ b/lib/librte_eal/common/eal_common_proc.c\n@@ -13,6 +13,7 @@\n #include <stdio.h>\n #include <stdlib.h>\n #include <string.h>\n+#include <sys/file.h>\n #include <sys/time.h>\n #include <sys/types.h>\n #include <sys/socket.h>\n@@ -360,6 +361,7 @@ rte_mp_channel_init(void)\n {\n \tchar thread_name[RTE_MAX_THREAD_NAME_LEN];\n \tchar path[PATH_MAX];\n+\tint dir_fd;\n \tpthread_t tid;\n \n \t/* create filter path */\n@@ -370,19 +372,38 @@ rte_mp_channel_init(void)\n \tcreate_socket_path(\"*\", path, sizeof(path));\n \tsnprintf(mp_dir_path, sizeof(mp_dir_path), \"%s\", dirname(path));\n \n+\t/* lock the directory */\n+\tdir_fd = open(mp_dir_path, O_RDONLY);\n+\tif (dir_fd < 0) {\n+\t\tRTE_LOG(ERR, EAL, \"failed to open %s: %s\\n\",\n+\t\t\tmp_dir_path, strerror(errno));\n+\t\treturn -1;\n+\t}\n+\n+\tif (flock(dir_fd, LOCK_EX)) {\n+\t\tRTE_LOG(ERR, EAL, \"failed to lock %s: %s\\n\",\n+\t\t\tmp_dir_path, strerror(errno));\n+\t\tclose(dir_fd);\n+\t\treturn -1;\n+\t}\n+\n \tif (rte_eal_process_type() == RTE_PROC_PRIMARY &&\n \t\t\tunlink_sockets(mp_filter)) {\n \t\tRTE_LOG(ERR, EAL, \"failed to unlink mp sockets\\n\");\n+\t\tclose(dir_fd);\n \t\treturn -1;\n \t}\n \n-\tif (open_socket_fd() < 0)\n+\tif (open_socket_fd() < 0) {\n+\t\tclose(dir_fd);\n \t\treturn -1;\n+\t}\n \n \tif (pthread_create(&tid, NULL, mp_handle, NULL) < 0) {\n \t\tRTE_LOG(ERR, EAL, \"failed to create mp thead: %s\\n\",\n \t\t\tstrerror(errno));\n \t\tclose(mp_fd);\n+\t\tclose(dir_fd);\n \t\tmp_fd = -1;\n \t\treturn -1;\n \t}\n@@ -390,6 +411,11 @@ rte_mp_channel_init(void)\n \t/* try best to set thread name */\n \tsnprintf(thread_name, RTE_MAX_THREAD_NAME_LEN, \"rte_mp_handle\");\n \trte_thread_setname(tid, thread_name);\n+\n+\t/* unlock the directory */\n+\tflock(dir_fd, LOCK_UN);\n+\tclose(dir_fd);\n+\n \treturn 0;\n }\n \n@@ -465,7 +491,7 @@ send_msg(const char *dst_path, struct rte_mp_msg *msg, int type)\n static int\n mp_send(struct rte_mp_msg *msg, const char *peer, int type)\n {\n-\tint ret = 0;\n+\tint dir_fd, ret = 0;\n \tDIR *mp_dir;\n \tstruct dirent *ent;\n \n@@ -487,6 +513,17 @@ mp_send(struct rte_mp_msg *msg, const char *peer, int type)\n \t\trte_errno = errno;\n \t\treturn -1;\n \t}\n+\n+\tdir_fd = dirfd(mp_dir);\n+\t/* lock the directory to prevent processes spinning up while we send */\n+\tif (flock(dir_fd, LOCK_EX)) {\n+\t\tRTE_LOG(ERR, EAL, \"Unable to lock directory %s\\n\",\n+\t\t\tmp_dir_path);\n+\t\trte_errno = errno;\n+\t\tclosedir(mp_dir);\n+\t\treturn -1;\n+\t}\n+\n \twhile ((ent = readdir(mp_dir))) {\n \t\tchar path[PATH_MAX];\n \n@@ -498,7 +535,10 @@ mp_send(struct rte_mp_msg *msg, const char *peer, int type)\n \t\tif (send_msg(path, msg, type) < 0)\n \t\t\tret = -1;\n \t}\n+\t/* unlock the dir */\n+\tflock(dir_fd, LOCK_UN);\n \n+\t/* dir_fd automatically closed on closedir */\n \tclosedir(mp_dir);\n \treturn ret;\n }\n@@ -619,7 +659,7 @@ int __rte_experimental\n rte_mp_request(struct rte_mp_msg *req, struct rte_mp_reply *reply,\n \t\tconst struct timespec *ts)\n {\n-\tint ret = 0;\n+\tint dir_fd, ret = 0;\n \tDIR *mp_dir;\n \tstruct dirent *ent;\n \tstruct timeval now;\n@@ -655,6 +695,16 @@ rte_mp_request(struct rte_mp_msg *req, struct rte_mp_reply *reply,\n \t\treturn -1;\n \t}\n \n+\tdir_fd = dirfd(mp_dir);\n+\t/* lock the directory to prevent processes spinning up while we send */\n+\tif (flock(dir_fd, LOCK_EX)) {\n+\t\tRTE_LOG(ERR, EAL, \"Unable to lock directory %s\\n\",\n+\t\t\tmp_dir_path);\n+\t\tclosedir(mp_dir);\n+\t\trte_errno = errno;\n+\t\treturn -1;\n+\t}\n+\n \twhile ((ent = readdir(mp_dir))) {\n \t\tchar path[PATH_MAX];\n \n@@ -667,7 +717,10 @@ rte_mp_request(struct rte_mp_msg *req, struct rte_mp_reply *reply,\n \t\tif (mp_request_one(path, req, reply, &end))\n \t\t\tret = -1;\n \t}\n+\t/* unlock the directory */\n+\tflock(dir_fd, LOCK_UN);\n \n+\t/* dir_fd automatically closed on closedir */\n \tclosedir(mp_dir);\n \treturn ret;\n }\n",
    "prefixes": [
        "dpdk-dev",
        "v5",
        "4/6"
    ]
}