qemu-block
[Top][All Lists]
Advanced

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

[Qemu-block] aio context ownership during bdrv_close()


From: Anton Kuchin
Subject: [Qemu-block] aio context ownership during bdrv_close()
Date: Fri, 26 Apr 2019 15:24:15 +0300
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.1

I can't figure out ownership of aio context during bdrv_close().

As far as I understand bdrv_unref() shold be called with acquired aio context to prevent concurrent operations (at least most usages in blockdev.c explicitly acquire and release context, but not all).

But if refcount reaches zero and bs is going to be deleted in bdrv_close() we need to ensure that drain is finished data is flushed and there are no more pending coroutines and bottomhalves, so drain and flush functions can enter coroutine and perform yield in several places. As a result control returns to coroutine caller that will release aio context and when completion bh will continue cleanup process it will be executed without ownership of context. Is this a valid situation?

Moreover if yield happens bs that is being deleted has zero refcount but is still present in lists graph_bdrv_states and all_bdrv_states and can be accidentally accessed. Shouldn't we remove it from these lists ASAP when deletion process starts as we do from monitor_bdrv_states?





reply via email to

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