[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-block] [Qemu-devel] Question: an IO hang problem
From: |
Fam Zheng |
Subject: |
Re: [Qemu-block] [Qemu-devel] Question: an IO hang problem |
Date: |
Thu, 15 Mar 2018 14:37:46 +0800 |
User-agent: |
Mutt/1.9.2 (2017-12-15) |
On Tue, 03/13 17:38, sochin.jiang wrote:
>
> Hi, guys,
>
> Recently, I encountered an IO hang problem in occasion which I cannot
> reproduce it now.
>
> I analyzed this problem carefully, the critical stack is as following:
>
>
> After reading the codes in linux-aio.c(see ioq_submit() function), I found
> two situations could lead us here.
>
> 1) no AIOs are in flight(s->ioq.in_flight is 0) and another call to io_submit
> returns -EAGAIN
So if there is no inflight I/O, why it would return -EAGAIN? The tricky thing
here is that since we're not expecting a completion, when should we retry?
>
> 2) no AIOs are in flight(s->ioq.in_flight is 0) and s->io_q.pending IOs reach
> to MAX_EVENTS at once
I don't understand this case. We have,
len = 0;
QSIMPLEQ_FOREACH(aiocb, &s->io_q.pending, next) {
iocbs[len++] = &aiocb->iocb;
if (s->io_q.in_flight + len >= MAX_EVENTS) {
break;
}
}
ret = io_submit(s->ctx, len, iocbs);
If in_flight is 0, only (MAX_EVENTS - 1) requests can be added to iocbs, so
io_submit shouldn't return -EAGAIN.
>
> In both the two situations above, the do{...}while loop breaks out and set
> s->io_q.blocked true.
>
> After that, AIO completion callback will never be called, ioq_submit()
> either, all pended requests will hang.
>
>
> Is there a proper way we can fix this while do not affect(stuck) the guest ?
Fam