Commit Graph

142 Commits

Author SHA1 Message Date
nick
0172eb1cba flexnbd: Some comments and a minor fix in client.c to do with the event stream 2013-09-13 15:17:15 +01:00
nick
c3a5eb0600 bitset: add bitset_stream_size and bitset_stream_queued_bytes 2013-09-12 16:54:42 +01:00
nick
0a029fbbf5 bitset: Add an event stream implementation
Nothing is using it yet
2013-09-12 12:30:50 +01:00
nick
83426e1c01 tests: Update check_bitset to use new bitset_free() function 2013-09-11 16:09:27 +01:00
nick
efdd613968 listen: Turn off CLIENT_MAX_WAIT_SECS
The idea behind this feature was to avoid the client thread in a listen
server getting stuck forever if the mirroring thread in the source died.
However, it breaks any sane implementation of max_Bps in that thread,
and there are lingering concerns over how it might operate under normal
conditions anyway.

Specifically, if iterating over the bitmap takes a long time, or even just
reading the requisite 8MB from the disc in order to send it, then the
5-second timeout could be hit, causing mirroring to fail unnecessarily.
2013-08-14 16:09:55 +01:00
nick
385c9027db flexnbd status: display mirror->max_bytes_per_second as mirror_speed_limit 2013-08-14 13:30:25 +01:00
nick
9f4fbe782c Branch merge 2013-08-09 17:03:25 +01:00
nick
754949d43f bitset: Add a bitset_run_count_ex that lets you learn the value of the bits in the run 2013-08-09 16:49:38 +01:00
lupine
1a966ca0be bitset: Prove that bitset operations with len=0 don't underflow 2013-07-26 17:09:21 +01:00
nick
f590f8ed3c status: Add migration_speed ( bytes per second ) and migration_duration( seconds ) to the migration output 2013-07-26 11:50:01 +01:00
nick
bc9ce93648 bitset: squash one more bug 2013-07-25 10:58:50 +01:00
nick
bed8959d47 bitset: Fix large runs 2013-07-24 17:42:08 +01:00
nick
253cee5a10 flexnbd: Acknowledge new return type of bitset_run_count 2013-07-24 15:08:29 +01:00
nick
d18423c153 tests: Fix a couple of compile warnings 2013-07-23 17:22:23 +01:00
nick
1b0fe24529 test: Add some tests for bitset_run_count 2013-07-23 17:13:40 +01:00
nick
afe76debf7 flexnbd status: Actually output pass statistics 2013-07-08 14:27:04 +01:00
nick
f4bfc70a4b flexnbd status: Add current pass clean/dirty byte statistics 2013-07-08 13:51:15 +01:00
nick
b29ef6d4de flexnbd status: Avoid a possible NULL dereference reading migration status
While the mirror mutex is taken, the mirroring can be abandoned and serve->mirror
set to NULL, so we need to lock around reading information from serve->mirror
2013-07-08 13:32:14 +01:00
nick
dee0bb27d6 flexnbd status: Add the size of the backing file, in bytes
This will be handy information if you're querying flexnbd for migration
stats, particularly.
2013-07-08 10:11:18 +01:00
nick
f556f298b1 flexnbd status: Add current migration pass to the status output if we're migrating 2013-07-08 09:58:31 +01:00
nick
55b452ebef Fix tests for new killswitch argument 2013-07-03 10:04:08 +01:00
nick
197c1131bf tests: Tell us which offset fails 2013-06-18 15:35:24 +01:00
Alex Young
574d44f17f Add a trivial read buffer to flexnbd-proxy.
Since the vast majority (something like 94% on boot) are sequential small
reads, and since network latency is a major factor in determining how fast the
exposed device appears to the client, it makes sense for us to try to minimise
the number of network requests where we safely can.

This patch implements the simplest possible read cache in flexnbd-proxy.  When
it receives a read request, if it's a small request then flexnbd-proxy will
double the length of data requested.  On receiving the data from the upstream
server, flexnbd-proxy will return the first half to the downstream as normal,
and stash the second half in a buffer.  If the very next request is a read, and
the offset and length match those of what we have stored, that second request
will be satisfied from the buffer without going out over the network.

