[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [PATCH 1/2] linux-aio: fix unbalanced plugged counter in laio_io_unp

From: Stefano Garzarella
Subject: Re: [PATCH 1/2] linux-aio: fix unbalanced plugged counter in laio_io_unplug()
Date: Thu, 9 Jun 2022 19:45:44 +0200

On Thu, Jun 09, 2022 at 05:47:11PM +0100, Stefan Hajnoczi wrote:
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.

We can add a Fixes tag:

Fixes: 68d7946648 ("linux-aio: add `dev_max_batch` parameter to 

Reported-by: Nikolay Tenev <nt@storpool.com>
Cc: Stefano Garzarella <sgarzare@redhat.com>
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)
+    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))) {

Thanks for fixing this issue!

Reviewed-by: Stefano Garzarella <sgarzare@redhat.com>

reply via email to

[Prev in Thread] Current Thread [Next in Thread]