Clear QEMU eventfd handler on vitastor block driver destruction

This commit is contained in:
Vitaliy Filippov
2025-03-21 20:47:17 +03:00
parent be22c363ca
commit 5030396f71
+16
View File
@@ -568,6 +568,22 @@ static int vitastor_file_open(BlockDriverState *bs, QDict *options, int flags, E
static void vitastor_close(BlockDriverState *bs)
{
VitastorClient *client = bs->opaque;
if (client->uring_eventfd >= 0)
{
// clear the eventfd handler
universal_aio_set_fd_handler(client->ctx, client->uring_eventfd, NULL, NULL, NULL);
int wait_bh = 0;
qemu_mutex_lock(&client->mutex);
// clear uring_eventfd itself to prevent future scheduling of new B/H
client->uring_eventfd = -1;
wait_bh = client->bh_uring_scheduled;
qemu_mutex_unlock(&client->mutex);
if (wait_bh)
{
// wait until existing scheduled B/H is ran
BDRV_POLL_WHILE(bs, client->bh_uring_scheduled);
}
}
vitastor_c_destroy(client->proxy);
if (client->fds)
{