Patrick J Cherry
9bf3b52d54
Call proxy_finish_connect_to_upstream when reconnecting, setting
...
TCP_NODELAY
2018-02-06 10:02:16 +00:00
Patrick J Cherry
3a86870c9f
Use sysconf to determine actual page size for msync
...
Also added comments in tests around testing for msync offsets/lengths.
2018-02-06 07:32:58 +00:00
Patrick J Cherry
6d6948af09
Fix offset calculation for partial msyncs to go to nearest 4k block
...
Previously they were always set to zero.
2018-02-05 23:05:00 +00:00
Patrick J Cherry
c423900f02
Fix typo
2018-02-05 17:04:23 +00:00
Patrick J Cherry
afa1bb0efb
Use msync rather than fsync to flush the entire disc
...
This involves storing the size of the mapped disc in the client struct,
and then supplying that to the msync command.
2018-02-05 17:01:32 +00:00
Patrick J Cherry
ad2014ac9d
Fixed long-standing bug with h2r functions being back to front
...
h2r seemd to be using beXXtoh functions instead of htobeXX. Foruntately
ROT13 works symmetrically on our systems..!
2018-02-05 16:16:17 +00:00
Patrick J Cherry
d1dc7392c2
Open file with O_NOATIME, not O_SYNC
...
O_SYNC is not necessary as we're not doing direct writes to the file.
O_NOATIME might give some speed boost.
2018-02-05 16:15:36 +00:00
Patrick J Cherry
2b58468800
Added test for FUA acceptance.
...
Although I think this might be a bit useless as servers normally just
ingore flags.
2018-02-03 20:29:15 +00:00
Patrick J Cherry
3410ccd4c5
Fixed up commenting around our advertised flags.
2018-02-02 20:50:48 +00:00
Patrick J Cherry
9eb7072f49
Removed some extra spaces I'd added
2018-02-02 20:46:25 +00:00
Patrick J Cherry
6aa5907f5e
Tidied constants up a bit
2018-02-02 20:34:49 +00:00
Patrick J Cherry
b22b99d9b9
Fix fill_request to set flags as well as type.
2018-02-02 20:28:00 +00:00
Patrick J Cherry
ad001cb83c
Tidy comments
2018-02-02 16:17:01 +00:00
Patrick J Cherry
68a196e93d
Allow the proxy connection to pass through flags from upstream.
2018-02-02 10:30:40 +00:00
Patrick J Cherry
1f0ef0aad6
Implement FLUSH command and honour FUA flag
...
I changed the request struct to break the 32 bits reserved for the
request type into two. The first part of this is used for the flags
(such as FUA), and the second part for the command type. Previously
we'd masked the top two bytes, thus ignoring any flags.
2018-02-01 22:13:59 +00:00
Patrick J Cherry
25cc084108
First steps towards implementing flags as part of oldstyle negotiation
2018-02-01 19:25:36 +00:00
James F. Carter
9b1781164a
avoid fatal error on client connection timeout
2018-01-26 15:03:44 +00:00
Chris Cottam
c37627a5b9
not high enough, trying 32MB
2018-01-18 17:08:32 +00:00
Chris Cottam
ceb3328261
increasing the NBD max size to see if it fixes an issue with qemu-2.11.0
2018-01-18 16:52:24 +00:00
James F. Carter
fa75de0a8b
proxy sets the upstream address and port as its log context
2018-01-11 10:04:18 +00:00
James F. Carter
1cb11bfd38
serve sets the disc's backing file as its log context
2018-01-11 10:03:16 +00:00
James F. Carter
2702e73a26
add a log_context, a string output as part of any log message
2018-01-11 10:01:42 +00:00
James F. Carter
884a714744
whitespace fix
2018-01-10 13:55:05 +00:00
James F. Carter
0c668f1776
remember how || works in C
2018-01-10 13:54:26 +00:00
James F. Carter
1d5b315f17
apply tcp keepalive to serving sockets
2018-01-10 13:49:22 +00:00
Chris Elsworth
ab3106202a
Also return migration_bytes_left
2017-07-14 16:18:34 +01:00
Patrick J Cherry
c07df76ede
This fixes the compiler warning pointer-to-int-cast in serve.c
...
```
In file included from src/server/bitset.h:4:0,
from src/server/mirror.h:8,
from src/server/flexnbd.h:5,
from src/server/serve.h:8,
from src/server/serve.c:1:
src/server/serve.c: In function 'tryjoin_client_thread':
src/server/serve.c:258:6: warning: cast from pointer to integer of different size [-Wpointer-to-int-cast]
(uint64_t)status);
^
```
2016-10-06 21:16:07 +01:00
James Carter
218c55fb63
Merge branch 'simplify-nbd-handles-part-deux' into 'master'
...
Simplified NBD handle comparisons
8 bytes, therefore a uing64_t to compare to, no need for memcmp()
Signed-off-by: Michel Pollet <buserror@gmail.com >
See merge request !5
2016-10-04 15:49:07 +01:00
Michel Pollet
956a602475
Simplified NBD handle comparisons
...
8 bytes, therefore a uing64_t to compare to, no need for memcmp()
Signed-off-by: Michel Pollet <buserror@gmail.com >
2016-10-04 15:41:48 +01:00
Michel Pollet
76e0476113
Attempt at fixing bind() bug
...
This will prevent the bind() wrapper to loop forever in some cases. I
could nor reproduc the issue, but this removes the only infinite loop I
could find.
Signed-off-by: Michel Pollet <buserror@gmail.com >
2016-10-04 15:36:46 +01:00
Michel Pollet
1fefe1a669
Close socket fix, might relate to migration crashing
...
This was listed as a bug, and was immediatelly picked the static
analyzer anyway, this is very likely the cause for the
migration-cancel-crash bug.
Signed-off-by: Michel Pollet <buserror@gmail.com >
2016-09-14 10:45:49 +01:00
nick
20f99b4554
flexnbd: We only require 1/8th of the memory we allocate for bitsets (bits vs. bytes confusion)
2015-05-13 09:25:09 +01:00
Alex Young
c41eeff2fc
Moved the server-specific files into src/server
2014-03-11 11:05:43 +00:00
Alex Young
5960e4d10b
Remove the proxy's dependency on flexnbd.h
2014-03-11 10:37:00 +00:00
Alex Young
f0911b5c6c
Tighten up some variable scopes.
2014-03-11 10:24:29 +00:00
Alex Young
b063f41ba8
Avoid a potential null pointer dereference
2014-03-11 09:57:19 +00:00
Alex Young
28c7e43e45
Fix a harmless buffer overflow
2014-03-11 09:49:25 +00:00
Alex Young
9326b6b882
Merge
2014-02-27 16:18:17 +00:00
Alex Young
f93476ebd3
Replace off64_t with uint64_t where it makes sense to do so.
...
It looks like off64_t was propagated through the code from the return
type of lseek64(), which isn't appropriate in many of the places we're
using it.
2014-02-27 16:04:25 +00:00
Alex Young
666b60ae1c
Allow subset reads in prefetch_contains and prefetch_offset
2014-02-27 14:54:18 +00:00
nick
f48bf2b296
Automated merge with ssh://dev/flexnbd-c
2014-02-27 14:33:01 +00:00
nick
705164ae3b
Cork/uncork in mirror - socket_connect already sets nodelay
2014-02-27 14:32:54 +00:00
Alex Young
fa8023cf69
Proxy prefetch cache becomes a command-line argument.
2014-02-27 14:21:36 +00:00
nick
aba802d415
bitset: Allocate the right amount of memory
...
We were calculating the wrong number of words per byte in the first
place, and then passing the number of *words* to malloc, which expects
the number of *bytes*.
Fix both errors
2014-02-27 12:57:09 +00:00
Alex Young
5551373073
Merge
2014-02-26 15:37:44 +00:00
Alex Young
77f333423b
Apply Michel's tidy-ups
2014-02-26 15:19:03 +00:00
nick
6f540ce238
proxy: Turn on TCP_CORK
...
Now that we're using NODELAY, we should definitely use cork around
writes to the upstream server. This prevents each partial write()
from being its own packet, which would be terrible if it actually
happened with any regularity (we'd mostly see it when the kernel
is stressed, and write() is progressing a few bytes at a time as
a result)
2014-02-25 16:00:48 +00:00
nick
f9a3447bc9
proxy: Turn on TCP_NODELAY for the proxy->upstream leg
...
Nagle doesn't actually affect us too badly here, as we don't write
the header and then the data in two separate calls under normal
circumstances, which is the pathological case, but we should have
NODELAY on, regardless
2014-02-25 15:59:05 +00:00
nick
7806ec11ee
client: cork/uncork around NBD_REQUEST_READ responses
...
We don't cork/uncork around NBD_REQUEST_WRITE responses because
they're only 16 bytes, and we're using blocking writes.
2014-02-25 15:45:41 +00:00
nick
1817c13acb
sockutil: Add a tcp_cork helper
2014-02-25 15:44:46 +00:00