[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [sheepdog] [PATCH v3 07/10] sheepdog: try to reconnect
From: |
MORITA Kazutaka |
Subject: |
Re: [Qemu-devel] [sheepdog] [PATCH v3 07/10] sheepdog: try to reconnect to sheepdog after network error |
Date: |
Fri, 26 Jul 2013 14:53:04 +0900 |
User-agent: |
Wanderlust/2.15.9 (Almost Unreal) Emacs/23.2 Mule/6.0 (HANACHIRUSATO) |
At Thu, 25 Jul 2013 21:20:43 +0800,
Liu Yuan wrote:
>
> On Thu, Jul 25, 2013 at 09:53:14PM +0900, MORITA Kazutaka wrote:
> > At Thu, 25 Jul 2013 17:13:46 +0800,
> > Liu Yuan wrote:
> > >
> > > > +
> > > > + /* Try to reconnect the sheepdog server every one second. */
> > > > + while (s->fd < 0) {
> > > > + s->fd = get_sheep_fd(s);
> > > > + if (s->fd < 0) {
> > > > + dprintf("Wait for connection to be established\n");
> > > > + co_aio_sleep_ns(1000000000ULL);
> > > > + }
> > > > + };
> > > > +
> > > > + /* Move all the inflight requests to the failed queue. */
> > > > + QLIST_FOREACH_SAFE(aio_req, &s->inflight_aio_head, aio_siblings,
> > > > next) {
> > > > + QLIST_REMOVE(aio_req, aio_siblings);
> > > > + QLIST_INSERT_HEAD(&s->failed_aio_head, aio_req, aio_siblings);
> > > > + }
> > > > +
> > > > + /* Resend all the failed aio requests. */
> > > > + while (!QLIST_EMPTY(&s->failed_aio_head)) {
> > > > + aio_req = QLIST_FIRST(&s->failed_aio_head);
> > > > + QLIST_REMOVE(aio_req, aio_siblings);
> > > > + QLIST_INSERT_HEAD(&s->inflight_aio_head, aio_req,
> > > > aio_siblings);
> > > > + resend_aioreq(s, aio_req);
> > > > + }
> > > > +}
> > > > +
> > >
> > > Is failed queue necessary? Here you just move requests from inflight
> > > queue to
> > > failed queue, then interate the failed queue to send them all.
> > >
> > > Isn't it simpler we just resend the requests in the inflight queue like
> > >
> > > > + QLIST_FOREACH(aio_req, &s->inflight_aio_head, aio_siblings, next) {
> > > > + resend_aioreq(s, aio_req);
> > > > + }
> >
> > resend_aioreq() can yield and a new aio request can be added to the
> > inflight queue during this loop. To avoid mixing new requests and
> > failed ones, I think the failed queue is necessary.
> >
>
> Okay, make sense. This should be included in the source file. You can add my
Okay, thanks for your review and comments.
Kazutaka
>
> Tested-and-reviewed-by: Liu Yuan <address@hidden>
>
> to sheepdog patches
>
> Thanks,
> Yuan
- [Qemu-devel] [PATCH v3 10/10] sheepdog: check simultaneous create in resend_aioreq, (continued)
[Qemu-devel] [PATCH v3 01/10] ignore SIGPIPE in qemu-img and qemu-io, MORITA Kazutaka, 2013/07/25
[Qemu-devel] [PATCH v3 04/10] sheepdog: handle vdi objects in resend_aio_req, MORITA Kazutaka, 2013/07/25
[Qemu-devel] [PATCH v3 05/10] sheepdog: reload inode outside of resend_aioreq, MORITA Kazutaka, 2013/07/25
[Qemu-devel] [PATCH v3 09/10] sheepdog: cancel aio requests if possible, MORITA Kazutaka, 2013/07/25