| Commit message (Collapse) | Author | Age | Files | Lines |
| |
|
|
|
|
|
|
|
|
|
|
| |
This change restructures the source code directories, separates shared
form non-shared application code and adds CMake dependencies. These
dependencies allow the tracking of changes and trigger a rebuild of
those build targets where changed files are involved.
WARNING: Note that the support of the DNBD3_SERVER_AFL build option is
not supported yet. Thus, the option should be never turned on.
|
|
|
|
|
| |
Still needs some cleanup and optimizations, variable naming sucks,
comments, etc.
|
| |
|
|
|
|
|
|
| |
- Now uses linked lists instead of huge array
- Does prefetch data on client requests
- Can have multiple replication requests in-flight
|
|
|
|
| |
Severe data corruption on client. Nice.
|
| |
|
|
|
|
|
|
|
|
| |
Move CMD_GET_BLOCK out of switch block and mark as likely. Don't acquire
and release cache map for every single request, but keep reference
around and only release when a message other than CMD_GET_BLOCK arrives.
On idle links, this should happen through CMD_KEEPALIVE every now and
then.
|
| |
|
|
|
|
|
|
|
|
| |
Tracking the "working" state of images using one boolean is insufficient
regarding the different ways in which providing an image can fail.
Introduce separate flags for different conditions, like "file not
readable", "file not writable", "no uplink server available", "file
content has changed".
|
|
|
|
|
|
| |
Not really namespace but simple string matching for the image path. Path
is matched from start with no support for glob or regex, so usually you
want to have a trailing '/' to limit to certain directories.
|
|
|
|
|
|
| |
Keeping the uplink thread around forever even though we
disconnected from the upstream server seems wasteful. Get
rid of this and rear down the uplink entirely.
|
|
|
|
|
|
| |
Gets rid of a bunch of locking, especially the hot path in net.c where
clients are requesting data. Many clients unsing the same incomplete
image previously created a bottleneck here.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
According to POSIX, a signal sent to a PID can be delivered to an
arbitrary thread of that process that hasn't the signal blocked. This
seens to never happen on Linux, but would mess things up since the code
expected the main signal handler to only be executed by the main thread.
This should now be fixed by examining the destination PID of the signal
as well as the ID of the thread currently running the signal handler. If
we notice the signal wasn't sent by our own PID and the handler is not
currently run by the main thread, we re-send the signal to the main
thread. Otherwise, if the signal was sent by our own PID but the handler
is not run in the main thread, do nothing. This way we can use
pthread_kill() to wake up threads that might be stuck in a blocking
syscall when it's time to shut down.
|
|
|
|
| |
First step towards less locking for proxy mode
|
|
|
|
|
|
|
|
|
|
| |
Alt-Server checks are now run using the threadpool, so we don't need a
queue and dedicated thread anymore. The rtt history is now kept per
uplink, so many uplinks won't overwhelm the history, making its time
window very short.
Also the fail counter is now split up; a global one for when the server
actually isn't reachable, a local (per-uplink) one for when the server
is reachable but doesn't serve the requested image.
|
| |
|
| |
|
|
|
|
|
|
| |
Lock order is predefined in locks.h. Immediately bail out if a lock with
lower priority is obtained while the same thread already holds one with
higher priority.
|
| |
|
| |
|
|
|
|
|
|
|
|
| |
Just assume sane platforms offer smart mutexes
that have a fast-path with spinlocks internally
for locks that have little to no congestion.
In all other cases, mutexes should perform better
anyways.
|
| |
|
|
|
|
|
|
| |
In case we don't use background replication a connection to an uplink
server can potentially stay around forever. This in turn would prevent
the uplink server from freeing the image as it appears to be in use.
|
|
|
|
|
|
|
| |
_backgroundReplication was still treated as a boolean flag, so a server
with BGR_NONE would reject a server with BGR_HASHBLOCK. While this still
forces the BGR_NONE proxy to replicate more than it normally would, it
seems reasonable to allow this.
|
| |
|
|
|
|
|
|
| |
Gets rid of the lastBytesSent field as well as the stats lock per
client. Cleaned and split up the messy net_clientsToJson function while
at it.
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The cacheFd is now moved to the uplink data structure and will
only be handled by the uplink thread.
The integrity checker now supports checking all blocks of an
image. This will be triggered automatically whenever a check for
a single block failed.
Also, if a crc check on startup fails, the image won't be discarded
anymore, but rather a full check will be initiated.
Furthermore, when calling image_updateCacheMap() on an image that
was previously complete, the cache map will now be re-initialized,
and a new uplink connection created.
|
| |
|
| |
|
|
|
|
|
| |
maxClients, maxImages, maxPayload, maxReplicationSize
Refs #3231
|
| |
|
|
|
|
|
|
|
| |
Introduce new flag in "select image" message to tell the uplink server
whether we have background replication enabled or not. Also reject
a connecting proxy if the connecting proxy uses BGR but we don't, as this
would basically force the image to be replicated locally too.
|
|
|
|
|
|
| |
If client reports protocol version < 3 on connect, just pretend
we're at the same version. This sucks but we can't update servers
before clients otherwise. :(
|
|
|
|
| |
...there were quite a few format string errors as it turns out :/
|
|
|
|
|
|
| |
Less copy & paste for sendfile alternatives,
changed naming of old dnbd3_* functions moved
over from server.c a while ago.
|
|
|
|
|
|
|
|
|
|
|
| |
AFL is an instrumenting fuzzer.
It expects to pass input to the program to be tested
via command line (file name) or via stdin. This adds
support for reading messages that normally would arrive
via network directly from stdin. In this mode, the server
is pretty useless otherwise.
http://lcamtuf.coredump.cx/afl/
|
|
|
|
|
| |
Pretty loose guesswork, but preventing the false positives
would not lead to any meaningful result anyways, so why bother.
|
|
|
|
| |
Less writes to variables, more up-to-date values for uplinks.
|
|
|
|
| |
conversion problems
|
| |
|
|
|
|
|
| |
Introduces new shared source unit timing.[ch]
Closes #3214
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
We steal 8 bits from the request offset to count hops when requests
get relayed by proxies. This still leaves plenty of bits for the
offset (56 bits, supporting images of up to 72 petabytes).
This is used to detect proxy cycles. The algorithm is not perfect
but should prevent endless relays of the same request.
This is backwards compatible to old clients and servers, as the server
only ever sets the hopcount in relayed requests if the upstream server
is using protocol version 3 or newer, and clients are automatically
upwards compatible as there is practically no image larger than 74PB,
so the newly introduced hop count field is always 0 even in requests
from old clients.
|
| |
|
| |
|
| |
|
|
|
|
|
|
|
|
|
| |
- ACL is defined in new file rpc.acl
- Queries are still WIP, for now something like
/query?q=stats&q=images
/query?q=clients
works, although the parsing is still ugly
- Also supports HTTP keep-alive
|
| |
|
| |
|