The cache is invalidated by any non-read request, or by a disconnection.
2013-04-29 14:50:42 +01:00
nick
2bb8434128 sockutil: Make sockaddr_address_string conform to its comment 2013-03-19 14:47:50 +00:00
nick
5257e93cb7 flexnbd: Split the proxy mode out into its own binary.
"flexnbd-proxy ..." should be identical in operation to "flexnbd proxy ..."
2013-03-19 13:13:37 +00:00
nick
6842864e74 Automated merge with file:///home/lupine/Development/bigv-repos/flexnbd-c-sockutil 2013-02-15 16:53:18 +00:00
nick
98d8fbeaf0 flexnbd: Add a proxy mode
This lets us proxy connections between NBD clients and servers, resiliently.
2013-02-15 16:52:16 +00:00
nick
9b67d30608 serve: Make some error conditions non-fatal, test them.
We don't want flexnbd serve to fall over and die if the client sends an invalid request.
2013-02-15 16:51:28 +00:00
nick
63f7e3e8d4 Fix some sockutil tests 2013-02-15 16:48:23 +00:00
nick
0324d3000d branch merge 2013-02-15 13:35:42 +00:00
nick
91085b87fc flexnbd: Add valgrind suppressions for a bug in glibc-2.11 2013-02-15 13:35:21 +00:00
nick
cb7eed28e7 sockutil: Add some tests for sockaddr_address_string 2013-02-13 15:07:30 +00:00
nick
0fcbe04f80 flexnbd: Remove some obsolete 'rebind' options
They steal short options that I want for other things
2013-02-13 13:11:20 +00:00
Alex Young
00d7237f66 Remove an errant debug output from test_happy_path.rb 2012-11-21 09:26:12 +00:00
Alex Young
ed70dacf2f Don't skip parts of a file when calling fiemap
A mis-incremented offset in the fiemap-processing code meant that
non-sparse portions of files were missed.
2012-11-20 17:24:19 +00:00
Alex Young
22bea81445 Don't open the control socket until after the server socket is bound
This makes it easier for the tests (and supervisor) to guarantee to be
able to connect to the server socket.

Also this patch moves freeing the mirror supervisor into the server
thread.
2012-10-09 17:35:20 +01:00
Alex Young
161d2fccf1 Rename serve->has_control to serve->success.
This makes the use of this variable to signal an unexpected SIGTERM
while migrating less confusing.
2012-10-09 17:20:39 +01:00
Alex Young
a039ceffcb Merge 2012-10-08 16:02:37 +01:00
Alex Young
062ecca1fd Backed out changeset c25e7d82e56e
This causes test failures under valgrind, and we don't need the
reordering with a background allocation map builder.
2012-10-08 16:01:25 +01:00
Alex Young
1fa8ba82a5 Merge 2012-10-04 14:51:54 +01:00
Alex Young
f3e0d61323 Quit with an error status on SIGTERM during migration
This prevents the supervisor from thinking that the migration completed
successfully.

In order to do this, I've introduced a new lock around the start (and
finish) of the migration so that we avoid a race between the signal
handler in the server_accept loop and the control thread mirror startup.
Without that, we'd risk successfully starting a migration after the
SIGTERM handler fired, which would be Bad.
2012-10-04 14:41:55 +01:00
nick
32cae67a75 flexnbd: Move building the allocation map to before server socket bind()
Building the allocation map takes time, which scales with the size of the disc
being presented. By building that map in the space between bind() and accept(),
we leave the process in a useless state after the only good signal we have for
"we are ready" and the state where it is actually ready. This was breaking
migrations of large files.
2012-09-25 11:47:44 +01:00
Alex Young
ddc57e76d1 Remove an unneeded sanity check from the tests 2012-09-13 15:13:20 +01:00
Alex Young
1d9c88d4ca Add the write-during-migration test to the acceptance test run 2012-09-13 14:41:50 +01:00
Alex Young
8b43321ef2 Fix for deadlocks when writing while migrating 2012-09-13 12:21:43 +01:00
nick
13328910c8 Add a test case that tickles a deadlock bug when migrating active source discs 2012-09-12 17:13:33 +01:00
nick
ee652a2965 Fix some races in the acceptance tests 2012-09-11 16:21:35 +01:00
Alex Young
53eca40fad Fix tests broken by entrust removal
Missed check_readwrite and check_flexnbd
2012-07-23 15:45:39 +01:00
Alex Young
33f95e1986 Add the --unlink option to mirror
This deletes the local file before tearing down the mirror connection,
allowing us to avoid an ambiguous recovery situation.
2012-07-23 13:39:27 +01:00
Alex Young
fd935ce4c9 Simplify the migration handover protocol
The three-way hand-off has a problem: there's no way to arrange for the
state of the migration to be unambiguous in case of failure.  If the
final "disconnect" message is lost (as in, the destination never
receives it whether it is sent by the sender or not), the destination
has no option but to quit with an error status and let a human sort it
out.  However, at that point we can either arrange to have a .INCOMPLETE
file still on disc or not - and it doesn't matter which we choose, we
can still end up with dataloss by picking a specific calamity to have
befallen the sender.

Given this, it makes sense to fall back to a simpler protocol: just send
all the data, then send a "disconnect" message.  This has the same
downside that we need a human to sort out specific failure cases, but
combined with --unlink before sending "disconnect" (see next patch) it
will always be possible for a human to disambiguate, whether the
destination quit with an error status or not.
2012-07-23 10:22:25 +01:00