|
@@ -726,10 +726,8 @@ nfs_get_allocated_file_size_cb(int ret, struct nfs_context *nfs, void *data,
|
|
if (task->ret < 0) {
|
|
if (task->ret < 0) {
|
|
error_report("NFS Error: %s", nfs_get_error(nfs));
|
|
error_report("NFS Error: %s", nfs_get_error(nfs));
|
|
}
|
|
}
|
|
-
|
|
|
|
- /* Set task->complete before reading bs->wakeup. */
|
|
|
|
- qatomic_mb_set(&task->complete, 1);
|
|
|
|
- bdrv_wakeup(task->bs);
|
|
|
|
|
|
+ replay_bh_schedule_oneshot_event(task->client->aio_context,
|
|
|
|
+ nfs_co_generic_bh_cb, task);
|
|
}
|
|
}
|
|
|
|
|
|
static int64_t coroutine_fn nfs_co_get_allocated_file_size(BlockDriverState *bs)
|
|
static int64_t coroutine_fn nfs_co_get_allocated_file_size(BlockDriverState *bs)
|
|
@@ -743,15 +741,19 @@ static int64_t coroutine_fn nfs_co_get_allocated_file_size(BlockDriverState *bs)
|
|
return client->st_blocks * 512;
|
|
return client->st_blocks * 512;
|
|
}
|
|
}
|
|
|
|
|
|
- task.bs = bs;
|
|
|
|
|
|
+ nfs_co_init_task(bs, &task);
|
|
task.st = &st;
|
|
task.st = &st;
|
|
- if (nfs_fstat_async(client->context, client->fh, nfs_get_allocated_file_size_cb,
|
|
|
|
- &task) != 0) {
|
|
|
|
- return -ENOMEM;
|
|
|
|
- }
|
|
|
|
|
|
+ WITH_QEMU_LOCK_GUARD(&client->mutex) {
|
|
|
|
+ if (nfs_fstat_async(client->context, client->fh, nfs_get_allocated_file_size_cb,
|
|
|
|
+ &task) != 0) {
|
|
|
|
+ return -ENOMEM;
|
|
|
|
+ }
|
|
|
|
|
|
- nfs_set_events(client);
|
|
|
|
- BDRV_POLL_WHILE(bs, !task.complete);
|
|
|
|
|
|
+ nfs_set_events(client);
|
|
|
|
+ }
|
|
|
|
+ while (!task.complete) {
|
|
|
|
+ qemu_coroutine_yield();
|
|
|
|
+ }
|
|
|
|
|
|
return (task.ret < 0 ? task.ret : st.st_blocks * 512);
|
|
return (task.ret < 0 ? task.ret : st.st_blocks * 512);
|
|
}
|
|
}
|