thebeanogamer / rpms / qemu-kvm

Forked from rpms/qemu-kvm 6 months ago
Clone

Blame SOURCES/kvm-linux-aio-fix-unbalanced-plugged-counter-in-laio_io_.patch

29b115
From e7326c3a7e0fc022aa5c0ae07bc1e19ad1b6f2ed Mon Sep 17 00:00:00 2001
29b115
From: Stefan Hajnoczi <stefanha@redhat.com>
29b115
Date: Thu, 9 Jun 2022 17:47:11 +0100
29b115
Subject: [PATCH 5/6] linux-aio: fix unbalanced plugged counter in
29b115
 laio_io_unplug()
29b115
29b115
RH-Author: Stefan Hajnoczi <stefanha@redhat.com>
29b115
RH-MergeRequest: 102: linux-aio: fix unbalanced plugged counter in laio_io_unplug()
29b115
RH-Commit: [1/2] 8a71da371c72521f1d70b8767ee564575e0d522b (stefanha/centos-stream-qemu-kvm)
29b115
RH-Bugzilla: 2092788
29b115
RH-Acked-by: Miroslav Rezanina <mrezanin@redhat.com>
29b115
RH-Acked-by: Kevin Wolf <kwolf@redhat.com>
29b115
RH-Acked-by: Stefano Garzarella <sgarzare@redhat.com>
29b115
29b115
Every laio_io_plug() call has a matching laio_io_unplug() call. There is
29b115
a plugged counter that tracks the number of levels of plugging and
29b115
allows for nesting.
29b115
29b115
The plugged counter must reflect the balance between laio_io_plug() and
29b115
laio_io_unplug() calls accurately. Otherwise I/O stalls occur since
29b115
io_submit(2) calls are skipped while plugged.
29b115
29b115
Reported-by: Nikolay Tenev <nt@storpool.com>
29b115
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
29b115
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
29b115
Message-id: 20220609164712.1539045-2-stefanha@redhat.com
29b115
Cc: Stefano Garzarella <sgarzare@redhat.com>
29b115
Fixes: 68d7946648 ("linux-aio: add `dev_max_batch` parameter to laio_io_unplug()")
29b115
[Stefano Garzarella suggested adding a Fixes tag.
29b115
--Stefan]
29b115
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
29b115
(cherry picked from commit f387cac5af030a58ac5a0dacf64cab5e5a4fe5c7)
29b115
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
29b115
---
29b115
 block/linux-aio.c | 4 +++-
29b115
 1 file changed, 3 insertions(+), 1 deletion(-)
29b115
29b115
diff --git a/block/linux-aio.c b/block/linux-aio.c
29b115
index 4c423fcccf..6078da7e42 100644
29b115
--- a/block/linux-aio.c
29b115
+++ b/block/linux-aio.c
29b115
@@ -363,8 +363,10 @@ void laio_io_unplug(BlockDriverState *bs, LinuxAioState *s,
29b115
                     uint64_t dev_max_batch)
29b115
 {
29b115
     assert(s->io_q.plugged);
29b115
+    s->io_q.plugged--;
29b115
+
29b115
     if (s->io_q.in_queue >= laio_max_batch(s, dev_max_batch) ||
29b115
-        (--s->io_q.plugged == 0 &&
29b115
+        (!s->io_q.plugged &&
29b115
          !s->io_q.blocked && !QSIMPLEQ_EMPTY(&s->io_q.pending))) {
29b115
         ioq_submit(s);
29b115
     }
29b115
-- 
29b115
2.31.1
29b115