Patch Detail
get:
Show a patch.
patch:
Update a patch.
put:
Update a patch.
GET /api/patches/2215518/?format=api
{ "id": 2215518, "url": "http://patchwork.ozlabs.org/api/patches/2215518/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260324185619.296946-4-kwolf@redhat.com/", "project": { "id": 14, "url": "http://patchwork.ozlabs.org/api/projects/14/?format=api", "name": "QEMU Development", "link_name": "qemu-devel", "list_id": "qemu-devel.nongnu.org", "list_email": "qemu-devel@nongnu.org", "web_url": "", "scm_url": "", "webscm_url": "", "list_archive_url": "", "list_archive_url_format": "", "commit_url_format": "" }, "msgid": "<20260324185619.296946-4-kwolf@redhat.com>", "list_archive_url": null, "date": "2026-03-24T18:56:18", "name": "[PULL,3/4] linux-aio: Resubmit tails of short reads/writes", "commit_ref": null, "pull_url": null, "state": "new", "archived": false, "hash": "f4b80dafe3e346170eadc21d69fe094016e15ae7", "submitter": { "id": 2714, "url": "http://patchwork.ozlabs.org/api/people/2714/?format=api", "name": "Kevin Wolf", "email": "kwolf@redhat.com" }, "delegate": null, "mbox": "http://patchwork.ozlabs.org/project/qemu-devel/patch/20260324185619.296946-4-kwolf@redhat.com/mbox/", "series": [ { "id": 497329, "url": "http://patchwork.ozlabs.org/api/series/497329/?format=api", "web_url": "http://patchwork.ozlabs.org/project/qemu-devel/list/?series=497329", "date": "2026-03-24T18:56:15", "name": "[PULL,1/4] block/curl: free s->password in cleanup paths", "version": 1, "mbox": "http://patchwork.ozlabs.org/series/497329/mbox/" } ], "comments": "http://patchwork.ozlabs.org/api/patches/2215518/comments/", "check": "pending", "checks": "http://patchwork.ozlabs.org/api/patches/2215518/checks/", "tags": {}, "related": [], "headers": { "Return-Path": "<qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org>", "X-Original-To": "incoming@patchwork.ozlabs.org", "Delivered-To": "patchwork-incoming@legolas.ozlabs.org", "Authentication-Results": [ "legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=redhat.com header.i=@redhat.com header.a=rsa-sha256\n header.s=mimecast20190719 header.b=BsMAW2zx;\n\tdkim-atps=neutral", "legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=nongnu.org\n (client-ip=209.51.188.17; helo=lists.gnu.org;\n envelope-from=qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org;\n receiver=patchwork.ozlabs.org)" ], "Received": [ "from lists.gnu.org (lists.gnu.org [209.51.188.17])\n\t(using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4fgK656DmMz1y1g\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 25 Mar 2026 05:57:17 +1100 (AEDT)", "from localhost ([::1] helo=lists1p.gnu.org)\n\tby lists.gnu.org with esmtp (Exim 4.90_1)\n\t(envelope-from <qemu-devel-bounces@nongnu.org>)\n\tid 1w56vp-0004ne-Ei; Tue, 24 Mar 2026 14:56:49 -0400", "from eggs.gnu.org ([2001:470:142:3::10])\n by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <kwolf@redhat.com>) id 1w56vk-0004kl-NI\n for qemu-devel@nongnu.org; Tue, 24 Mar 2026 14:56:45 -0400", "from us-smtp-delivery-124.mimecast.com ([170.10.129.124])\n by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256)\n (Exim 4.90_1) (envelope-from <kwolf@redhat.com>) id 1w56vi-0006ga-0p\n for qemu-devel@nongnu.org; Tue, 24 Mar 2026 14:56:43 -0400", "from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com\n (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by\n relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3,\n cipher=TLS_AES_256_GCM_SHA384) id us-mta-201-hEldPXqcPW2B0JOxpvPiOw-1; Tue,\n 24 Mar 2026 14:56:37 -0400", "from mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com\n (mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.4])\n (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest\n SHA256)\n (No client certificate requested)\n by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS\n id 9F9CC19560A7; Tue, 24 Mar 2026 18:56:36 +0000 (UTC)", "from merkur.fritz.box (unknown [10.44.33.246])\n by mx-prod-int-01.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP\n id 836A5300019F; Tue, 24 Mar 2026 18:56:35 +0000 (UTC)" ], "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com;\n s=mimecast20190719; t=1774378601;\n h=from:from:reply-to:subject:subject:date:date:message-id:message-id:\n to:to:cc:cc:mime-version:mime-version:\n content-transfer-encoding:content-transfer-encoding:\n in-reply-to:in-reply-to:references:references;\n bh=gQ8AtBpJCcmriLtHU5b0J/GoC8msMoDc+3xdWz4LnAs=;\n b=BsMAW2zxNX6K1PxevMsy3KldhwgZu8RodYm3bpgrLFfEKCVECTvSjqmTf6V4co9ScqZ9J+\n LhgRjhXmhsLKt6jXzK45TyhGV5MOwYdQcSTaSUPsZqleF8PiLStLQYGS07OggG9gyu1Rca\n kLeQtbnKtze87ynGwskvBTmquO8fxo4=", "X-MC-Unique": "hEldPXqcPW2B0JOxpvPiOw-1", "X-Mimecast-MFC-AGG-ID": "hEldPXqcPW2B0JOxpvPiOw_1774378596", "From": "Kevin Wolf <kwolf@redhat.com>", "To": "qemu-block@nongnu.org", "Cc": "kwolf@redhat.com,\n\tqemu-devel@nongnu.org", "Subject": "[PULL 3/4] linux-aio: Resubmit tails of short reads/writes", "Date": "Tue, 24 Mar 2026 19:56:18 +0100", "Message-ID": "<20260324185619.296946-4-kwolf@redhat.com>", "In-Reply-To": "<20260324185619.296946-1-kwolf@redhat.com>", "References": "<20260324185619.296946-1-kwolf@redhat.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "X-Scanned-By": "MIMEDefang 3.4.1 on 10.30.177.4", "Received-SPF": "pass client-ip=170.10.129.124; envelope-from=kwolf@redhat.com;\n helo=us-smtp-delivery-124.mimecast.com", "X-Spam_score_int": "-20", "X-Spam_score": "-2.1", "X-Spam_bar": "--", "X-Spam_report": "(-2.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.001,\n DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1,\n RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H3=0.001, RCVD_IN_MSPIKE_WL=0.001,\n RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001,\n RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001,\n SPF_HELO_PASS=-0.001,\n SPF_PASS=-0.001 autolearn=unavailable autolearn_force=no", "X-Spam_action": "no action", "X-BeenThere": "qemu-devel@nongnu.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "qemu development <qemu-devel.nongnu.org>", "List-Unsubscribe": "<https://lists.nongnu.org/mailman/options/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=unsubscribe>", "List-Archive": "<https://lists.nongnu.org/archive/html/qemu-devel>", "List-Post": "<mailto:qemu-devel@nongnu.org>", "List-Help": "<mailto:qemu-devel-request@nongnu.org?subject=help>", "List-Subscribe": "<https://lists.nongnu.org/mailman/listinfo/qemu-devel>,\n <mailto:qemu-devel-request@nongnu.org?subject=subscribe>", "Errors-To": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org", "Sender": "qemu-devel-bounces+incoming=patchwork.ozlabs.org@nongnu.org" }, "content": "From: Hanna Czenczek <hreitz@redhat.com>\n\nShort reads/writes can happen. One way to reproduce them is via our\nFUSE export, with the following diff applied (%s/escaped // to apply --\nif you put plain diffs in commit messages, git-am will apply them, and I\nwould rather avoid breaking FUSE accidentally via this patch):\n\nescaped diff --git a/block/export/fuse.c b/block/export/fuse.c\nescaped index a2a478d293..67dc50a412 100644\nescaped --- a/block/export/fuse.c\nescaped +++ b/block/export/fuse.c\n@@ -828,7 +828,7 @@ static ssize_t coroutine_fn GRAPH_RDLOCK\n fuse_co_init(FuseExport *exp, struct fuse_init_out *out,\n const struct fuse_init_in_compat *in)\n {\n- const uint32_t supported_flags = FUSE_ASYNC_READ | FUSE_ASYNC_DIO;\n+ const uint32_t supported_flags = FUSE_ASYNC_READ;\n\n if (in->major != 7) {\n error_report(\"FUSE major version mismatch: We have 7, but kernel has %\"\n@@ -1060,6 +1060,8 @@ fuse_co_read(FuseExport *exp, void **bufptr, uint64_t offset, uint32_t size)\n void *buf;\n int ret;\n\n+ size = MIN(size, 4096);\n+\n /* Limited by max_read, should not happen */\n if (size > FUSE_MAX_READ_BYTES) {\n return -EINVAL;\n@@ -1110,6 +1112,8 @@ fuse_co_write(FuseExport *exp, struct fuse_write_out *out,\n int64_t blk_len;\n int ret;\n\n+ size = MIN(size, 4096);\n+\n QEMU_BUILD_BUG_ON(FUSE_MAX_WRITE_BYTES > BDRV_REQUEST_MAX_BYTES);\n /* Limited by max_write, should not happen */\n if (size > FUSE_MAX_WRITE_BYTES) {\n\nThen:\n$ ./qemu-img create -f raw test.raw 8k\nFormatting 'test.raw', fmt=raw size=8192\n$ ./qemu-io -f raw -c 'write -P 42 0 8k' test.raw\nwrote 8192/8192 bytes at offset 0\n8 KiB, 1 ops; 00.00 sec (64.804 MiB/sec and 8294.9003 ops/sec)\n$ hexdump -C test.raw\n00000000 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a |****************|\n*\n00002000\n\nWith aio=threads, short I/O works:\n$ storage-daemon/qemu-storage-daemon \\\n --blockdev file,node-name=test,filename=test.raw \\\n --export fuse,id=exp,node-name=test,mountpoint=test.raw,writable=true\n\nOther shell:\n$ ./qemu-io --image-opts -c 'read -P 42 0 8k' \\\n driver=file,filename=test.raw,cache.direct=on,aio=threads\nread 8192/8192 bytes at offset 0\n8 KiB, 1 ops; 00.00 sec (36.563 MiB/sec and 4680.0923 ops/sec)\n$ ./qemu-io --image-opts -c 'write -P 23 0 8k' \\\n driver=file,filename=test.raw,cache.direct=on,aio=threads\nwrote 8192/8192 bytes at offset 0\n8 KiB, 1 ops; 00.00 sec (35.995 MiB/sec and 4607.2970 ops/sec)\n$ hexdump -C test.raw\n00000000 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 |................|\n*\n00002000\n\nBut with aio=native, it does not:\n$ ./qemu-io --image-opts -c 'read -P 23 0 8k' \\\n driver=file,filename=test.raw,cache.direct=on,aio=native\nPattern verification failed at offset 0, 8192 bytes\nread 8192/8192 bytes at offset 0\n8 KiB, 1 ops; 00.00 sec (86.155 MiB/sec and 11027.7900 ops/sec)\n$ ./qemu-io --image-opts -c 'write -P 42 0 8k' \\\n driver=file,filename=test.raw,cache.direct=on,aio=native\nwrite failed: No space left on device\n$ hexdump -C test.raw\n00000000 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a 2a |****************|\n*\n00001000 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 17 |................|\n*\n00002000\n\nThis patch fixes that.\n\nReviewed-by: Kevin Wolf <kwolf@redhat.com>\nSigned-off-by: Hanna Czenczek <hreitz@redhat.com>\nMessage-ID: <20260324084338.37453-3-hreitz@redhat.com>\nSigned-off-by: Kevin Wolf <kwolf@redhat.com>\n---\n block/linux-aio.c | 56 ++++++++++++++++++++++++++++++++++++++++++-----\n 1 file changed, 50 insertions(+), 6 deletions(-)", "diff": "diff --git a/block/linux-aio.c b/block/linux-aio.c\nindex 3843f45eac8..0a7424fbb33 100644\n--- a/block/linux-aio.c\n+++ b/block/linux-aio.c\n@@ -45,6 +45,10 @@ struct qemu_laiocb {\n size_t nbytes;\n QEMUIOVector *qiov;\n \n+ /* For handling short reads/writes */\n+ size_t total_done;\n+ QEMUIOVector resubmit_qiov;\n+\n int fd;\n int type;\n BdrvRequestFlags flags;\n@@ -74,28 +78,61 @@ struct LinuxAioState {\n };\n \n static void ioq_submit(LinuxAioState *s);\n+static int laio_do_submit(struct qemu_laiocb *laiocb);\n \n static inline ssize_t io_event_ret(struct io_event *ev)\n {\n return (ssize_t)(((uint64_t)ev->res2 << 32) | ev->res);\n }\n \n+/**\n+ * Retry tail of short requests.\n+ */\n+static int laio_resubmit_short_io(struct qemu_laiocb *laiocb, size_t done)\n+{\n+ QEMUIOVector *resubmit_qiov = &laiocb->resubmit_qiov;\n+\n+ laiocb->total_done += done;\n+\n+ if (!resubmit_qiov->iov) {\n+ qemu_iovec_init(resubmit_qiov, laiocb->qiov->niov);\n+ } else {\n+ qemu_iovec_reset(resubmit_qiov);\n+ }\n+ qemu_iovec_concat(resubmit_qiov, laiocb->qiov,\n+ laiocb->total_done, laiocb->nbytes - laiocb->total_done);\n+\n+ return laio_do_submit(laiocb);\n+}\n+\n /*\n * Completes an AIO request.\n */\n static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)\n {\n- int ret;\n+ ssize_t ret;\n \n ret = laiocb->ret;\n if (ret != -ECANCELED) {\n- if (ret == laiocb->nbytes) {\n+ if (ret == laiocb->nbytes - laiocb->total_done) {\n ret = 0;\n+ } else if (ret > 0 && (laiocb->type == QEMU_AIO_READ ||\n+ laiocb->type == QEMU_AIO_WRITE)) {\n+ ret = laio_resubmit_short_io(laiocb, ret);\n+ if (!ret) {\n+ return;\n+ }\n } else if (ret >= 0) {\n- /* Short reads mean EOF, pad with zeros. */\n+ /*\n+ * For normal reads and writes, we only get here if ret == 0, which\n+ * means EOF for reads and ENOSPC for writes.\n+ * For zone-append, we get here with any ret >= 0, which we just\n+ * treat as ENOSPC, too (safer than resubmitting, probably, but not\n+ * 100 % clear).\n+ */\n if (laiocb->type == QEMU_AIO_READ) {\n- qemu_iovec_memset(laiocb->qiov, ret, 0,\n- laiocb->qiov->size - ret);\n+ qemu_iovec_memset(laiocb->qiov, laiocb->total_done, 0,\n+ laiocb->qiov->size - laiocb->total_done);\n } else {\n ret = -ENOSPC;\n }\n@@ -103,6 +140,9 @@ static void qemu_laio_process_completion(struct qemu_laiocb *laiocb)\n }\n \n laiocb->ret = ret;\n+ if (laiocb->resubmit_qiov.iov) {\n+ qemu_iovec_destroy(&laiocb->resubmit_qiov);\n+ }\n \n /*\n * If the coroutine is already entered it must be in ioq_submit() and\n@@ -379,7 +419,11 @@ static int laio_do_submit(struct qemu_laiocb *laiocb)\n struct iocb *iocbs = &laiocb->iocb;\n QEMUIOVector *qiov = laiocb->qiov;\n int fd = laiocb->fd;\n- off_t offset = laiocb->offset;\n+ off_t offset = laiocb->offset + laiocb->total_done;\n+\n+ if (laiocb->resubmit_qiov.iov) {\n+ qiov = &laiocb->resubmit_qiov;\n+ }\n \n switch (laiocb->type) {\n case QEMU_AIO_WRITE:\n", "prefixes": [ "PULL", "3/4" ] }