@@ -1174,14 +1174,18 @@ static void coroutine_fn add_aio_request(BDRVSheepdogState *s, AIOReq *aio_req,
/* send a header */
ret = qemu_co_send(s->fd, &hdr, sizeof(hdr));
if (ret < (int)sizeof(hdr)) {
- error_report("failed to send a req, %s", strerror(errno));
+ dprintf("failed to send a req, %s", strerror(errno));
+ QLIST_REMOVE(aio_req, aio_siblings);
+ QLIST_INSERT_HEAD(&s->pending_aio_head, aio_req, aio_siblings);
goto out;
}
if (wlen) {
ret = qemu_co_sendv(s->fd, iov, niov, aio_req->iov_offset, wlen);
if (ret < wlen) {
- error_report("failed to send a data, %s", strerror(errno));
+ dprintf("failed to send a data, %s", strerror(errno));
+ QLIST_REMOVE(aio_req, aio_siblings);
+ QLIST_INSERT_HEAD(&s->pending_aio_head, aio_req, aio_siblings);
}
}
out:
qemu_co_send() in the add_aio_request might fail if connection is closed. In this case we should it requests into failed list to be resended later when connection is repaired. Signed-off-by: Liu Yuan <namei.unix@gmail.com> --- block/sheepdog.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)