From nobody Wed Nov 5 18:30:56 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536772406475324.4895521690944; Wed, 12 Sep 2018 10:13:26 -0700 (PDT) Received: from localhost ([::1]:37336 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g08hh-0005wo-6K for importer@patchew.org; Wed, 12 Sep 2018 13:13:25 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g08fF-0004Rr-DN for qemu-devel@nongnu.org; Wed, 12 Sep 2018 13:10:54 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g08fE-0006pX-BQ for qemu-devel@nongnu.org; Wed, 12 Sep 2018 13:10:53 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:35446 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g08fC-0006nv-67; Wed, 12 Sep 2018 13:10:50 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id C9861804B9F4; Wed, 12 Sep 2018 17:10:49 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.118.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id E1F2FA9A06; Wed, 12 Sep 2018 17:10:47 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Sep 2018 19:10:38 +0200 Message-Id: <20180912171040.1732-2-pbonzini@redhat.com> In-Reply-To: <20180912171040.1732-1-pbonzini@redhat.com> References: <20180912171040.1732-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 12 Sep 2018 17:10:49 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.8]); Wed, 12 Sep 2018 17:10:49 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pbonzini@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 1/3] aio-posix: fix concurrent access to poll_disable_cnt X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, famz@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" It is valid for an aio_set_fd_handler to happen concurrently with aio_poll. In that case, poll_disable_cnt can change under the heels of aio_poll, and the assertion on poll_disable_cnt can fail in run_poll_handlers. Therefore, this patch simply checks the counter on every polling iteration. There are no particular needs for ordering, since the polling loop is terminated anyway by aio_notify at the end of aio_set_fd_handler. Signed-off-by: Paolo Bonzini Reviewed-by: Fam Zheng --- util/aio-posix.c | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/util/aio-posix.c b/util/aio-posix.c index 131ba6b4a8..5c29380575 100644 --- a/util/aio-posix.c +++ b/util/aio-posix.c @@ -211,6 +211,7 @@ void aio_set_fd_handler(AioContext *ctx, AioHandler *node; bool is_new =3D false; bool deleted =3D false; + int poll_disable_change; =20 qemu_lockcnt_lock(&ctx->list_lock); =20 @@ -244,11 +245,9 @@ void aio_set_fd_handler(AioContext *ctx, QLIST_REMOVE(node, node); deleted =3D true; } - - if (!node->io_poll) { - ctx->poll_disable_cnt--; - } + poll_disable_change =3D -!node->io_poll; } else { + poll_disable_change =3D !io_poll - (node && !node->io_poll); if (node =3D=3D NULL) { /* Alloc and insert if it's not already there */ node =3D g_new0(AioHandler, 1); @@ -257,10 +256,6 @@ void aio_set_fd_handler(AioContext *ctx, =20 g_source_add_poll(&ctx->source, &node->pfd); is_new =3D true; - - ctx->poll_disable_cnt +=3D !io_poll; - } else { - ctx->poll_disable_cnt +=3D !io_poll - !node->io_poll; } =20 /* Update handler with latest information */ @@ -274,6 +269,15 @@ void aio_set_fd_handler(AioContext *ctx, node->pfd.events |=3D (io_write ? G_IO_OUT | G_IO_ERR : 0); } =20 + /* No need to order poll_disable_cnt writes against other updates; + * the counter is only used to avoid wasting time and latency on + * iterated polling when the system call will be ultimately necessary. + * Changing handlers is a rare event, and a little wasted polling until + * the aio_notify below is not an issue. + */ + atomic_set(&ctx->poll_disable_cnt, + atomic_read(&ctx->poll_disable_cnt) + poll_disable_change); + aio_epoll_update(ctx, node, is_new); qemu_lockcnt_unlock(&ctx->list_lock); aio_notify(ctx); @@ -525,7 +529,6 @@ static bool run_poll_handlers(AioContext *ctx, int64_t = max_ns) =20 assert(ctx->notify_me); assert(qemu_lockcnt_count(&ctx->list_lock) > 0); - assert(ctx->poll_disable_cnt =3D=3D 0); =20 trace_run_poll_handlers_begin(ctx, max_ns); =20 @@ -533,7 +536,8 @@ static bool run_poll_handlers(AioContext *ctx, int64_t = max_ns) =20 do { progress =3D run_poll_handlers_once(ctx); - } while (!progress && qemu_clock_get_ns(QEMU_CLOCK_REALTIME) < end_tim= e); + } while (!progress && qemu_clock_get_ns(QEMU_CLOCK_REALTIME) < end_time + && !atomic_read(&ctx->poll_disable_cnt)); =20 trace_run_poll_handlers_end(ctx, progress); =20 @@ -552,7 +556,7 @@ static bool run_poll_handlers(AioContext *ctx, int64_t = max_ns) */ static bool try_poll_mode(AioContext *ctx, bool blocking) { - if (blocking && ctx->poll_max_ns && ctx->poll_disable_cnt =3D=3D 0) { + if (blocking && ctx->poll_max_ns && !atomic_read(&ctx->poll_disable_cn= t)) { /* See qemu_soonest_timeout() uint64_t hack */ int64_t max_ns =3D MIN((uint64_t)aio_compute_timeout(ctx), (uint64_t)ctx->poll_ns); --=20 2.17.1 From nobody Wed Nov 5 18:30:56 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1536772528396225.0767245220909; Wed, 12 Sep 2018 10:15:28 -0700 (PDT) Received: from localhost ([::1]:37361 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g08je-0007cM-Tl for importer@patchew.org; Wed, 12 Sep 2018 13:15:26 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33557) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g08fH-0004Ts-Qe for qemu-devel@nongnu.org; Wed, 12 Sep 2018 13:10:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g08fG-0006rN-Jb for qemu-devel@nongnu.org; Wed, 12 Sep 2018 13:10:55 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:52784 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g08fE-0006p3-2t; Wed, 12 Sep 2018 13:10:52 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id A13E185769; Wed, 12 Sep 2018 17:10:51 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.118.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id 6989463532; Wed, 12 Sep 2018 17:10:50 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Sep 2018 19:10:39 +0200 Message-Id: <20180912171040.1732-3-pbonzini@redhat.com> In-Reply-To: <20180912171040.1732-1-pbonzini@redhat.com> References: <20180912171040.1732-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 12 Sep 2018 17:10:51 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.2]); Wed, 12 Sep 2018 17:10:51 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pbonzini@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 2/3] aio-posix: compute timeout before polling X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, famz@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_0 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" This is a preparation for the next patch, and also a very small optimization. Compute the timeout only once, before invoking try_poll_mode, and adjust it in run_poll_handlers. The adjustment is the polling time when polling fails, or zero (non-blocking) if polling succeeds. Fixes: 70232b5253a3c4e03ed1ac47ef9246a8ac66c6fa Signed-off-by: Paolo Bonzini Reviewed-by: Fam Zheng --- util/aio-posix.c | 59 +++++++++++++++++++++++++++-------------------- util/trace-events | 4 ++-- 2 files changed, 36 insertions(+), 27 deletions(-) diff --git a/util/aio-posix.c b/util/aio-posix.c index 5c29380575..21d8987179 100644 --- a/util/aio-posix.c +++ b/util/aio-posix.c @@ -490,7 +490,7 @@ static void add_pollfd(AioHandler *node) npfd++; } =20 -static bool run_poll_handlers_once(AioContext *ctx) +static bool run_poll_handlers_once(AioContext *ctx, int64_t *timeout) { bool progress =3D false; AioHandler *node; @@ -500,6 +500,7 @@ static bool run_poll_handlers_once(AioContext *ctx) aio_node_check(ctx, node->is_external) && node->io_poll(node->opaque) && node->opaque !=3D &ctx->notifier) { + *timeout =3D 0; progress =3D true; } =20 @@ -522,31 +523,38 @@ static bool run_poll_handlers_once(AioContext *ctx) * * Returns: true if progress was made, false otherwise */ -static bool run_poll_handlers(AioContext *ctx, int64_t max_ns) +static bool run_poll_handlers(AioContext *ctx, int64_t max_ns, int64_t *ti= meout) { bool progress; - int64_t end_time; + int64_t start_time, elapsed_time; =20 assert(ctx->notify_me); assert(qemu_lockcnt_count(&ctx->list_lock) > 0); =20 - trace_run_poll_handlers_begin(ctx, max_ns); - - end_time =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME) + max_ns; + trace_run_poll_handlers_begin(ctx, max_ns, *timeout); =20 + start_time =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME); do { - progress =3D run_poll_handlers_once(ctx); - } while (!progress && qemu_clock_get_ns(QEMU_CLOCK_REALTIME) < end_time + progress =3D run_poll_handlers_once(ctx, timeout); + elapsed_time =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME) - start_ti= me; + } while (!progress && elapsed_time < max_ns && !atomic_read(&ctx->poll_disable_cnt)); =20 - trace_run_poll_handlers_end(ctx, progress); + /* If time has passed with no successful polling, adjust *timeout to + * keep the same ending time. + */ + if (*timeout !=3D -1) { + *timeout -=3D MIN(*timeout, elapsed_time); + } =20 + trace_run_poll_handlers_end(ctx, progress, *timeout); return progress; } =20 /* try_poll_mode: * @ctx: the AioContext - * @blocking: busy polling is only attempted when blocking is true + * @timeout: timeout for blocking wait, computed by the caller and updated= if + * polling succeeds. * * ctx->notify_me must be non-zero so this function can detect aio_notify(= ). * @@ -554,19 +562,16 @@ static bool run_poll_handlers(AioContext *ctx, int64_= t max_ns) * * Returns: true if progress was made, false otherwise */ -static bool try_poll_mode(AioContext *ctx, bool blocking) +static bool try_poll_mode(AioContext *ctx, int64_t *timeout) { - if (blocking && ctx->poll_max_ns && !atomic_read(&ctx->poll_disable_cn= t)) { - /* See qemu_soonest_timeout() uint64_t hack */ - int64_t max_ns =3D MIN((uint64_t)aio_compute_timeout(ctx), - (uint64_t)ctx->poll_ns); + /* See qemu_soonest_timeout() uint64_t hack */ + int64_t max_ns =3D MIN((uint64_t)*timeout, (uint64_t)ctx->poll_ns); =20 - if (max_ns) { - poll_set_started(ctx, true); + if (max_ns && !atomic_read(&ctx->poll_disable_cnt)) { + poll_set_started(ctx, true); =20 - if (run_poll_handlers(ctx, max_ns)) { - return true; - } + if (run_poll_handlers(ctx, max_ns, timeout)) { + return true; } } =20 @@ -575,7 +580,7 @@ static bool try_poll_mode(AioContext *ctx, bool blockin= g) /* Even if we don't run busy polling, try polling once in case it can = make * progress and the caller will be able to avoid ppoll(2)/epoll_wait(2= ). */ - return run_poll_handlers_once(ctx); + return run_poll_handlers_once(ctx, timeout); } =20 bool aio_poll(AioContext *ctx, bool blocking) @@ -605,8 +610,14 @@ bool aio_poll(AioContext *ctx, bool blocking) start =3D qemu_clock_get_ns(QEMU_CLOCK_REALTIME); } =20 - progress =3D try_poll_mode(ctx, blocking); - if (!progress) { + timeout =3D blocking ? aio_compute_timeout(ctx) : 0; + progress =3D try_poll_mode(ctx, &timeout); + assert(!(timeout && progress)); + + /* If polling is allowed, non-blocking aio_poll does not need the + * system call---a single round of run_poll_handlers_once suffices. + */ + if (timeout || atomic_read(&ctx->poll_disable_cnt)) { assert(npfd =3D=3D 0); =20 /* fill pollfds */ @@ -620,8 +631,6 @@ bool aio_poll(AioContext *ctx, bool blocking) } } =20 - timeout =3D blocking ? aio_compute_timeout(ctx) : 0; - /* wait until next event */ if (aio_epoll_check_poll(ctx, pollfds, npfd, timeout)) { AioHandler epoll_handler; diff --git a/util/trace-events b/util/trace-events index 4822434c89..79569b7fdf 100644 --- a/util/trace-events +++ b/util/trace-events @@ -1,8 +1,8 @@ # See docs/devel/tracing.txt for syntax documentation. =20 # util/aio-posix.c -run_poll_handlers_begin(void *ctx, int64_t max_ns) "ctx %p max_ns %"PRId64 -run_poll_handlers_end(void *ctx, bool progress) "ctx %p progress %d" +run_poll_handlers_begin(void *ctx, int64_t max_ns, int64_t timeout) "ctx %= p max_ns %"PRId64 " timeout %"PRId64 +run_poll_handlers_end(void *ctx, bool progress, int64_t timeout) "ctx %p p= rogress %d new timeout %"PRId64 poll_shrink(void *ctx, int64_t old, int64_t new) "ctx %p old %"PRId64" new= %"PRId64 poll_grow(void *ctx, int64_t old, int64_t new) "ctx %p old %"PRId64" new %= "PRId64 =20 --=20 2.17.1 From nobody Wed Nov 5 18:30:56 2025 Delivered-To: importer@patchew.org Received-SPF: temperror (zoho.com: Error in retrieving data from DNS) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; spf=temperror (zoho.com: Error in retrieving data from DNS) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=fail(p=none dis=none) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 153677240319694.0045329586967; Wed, 12 Sep 2018 10:13:23 -0700 (PDT) Received: from localhost ([::1]:37334 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g08he-0005rM-1D for importer@patchew.org; Wed, 12 Sep 2018 13:13:22 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:33559) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1g08fH-0004Tw-RQ for qemu-devel@nongnu.org; Wed, 12 Sep 2018 13:10:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1g08fH-0006rf-2v for qemu-devel@nongnu.org; Wed, 12 Sep 2018 13:10:55 -0400 Received: from mx3-rdu2.redhat.com ([66.187.233.73]:46804 helo=mx1.redhat.com) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1g08fF-0006qB-Ct; Wed, 12 Sep 2018 13:10:53 -0400 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.rdu2.redhat.com [10.11.54.5]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id EE139401CDA7; Wed, 12 Sep 2018 17:10:52 +0000 (UTC) Received: from donizetti.redhat.com (unknown [10.36.118.61]) by smtp.corp.redhat.com (Postfix) with ESMTP id F3C80A9A06; Wed, 12 Sep 2018 17:10:51 +0000 (UTC) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Wed, 12 Sep 2018 19:10:40 +0200 Message-Id: <20180912171040.1732-4-pbonzini@redhat.com> In-Reply-To: <20180912171040.1732-1-pbonzini@redhat.com> References: <20180912171040.1732-1-pbonzini@redhat.com> X-Scanned-By: MIMEDefang 2.79 on 10.11.54.5 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 12 Sep 2018 17:10:52 +0000 (UTC) X-Greylist: inspected by milter-greylist-4.5.16 (mx1.redhat.com [10.11.55.5]); Wed, 12 Sep 2018 17:10:52 +0000 (UTC) for IP:'10.11.54.5' DOMAIN:'int-mx05.intmail.prod.int.rdu2.redhat.com' HELO:'smtp.corp.redhat.com' FROM:'pbonzini@redhat.com' RCPT:'' X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.2.x-3.x [generic] X-Received-From: 66.187.233.73 Subject: [Qemu-devel] [PATCH 3/3] aio-posix: do skip system call if ctx->notifier polling succeeds X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: kwolf@redhat.com, famz@redhat.com, stefanha@redhat.com, qemu-block@nongnu.org Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail: RDMRC_1 RSF_6 Z_629925259 SPT_0 Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Commit 70232b5253 ("aio-posix: Don't count ctx->notifier as progress when 2018-08-15), by not reporting progress, causes aio_poll to execute the system call when polling succeeds because of ctx->notifier. This introduces latency before the call to aio_bh_poll() and negates the advantages of polling, unfortunately. The fix builds on the previous patch, separating the effect of polling on the timeout from the progress reported to aio_poll(). ctx->notifier does zero the timeout, causing the caller to skip the system call, but it does not report progress, so that the bug fix of commit 70232b5253 still stands. Fixes: 70232b5253a3c4e03ed1ac47ef9246a8ac66c6fa Signed-off-by: Paolo Bonzini Reviewed-by: Fam Zheng --- util/aio-posix.c | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/util/aio-posix.c b/util/aio-posix.c index 21d8987179..efa79b9e62 100644 --- a/util/aio-posix.c +++ b/util/aio-posix.c @@ -498,10 +498,11 @@ static bool run_poll_handlers_once(AioContext *ctx, i= nt64_t *timeout) QLIST_FOREACH_RCU(node, &ctx->aio_handlers, node) { if (!node->deleted && node->io_poll && aio_node_check(ctx, node->is_external) && - node->io_poll(node->opaque) && - node->opaque !=3D &ctx->notifier) { + node->io_poll(node->opaque)) { *timeout =3D 0; - progress =3D true; + if (node->opaque !=3D &ctx->notifier) { + progress =3D true; + } } =20 /* Caller handles freeing deleted nodes. Don't do it here. */ --=20 2.17.1