diff --git a/block/graph-lock.c b/block/graph-lock.c index b7319473a1..f2501d75fb 100644 --- a/block/graph-lock.c +++ b/block/graph-lock.c @@ -278,14 +278,12 @@ void coroutine_fn bdrv_graph_co_rdunlock(void) smp_mb(); /* - * has_writer == 0: this means reader will read reader_count decreased - * has_writer == 1: we don't know if writer read reader_count old or - * new. Therefore, kick again so on next iteration - * writer will for sure read the updated value. + * Always kick: bdrv_graph_wrlock() zeroes has_writer while polling (to + * let callbacks take the reader lock via the fast path), so we cannot + * rely on has_writer to detect a waiting writer. aio_wait_kick() is a + * no-op when no one is waiting, so it is cheap in the common case. */ - if (qatomic_read(&has_writer)) { - aio_wait_kick(); - } + aio_wait_kick(); } void bdrv_graph_rdlock_main_loop(void)