summaryrefslogtreecommitdiffstats
path: root/src/server
Commit message (Collapse)AuthorAgeFilesLines
* [SERVER] Speed up shutdown of integrity checkerSimon Rettberg2019-08-281-2/+5
|
* [SERVER] Reintroduce check whether readFd is actually != -1Simon Rettberg2019-08-281-1/+3
|
* [SERVER] Make signal handling more POSIXSimon Rettberg2019-08-288-33/+74
| | | | | | | | | | | | | | | 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.
* [SERVER] Remove old commentsSimon Rettberg2019-08-282-38/+0Star
|
* [SERVER] Handle closeUnusedFd via timerSimon Rettberg2019-08-282-25/+19Star
|
* [SERVER] Add timer infrastructureSimon Rettberg2019-08-272-10/+134
| | | | To be used by "close unused fd" checks, and others...
* [SERVER] Fix swapped assignmentSimon Rettberg2019-08-271-1/+1
|
* [SERVER] Use reference counting for uplinkSimon Rettberg2019-08-2711-140/+311
| | | | First step towards less locking for proxy mode
* [SERVER] Fix warnings, simplify lockingSimon Rettberg2019-08-262-12/+13
|
* [SERVER] Get rid of alt-servers thread, per-uplink rtt historySimon Rettberg2019-08-228-481/+463Star
| | | | | | | | | | 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.
* [SERVER] Put request handle into CMD_ERROR replySimon Rettberg2019-08-221-1/+1
|
* [SERVER] Add struct representing active connection to uplink serverSimon Rettberg2019-08-185-66/+60Star
|
* [SERVER] uplink: More consistent type/variable namingSimon Rettberg2019-08-185-288/+294
| | | | | * Change link to uplink everywhere * dnbd3_connection_t -> dnbd3_uplink_t
* [SERVER] altservers: Don't run check if <= 1 alt server availableSimon Rettberg2019-08-181-4/+11
|
* [SERVER] net.c: Minor reorderingSimon Rettberg2019-08-181-8/+9
|
* [SERVER] Lock free thread poolSimon Rettberg2019-08-161-53/+57
|
* [SERVER] Better lock debugging: Always check lock orderSimon Rettberg2019-08-0710-219/+192Star
| | | | | | 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.
* [SERVER] Lock-free queue for altservers check threadSimon Rettberg2019-08-072-48/+57
|
* [SERVER] Use more _AtomicSimon Rettberg2019-08-072-5/+4Star
|
* [SERVER] Fix race condition and invalid lock orderSimon Rettberg2019-08-071-4/+7
|
* [SERVER] uplink: Improve attaching to existing requestsSimon Rettberg2019-08-062-35/+74
| | | | | Allow attaching in ULR_PROCESSING state, leave lower slots empty to increase chances attaching to ULR_PROCESSING.
* [SERVER] Improve debug output if a locked lock gets destroyedSimon Rettberg2019-08-061-0/+1
|
* [SERVER] Fix: Client thread could destroy sendMutex while in useSimon Rettberg2019-08-061-0/+3
| | | | | | Fix a race condition where the client thread tears down the client struct including the sendMutex while the uplink thead is currently holding the lock, trying to send data to the client.
* [SERVER] Allow uplink shutdown if bgrMinClients > image->usersSimon Rettberg2019-08-051-1/+2
|
* [SERVER] Add sanity check to threadpool_run for NULL routineSimon Rettberg2019-08-051-0/+4
|
* [SERVER] Switch threadpool back to spinlock, add idle thread counterSimon Rettberg2019-08-051-22/+23
|
* [SERVER] Atomicize some global flagsSimon Rettberg2019-08-032-2/+2
|
* [SERVER] Make image->users atomic and get rid of some lockingSimon Rettberg2019-08-022-53/+40Star
| | | | | | | | With this change it should be safe to read the users count of an image without locking first, assuming you already have a reference on the image or are otherwise sure it cannot be freed, i.e. in an active uplink. Updating users, or checking whether it's 0 in order to free the image should only be done while holding the imageListLock.
* i[SERVER] Include new pretendClient in config dumpv2.2Simon Rettberg2019-08-021-0/+1
|
* [SERVER] Fix compile in release modeSimon Rettberg2019-08-021-1/+1
|
* [SERVER] Turn all spinlocks into mutexesSimon Rettberg2019-07-2611-412/+467
| | | | | | | | 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.
* [SERVER] Add pretendClient config optionSimon Rettberg2019-07-232-0/+9
| | | | | | This makes the server not set the FLAGS8_SERVER flag when establishing an uplink connection. Useful mostly for running a proxy on localhost for local caching.
* [SERVER] uplink: Relay request in client's thread if possibleSimon Rettberg2019-07-232-3/+57
| | | | | Early benchmarking shows that this is faster, since we don't require another thread to wake up just to send out the request.
* [SERVER] Don't shutdown uplink if background replication is FULLSimon Rettberg2019-02-131-1/+1
|
* [SERVER] uplink: Dedicated function for handling link failureSimon Rettberg2019-02-081-31/+50
|
* [SERVER] integrity: Group check requests, use sync_file_range()Simon Rettberg2019-02-041-25/+51
| | | | | | | This requires a much shorter queue and balances hashing between different images if the checker lags behind. On Linux, use sync_file_range() instead of fsync() before reading back to speed up flushing.
* [SERVER] Cosmetic changes (loglvl, comment)Simon Rettberg2019-02-041-2/+2
|
* [SERVER] Export image idle time in json rpcSimon Rettberg2019-01-311-3/+6
| | | | Counter in seconds for how long this image hasn't been used.
* [SERVER] altservers.c: Improve log outputSimon Rettberg2019-01-312-20/+19Star
|
* [SERVER] Don't keep an uplink connection established foreverSimon Rettberg2019-01-314-45/+85
| | | | | | 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.
* [SERVER] uplink: Check for _maxPayload when getting client requestSimon Rettberg2019-01-311-0/+4
| | | | | | It didn't make too much sense that we only checked _maxPayload when the reply arrived; simply don't forward a request where we already know we won't handle the reply.
* [SERVER] Lower log-level of non-critical messageSimon Rettberg2019-01-302-2/+3
|
* [SERVER] Only set BGR flag in handshake for BGR_FULLSimon Rettberg2018-11-161-1/+1
| | | | | | | _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.
* [SERVER] Fix json format stringSimon Rettberg2018-11-161-1/+1
| | | | Don't drop runId
* [SERVER] rpc: Distinguish between client and server (proxy) connectionsSimon Rettberg2018-08-143-8/+18
|
* [SERVER] Fix last block replicating indefinitely in hasblock modeSimon Rettberg2018-08-141-5/+7
|
* [SERVER] Use atomic vars for uplink byte countersSimon Rettberg2018-08-132-28/+5Star
|
* [SERVER] Use atomic var for (total)bytesSent countersSimon Rettberg2018-08-085-102/+62Star
| | | | | | 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.
* [SERVER] Add missing file mode to open() callSimon Rettberg2018-07-261-2/+2
|
* [SERVER] Fix compilation on clang (atomic vars)Simon Rettberg2018-07-101-4/+4
|