Mikolaj Golub 5d69ed535e For memsync replication, hio_countdown is used not only as an
indication when a request can be moved to done queue, but also for
detecting the current state of memsync request.

This approach has problems, e.g. leaking a request if memsynk ack from
the secondary failed, or racy usage of write_complete, which should be
called only once per write request, but for memsync can be entered by
local_send_thread and ggate_send_thread simultaneously.

So the following approach is implemented instead:

1) Use hio_countdown only for counting components we waiting to
   complete, i.e. initially it is always 2 for any replication mode.

2) To distinguish between "memsync ack" and "memsync fin" responses
   from the secondary, add and use hio_memsyncacked field.

3) write_complete() in component threads is called only before
   releasing hio_countdown (i.e. before the hio may be returned to the
   done queue).

4) Add and use hio_writecount refcounter to detect when
   write_complete() can be called in memsync case.

Reported by:	Pete French petefrench ingresso.co.uk
Tested by:	Pete French petefrench ingresso.co.uk
MFC after:	2 weeks
2013-12-10 19:56:26 +00:00
..
2012-01-07 16:09:33 +00:00
2012-01-07 16:09:33 +00:00
2013-11-03 19:02:18 +00:00
2012-01-07 16:09:33 +00:00
2012-03-23 20:18:48 +00:00
2012-07-01 16:26:07 +00:00
2012-02-11 16:41:52 +00:00
2013-06-29 20:13:39 +00:00
2012-01-06 12:27:17 +00:00
2012-06-11 20:27:52 +00:00