mirror of https://github.com/proxmox/mirror_qemu
posix-aio-compat: Honour AsyncContext
Don't call callbacks that don't belong to the active AsyncContext. Signed-off-by: Kevin Wolf <kwolf@redhat.com> Signed-off-by: Anthony Liguori <aliguori@us.ibm.com>master
parent
65d6b3d885
commit
e5f37649c6
|
@ -48,6 +48,8 @@ struct qemu_paiocb {
|
||||||
ssize_t ret;
|
ssize_t ret;
|
||||||
int active;
|
int active;
|
||||||
struct qemu_paiocb *next;
|
struct qemu_paiocb *next;
|
||||||
|
|
||||||
|
int async_context_id;
|
||||||
};
|
};
|
||||||
|
|
||||||
typedef struct PosixAioState {
|
typedef struct PosixAioState {
|
||||||
|
@ -419,6 +421,7 @@ static int posix_aio_process_queue(void *opaque)
|
||||||
struct qemu_paiocb *acb, **pacb;
|
struct qemu_paiocb *acb, **pacb;
|
||||||
int ret;
|
int ret;
|
||||||
int result = 0;
|
int result = 0;
|
||||||
|
int async_context_id = get_async_context_id();
|
||||||
|
|
||||||
for(;;) {
|
for(;;) {
|
||||||
pacb = &s->first_aio;
|
pacb = &s->first_aio;
|
||||||
|
@ -426,6 +429,13 @@ static int posix_aio_process_queue(void *opaque)
|
||||||
acb = *pacb;
|
acb = *pacb;
|
||||||
if (!acb)
|
if (!acb)
|
||||||
return result;
|
return result;
|
||||||
|
|
||||||
|
/* we're only interested in requests in the right context */
|
||||||
|
if (acb->async_context_id != async_context_id) {
|
||||||
|
pacb = &acb->next;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
ret = qemu_paio_error(acb);
|
ret = qemu_paio_error(acb);
|
||||||
if (ret == ECANCELED) {
|
if (ret == ECANCELED) {
|
||||||
/* remove the request */
|
/* remove the request */
|
||||||
|
@ -558,6 +568,8 @@ BlockDriverAIOCB *paio_submit(BlockDriverState *bs, void *aio_ctx, int fd,
|
||||||
acb->aio_type = type;
|
acb->aio_type = type;
|
||||||
acb->aio_fildes = fd;
|
acb->aio_fildes = fd;
|
||||||
acb->ev_signo = SIGUSR2;
|
acb->ev_signo = SIGUSR2;
|
||||||
|
acb->async_context_id = get_async_context_id();
|
||||||
|
|
||||||
if (qiov) {
|
if (qiov) {
|
||||||
acb->aio_iov = qiov->iov;
|
acb->aio_iov = qiov->iov;
|
||||||
acb->aio_niov = qiov->niov;
|
acb->aio_niov = qiov->niov;
|
||||||
|
|
Loading…
Reference in New Issue