get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 810141,
    "url": "http://patchwork.ozlabs.org/api/patches/810141/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/netdev/patch/1504615144-29770-14-git-send-email-gilad@benyossef.com/",
    "project": {
        "id": 7,
        "url": "http://patchwork.ozlabs.org/api/projects/7/?format=api",
        "name": "Linux network development",
        "link_name": "netdev",
        "list_id": "netdev.vger.kernel.org",
        "list_email": "netdev@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1504615144-29770-14-git-send-email-gilad@benyossef.com>",
    "list_archive_url": null,
    "date": "2017-09-05T12:38:52",
    "name": "[v8,13/20] dm: move dm-verity to generic async completion",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": true,
    "hash": "1046247cac0f81981d43f0a2bab512956982f19b",
    "submitter": {
        "id": 11198,
        "url": "http://patchwork.ozlabs.org/api/people/11198/?format=api",
        "name": "Gilad Ben-Yossef",
        "email": "gilad@benyossef.com"
    },
    "delegate": {
        "id": 34,
        "url": "http://patchwork.ozlabs.org/api/users/34/?format=api",
        "username": "davem",
        "first_name": "David",
        "last_name": "Miller",
        "email": "davem@davemloft.net"
    },
    "mbox": "http://patchwork.ozlabs.org/project/netdev/patch/1504615144-29770-14-git-send-email-gilad@benyossef.com/mbox/",
    "series": [
        {
            "id": 1573,
            "url": "http://patchwork.ozlabs.org/api/series/1573/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/netdev/list/?series=1573",
            "date": "2017-09-05T12:38:39",
            "name": "simplify crypto wait for async op",
            "version": 8,
            "mbox": "http://patchwork.ozlabs.org/series/1573/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/810141/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/810141/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<netdev-owner@vger.kernel.org>",
        "X-Original-To": "patchwork-incoming@ozlabs.org",
        "Delivered-To": "patchwork-incoming@ozlabs.org",
        "Authentication-Results": "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=netdev-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xmmgB1QMVz9sRV\n\tfor <patchwork-incoming@ozlabs.org>;\n\tTue,  5 Sep 2017 22:46:30 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1752115AbdIEMmk (ORCPT <rfc822;patchwork-incoming@ozlabs.org>);\n\tTue, 5 Sep 2017 08:42:40 -0400",
            "from foss.arm.com ([217.140.101.70]:39648 \"EHLO foss.arm.com\"\n\trhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP\n\tid S1751564AbdIEMmb (ORCPT <rfc822;netdev@vger.kernel.org>);\n\tTue, 5 Sep 2017 08:42:31 -0400",
            "from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249])\n\tby usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 85824168F;\n\tTue,  5 Sep 2017 05:42:30 -0700 (PDT)",
            "from gby.kfn.arm.com (unknown [10.45.48.140])\n\tby usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id\n\t121EE3F3E1; Tue,  5 Sep 2017 05:42:20 -0700 (PDT)"
        ],
        "From": "Gilad Ben-Yossef <gilad@benyossef.com>",
        "To": "Herbert Xu <herbert@gondor.apana.org.au>,\n\t\"David S. Miller\" <davem@davemloft.net>,\n\tJonathan Corbet <corbet@lwn.net>, David Howells <dhowells@redhat.com>,\n\tTom Lendacky <thomas.lendacky@amd.com>, Gary Hook <gary.hook@amd.com>,\n\tBoris Brezillon <boris.brezillon@free-electrons.com>,\n\tArnaud Ebalard <arno@natisbad.org>,\n\tMatthias Brugger <matthias.bgg@gmail.com>,\n\tAlasdair Kergon <agk@redhat.com>,\n\tMike Snitzer <snitzer@redhat.com>, dm-devel@redhat.com,\n\tShaohua Li <shli@kernel.org>, Steve French <sfrench@samba.org>,\n\t\"Theodore Y. Ts'o\" <tytso@mit.edu>, Jaegeuk Kim <jaegeuk@kernel.org>,\n\tSteffen Klassert <steffen.klassert@secunet.com>,\n\tAlexey Kuznetsov <kuznet@ms2.inr.ac.ru>,\n\tHideaki YOSHIFUJI <yoshfuji@linux-ipv6.org>,\n\tMimi Zohar <zohar@linux.vnet.ibm.com>,\n\tDmitry Kasatkin <dmitry.kasatkin@gmail.com>,\n\tJames Morris <james.l.morris@oracle.com>,\n\t\"Serge E. Hallyn\" <serge@hallyn.com>, linux-crypto@vger.kernel.org,\n\tlinux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,\n\tkeyrings@vger.kernel.org, linux-arm-kernel@lists.infradead.org,\n\tlinux-mediatek@lists.infradead.org, linux-raid@vger.kernel.org,\n\tlinux-cifs@vger.kernel.org, samba-technical@lists.samba.org,\n\tlinux-fscrypt@vger.kernel.org, netdev@vger.kernel.org,\n\tlinux-ima-devel@lists.sourceforge.net,\n\tlinux-ima-user@lists.sourceforge.net,\n\tlinux-security-module@vger.kernel.org",
        "Cc": "Ofir Drang <ofir.drang@arm.com>, Mikulas Patocka <mpatocka@redhat.com>",
        "Subject": "[PATCH v8 13/20] dm: move dm-verity to generic async completion",
        "Date": "Tue,  5 Sep 2017 15:38:52 +0300",
        "Message-Id": "<1504615144-29770-14-git-send-email-gilad@benyossef.com>",
        "X-Mailer": "git-send-email 2.1.4",
        "In-Reply-To": "<1504615144-29770-1-git-send-email-gilad@benyossef.com>",
        "References": "<1504615144-29770-1-git-send-email-gilad@benyossef.com>",
        "Sender": "netdev-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<netdev.vger.kernel.org>",
        "X-Mailing-List": "netdev@vger.kernel.org"
    },
    "content": "dm-verity is starting async. crypto ops and waiting for them to complete.\nMove it over to generic code doing the same.\n\nThis also avoids a future potential data coruption bug created\nby the use of wait_for_completion_interruptible() without dealing\ncorrectly with an interrupt aborting the wait prior to the\nasync op finishing, should this code ever move to a context\nwhere signals are not masked.\n\nSigned-off-by: Gilad Ben-Yossef <gilad@benyossef.com>\nCC: Mikulas Patocka <mpatocka@redhat.com>\n---\n drivers/md/dm-verity-target.c | 81 +++++++++++--------------------------------\n drivers/md/dm-verity.h        |  5 ---\n 2 files changed, 20 insertions(+), 66 deletions(-)",
    "diff": "diff --git a/drivers/md/dm-verity-target.c b/drivers/md/dm-verity-target.c\nindex bda3cac..811ad28 100644\n--- a/drivers/md/dm-verity-target.c\n+++ b/drivers/md/dm-verity-target.c\n@@ -92,74 +92,33 @@ static sector_t verity_position_at_level(struct dm_verity *v, sector_t block,\n \treturn block >> (level * v->hash_per_block_bits);\n }\n \n-/*\n- * Callback function for asynchrnous crypto API completion notification\n- */\n-static void verity_op_done(struct crypto_async_request *base, int err)\n-{\n-\tstruct verity_result *res = (struct verity_result *)base->data;\n-\n-\tif (err == -EINPROGRESS)\n-\t\treturn;\n-\n-\tres->err = err;\n-\tcomplete(&res->completion);\n-}\n-\n-/*\n- * Wait for async crypto API callback\n- */\n-static inline int verity_complete_op(struct verity_result *res, int ret)\n-{\n-\tswitch (ret) {\n-\tcase 0:\n-\t\tbreak;\n-\n-\tcase -EINPROGRESS:\n-\tcase -EBUSY:\n-\t\tret = wait_for_completion_interruptible(&res->completion);\n-\t\tif (!ret)\n-\t\t\tret = res->err;\n-\t\treinit_completion(&res->completion);\n-\t\tbreak;\n-\n-\tdefault:\n-\t\tDMERR(\"verity_wait_hash: crypto op submission failed: %d\", ret);\n-\t}\n-\n-\tif (unlikely(ret < 0))\n-\t\tDMERR(\"verity_wait_hash: crypto op failed: %d\", ret);\n-\n-\treturn ret;\n-}\n-\n static int verity_hash_update(struct dm_verity *v, struct ahash_request *req,\n \t\t\t\tconst u8 *data, size_t len,\n-\t\t\t\tstruct verity_result *res)\n+\t\t\t\tstruct crypto_wait *wait)\n {\n \tstruct scatterlist sg;\n \n \tsg_init_one(&sg, data, len);\n \tahash_request_set_crypt(req, &sg, NULL, len);\n \n-\treturn verity_complete_op(res, crypto_ahash_update(req));\n+\treturn crypto_wait_req(crypto_ahash_update(req), wait);\n }\n \n /*\n  * Wrapper for crypto_ahash_init, which handles verity salting.\n  */\n static int verity_hash_init(struct dm_verity *v, struct ahash_request *req,\n-\t\t\t\tstruct verity_result *res)\n+\t\t\t\tstruct crypto_wait *wait)\n {\n \tint r;\n \n \tahash_request_set_tfm(req, v->tfm);\n \tahash_request_set_callback(req, CRYPTO_TFM_REQ_MAY_SLEEP |\n \t\t\t\t\tCRYPTO_TFM_REQ_MAY_BACKLOG,\n-\t\t\t\t\tverity_op_done, (void *)res);\n-\tinit_completion(&res->completion);\n+\t\t\t\t\tcrypto_req_done, (void *)wait);\n+\tcrypto_init_wait(wait);\n \n-\tr = verity_complete_op(res, crypto_ahash_init(req));\n+\tr = crypto_wait_req(crypto_ahash_init(req), wait);\n \n \tif (unlikely(r < 0)) {\n \t\tDMERR(\"crypto_ahash_init failed: %d\", r);\n@@ -167,18 +126,18 @@ static int verity_hash_init(struct dm_verity *v, struct ahash_request *req,\n \t}\n \n \tif (likely(v->salt_size && (v->version >= 1)))\n-\t\tr = verity_hash_update(v, req, v->salt, v->salt_size, res);\n+\t\tr = verity_hash_update(v, req, v->salt, v->salt_size, wait);\n \n \treturn r;\n }\n \n static int verity_hash_final(struct dm_verity *v, struct ahash_request *req,\n-\t\t\t     u8 *digest, struct verity_result *res)\n+\t\t\t     u8 *digest, struct crypto_wait *wait)\n {\n \tint r;\n \n \tif (unlikely(v->salt_size && (!v->version))) {\n-\t\tr = verity_hash_update(v, req, v->salt, v->salt_size, res);\n+\t\tr = verity_hash_update(v, req, v->salt, v->salt_size, wait);\n \n \t\tif (r < 0) {\n \t\t\tDMERR(\"verity_hash_final failed updating salt: %d\", r);\n@@ -187,7 +146,7 @@ static int verity_hash_final(struct dm_verity *v, struct ahash_request *req,\n \t}\n \n \tahash_request_set_crypt(req, NULL, digest, 0);\n-\tr = verity_complete_op(res, crypto_ahash_final(req));\n+\tr = crypto_wait_req(crypto_ahash_final(req), wait);\n out:\n \treturn r;\n }\n@@ -196,17 +155,17 @@ int verity_hash(struct dm_verity *v, struct ahash_request *req,\n \t\tconst u8 *data, size_t len, u8 *digest)\n {\n \tint r;\n-\tstruct verity_result res;\n+\tstruct crypto_wait wait;\n \n-\tr = verity_hash_init(v, req, &res);\n+\tr = verity_hash_init(v, req, &wait);\n \tif (unlikely(r < 0))\n \t\tgoto out;\n \n-\tr = verity_hash_update(v, req, data, len, &res);\n+\tr = verity_hash_update(v, req, data, len, &wait);\n \tif (unlikely(r < 0))\n \t\tgoto out;\n \n-\tr = verity_hash_final(v, req, digest, &res);\n+\tr = verity_hash_final(v, req, digest, &wait);\n \n out:\n \treturn r;\n@@ -389,7 +348,7 @@ int verity_hash_for_block(struct dm_verity *v, struct dm_verity_io *io,\n  * Calculates the digest for the given bio\n  */\n int verity_for_io_block(struct dm_verity *v, struct dm_verity_io *io,\n-\t\t\tstruct bvec_iter *iter, struct verity_result *res)\n+\t\t\tstruct bvec_iter *iter, struct crypto_wait *wait)\n {\n \tunsigned int todo = 1 << v->data_dev_block_bits;\n \tstruct bio *bio = dm_bio_from_per_bio_data(io, v->ti->per_io_data_size);\n@@ -414,7 +373,7 @@ int verity_for_io_block(struct dm_verity *v, struct dm_verity_io *io,\n \t\t */\n \t\tsg_set_page(&sg, bv.bv_page, len, bv.bv_offset);\n \t\tahash_request_set_crypt(req, &sg, NULL, len);\n-\t\tr = verity_complete_op(res, crypto_ahash_update(req));\n+\t\tr = crypto_wait_req(crypto_ahash_update(req), wait);\n \n \t\tif (unlikely(r < 0)) {\n \t\t\tDMERR(\"verity_for_io_block crypto op failed: %d\", r);\n@@ -482,7 +441,7 @@ static int verity_verify_io(struct dm_verity_io *io)\n \tstruct dm_verity *v = io->v;\n \tstruct bvec_iter start;\n \tunsigned b;\n-\tstruct verity_result res;\n+\tstruct crypto_wait wait;\n \n \tfor (b = 0; b < io->n_blocks; b++) {\n \t\tint r;\n@@ -507,17 +466,17 @@ static int verity_verify_io(struct dm_verity_io *io)\n \t\t\tcontinue;\n \t\t}\n \n-\t\tr = verity_hash_init(v, req, &res);\n+\t\tr = verity_hash_init(v, req, &wait);\n \t\tif (unlikely(r < 0))\n \t\t\treturn r;\n \n \t\tstart = io->iter;\n-\t\tr = verity_for_io_block(v, io, &io->iter, &res);\n+\t\tr = verity_for_io_block(v, io, &io->iter, &wait);\n \t\tif (unlikely(r < 0))\n \t\t\treturn r;\n \n \t\tr = verity_hash_final(v, req, verity_io_real_digest(v, io),\n-\t\t\t\t\t&res);\n+\t\t\t\t\t&wait);\n \t\tif (unlikely(r < 0))\n \t\t\treturn r;\n \ndiff --git a/drivers/md/dm-verity.h b/drivers/md/dm-verity.h\nindex a59e0ad..b675bc0 100644\n--- a/drivers/md/dm-verity.h\n+++ b/drivers/md/dm-verity.h\n@@ -90,11 +90,6 @@ struct dm_verity_io {\n \t */\n };\n \n-struct verity_result {\n-\tstruct completion completion;\n-\tint err;\n-};\n-\n static inline struct ahash_request *verity_io_hash_req(struct dm_verity *v,\n \t\t\t\t\t\t     struct dm_verity_io *io)\n {\n",
    "prefixes": [
        "v8",
        "13/20"
    ]
}