Make integrity tests respect request ordering.
authorAlex Bligh <alex@alex.org.uk>
Mon, 6 Jun 2011 20:34:52 +0000 (21:34 +0100)
committerWouter Verhelst <w@uter.be>
Thu, 9 Jun 2011 14:41:36 +0000 (16:41 +0200)
commit79ea31657c406f55f5a01d22bbc2bc5e6f67fe75
tree6623ed19cf74392d643244822a4cbda2d8cffd56
parent251f31049f29f0a8b7198d9dc645e06de8165a90
Make integrity tests respect request ordering.

Prior to this patch, the integrity test fired reads and writes as
quickly as they could at the server. This included firing overlapping
reads and writes, before the prior read or write was acknowledged.
Under the protocol, the server is permitted to reorder reads and
writes until they are acknowledged. Whilst nbd-server does not
currently reorder reads or writes, this caused a "false failure"
in other servers that do reorder reads and writes. Also, the workload
as sent was unrealistic (in that servers do not normally have
overlapping reads and writes in their queue).

This patch maintains a record of the reads and writes inflight, and
ensures that:

1. If any block X is covered by an inflight write request, then
   no other request covering block X will be sent until a reply
   to such inflight write is received.

2. If any block X is covered by an inflight read or write request,
   then no write request covering block X will be sent until a reply
   to such inflight request is received.

In otherwords, disallow all overlapping inflight requests, except
overlapping inflight reads, which are permitted.

The "-l" option to nbd-tester-client can be used to turn on
looseordering, IE not do the above.

I have tested this on nbd-server (no change as expected) and on
a server which does reorder requests (which now passes the tests).
nbd-tester-client.c