[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 17/18] linux-aio: fix unbalanced plugged counter in laio_io_unplug
From: |
Stefan Hajnoczi |
Subject: |
[PULL 17/18] linux-aio: fix unbalanced plugged counter in laio_io_unplug() |
Date: |
Wed, 15 Jun 2022 16:51:28 +0100 |
Every laio_io_plug() call has a matching laio_io_unplug() call. There is
a plugged counter that tracks the number of levels of plugging and
allows for nesting.
The plugged counter must reflect the balance between laio_io_plug() and
laio_io_unplug() calls accurately. Otherwise I/O stalls occur since
io_submit(2) calls are skipped while plugged.
Reported-by: Nikolay Tenev <nt@storpool.com>
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>
Message-id: 20220609164712.1539045-2-stefanha@redhat.com
Cc: Stefano Garzarella <sgarzare@redhat.com>
Fixes: 68d7946648 ("linux-aio: add `dev_max_batch` parameter to
laio_io_unplug()")
[Stefano Garzarella suggested adding a Fixes tag.
--Stefan]
Signed-off-by: Stefan Hajnoczi <stefanha@redhat.com>
---
block/linux-aio.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/block/linux-aio.c b/block/linux-aio.c
index 4c423fcccf..6078da7e42 100644
--- a/block/linux-aio.c
+++ b/block/linux-aio.c
@@ -363,8 +363,10 @@ void laio_io_unplug(BlockDriverState *bs, LinuxAioState *s,
uint64_t dev_max_batch)
{
assert(s->io_q.plugged);
+ s->io_q.plugged--;
+
if (s->io_q.in_queue >= laio_max_batch(s, dev_max_batch) ||
- (--s->io_q.plugged == 0 &&
+ (!s->io_q.plugged &&
!s->io_q.blocked && !QSIMPLEQ_EMPTY(&s->io_q.pending))) {
ioq_submit(s);
}
--
2.36.1
- [PULL 05/18] remote/machine: add vfio-user property, (continued)
- [PULL 05/18] remote/machine: add vfio-user property, Stefan Hajnoczi, 2022/06/15
- [PULL 07/18] vfio-user: define vfio-user-server object, Stefan Hajnoczi, 2022/06/15
- [PULL 06/18] vfio-user: build library, Stefan Hajnoczi, 2022/06/15
- [PULL 08/18] vfio-user: instantiate vfio-user context, Stefan Hajnoczi, 2022/06/15
- [PULL 10/18] vfio-user: run vfio-user context, Stefan Hajnoczi, 2022/06/15
- [PULL 09/18] vfio-user: find and init PCI device, Stefan Hajnoczi, 2022/06/15
- [PULL 12/18] vfio-user: IOMMU support for remote device, Stefan Hajnoczi, 2022/06/15
- [PULL 13/18] vfio-user: handle DMA mappings, Stefan Hajnoczi, 2022/06/15
- [PULL 11/18] vfio-user: handle PCI config space accesses, Stefan Hajnoczi, 2022/06/15
- [PULL 14/18] vfio-user: handle PCI BAR accesses, Stefan Hajnoczi, 2022/06/15
- [PULL 17/18] linux-aio: fix unbalanced plugged counter in laio_io_unplug(),
Stefan Hajnoczi <=
- [PULL 15/18] vfio-user: handle device interrupts, Stefan Hajnoczi, 2022/06/15
- [PULL 16/18] vfio-user: handle reset of remote device, Stefan Hajnoczi, 2022/06/15
- [PULL 18/18] linux-aio: explain why max batch is checked in laio_io_unplug(), Stefan Hajnoczi, 2022/06/15