]> git.proxmox.com Git - pve-qemu.git/blame - debian/patches/pve/0009-PVE-Up-glusterfs-allow-partial-reads.patch
bump version to 6.0.0-3
[pve-qemu.git] / debian / patches / pve / 0009-PVE-Up-glusterfs-allow-partial-reads.patch
CommitLineData
23102ed6 1From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
95259824 2From: Wolfgang Bumiller <w.bumiller@proxmox.com>
83faa3fe
TL
3Date: Mon, 6 Apr 2020 12:16:38 +0200
4Subject: [PATCH] PVE: [Up] glusterfs: allow partial reads
95259824
WB
5
6This should deal with qemu bug #1644754 until upstream
7decides which way to go. The general direction seems to be
8away from sector based block APIs and with that in mind, and
9when comparing to other network block backends (eg. nfs)
10treating partial reads as errors doesn't seem to make much
11sense.
b855dce7
TL
12
13Signed-off-by: Thomas Lamprecht <t.lamprecht@proxmox.com>
95259824
WB
14---
15 block/gluster.c | 10 +++++++++-
16 1 file changed, 9 insertions(+), 1 deletion(-)
17
18diff --git a/block/gluster.c b/block/gluster.c
8dca018b 19index 3eb6a05500..b612918ee8 100644
95259824
WB
20--- a/block/gluster.c
21+++ b/block/gluster.c
be901f66 22@@ -57,6 +57,7 @@ typedef struct GlusterAIOCB {
a544966d 23 int ret;
95259824
WB
24 Coroutine *coroutine;
25 AioContext *aio_context;
26+ bool is_write;
27 } GlusterAIOCB;
28
29 typedef struct BDRVGlusterState {
8dca018b 30@@ -752,8 +753,10 @@ static void gluster_finish_aiocb(struct glfs_fd *fd, ssize_t ret,
95259824
WB
31 acb->ret = 0; /* Success */
32 } else if (ret < 0) {
33 acb->ret = -errno; /* Read/Write failed */
34+ } else if (acb->is_write) {
35+ acb->ret = -EIO; /* Partial write - fail it */
36 } else {
37- acb->ret = -EIO; /* Partial read/write - fail it */
38+ acb->ret = 0; /* Success */
39 }
40
a544966d 41 aio_co_schedule(acb->aio_context, acb->coroutine);
8dca018b 42@@ -1021,6 +1024,7 @@ static coroutine_fn int qemu_gluster_co_pwrite_zeroes(BlockDriverState *bs,
95259824
WB
43 acb.ret = 0;
44 acb.coroutine = qemu_coroutine_self();
45 acb.aio_context = bdrv_get_aio_context(bs);
46+ acb.is_write = true;
47
48 ret = glfs_zerofill_async(s->fd, offset, size, gluster_finish_aiocb, &acb);
49 if (ret < 0) {
8dca018b 50@@ -1202,9 +1206,11 @@ static coroutine_fn int qemu_gluster_co_rw(BlockDriverState *bs,
95259824
WB
51 acb.aio_context = bdrv_get_aio_context(bs);
52
53 if (write) {
54+ acb.is_write = true;
55 ret = glfs_pwritev_async(s->fd, qiov->iov, qiov->niov, offset, 0,
56 gluster_finish_aiocb, &acb);
57 } else {
58+ acb.is_write = false;
59 ret = glfs_preadv_async(s->fd, qiov->iov, qiov->niov, offset, 0,
60 gluster_finish_aiocb, &acb);
61 }
8dca018b 62@@ -1268,6 +1274,7 @@ static coroutine_fn int qemu_gluster_co_flush_to_disk(BlockDriverState *bs)
95259824
WB
63 acb.ret = 0;
64 acb.coroutine = qemu_coroutine_self();
65 acb.aio_context = bdrv_get_aio_context(bs);
66+ acb.is_write = true;
67
68 ret = glfs_fsync_async(s->fd, gluster_finish_aiocb, &acb);
69 if (ret < 0) {
8dca018b 70@@ -1314,6 +1321,7 @@ static coroutine_fn int qemu_gluster_co_pdiscard(BlockDriverState *bs,
95259824
WB
71 acb.ret = 0;
72 acb.coroutine = qemu_coroutine_self();
73 acb.aio_context = bdrv_get_aio_context(bs);
74+ acb.is_write = true;
75
76 ret = glfs_discard_async(s->fd, offset, size, gluster_finish_aiocb, &acb);
77 if (ret < 0) {