nbd-server: Add locking around transaction log writes
Bugfix for the previous patch:
nbd-server uses multiple processes and within each process multiple threads.
Thus: Locking is needed, to ensure that the data in the transaction log
is not corrupted.
Solution: Use sem_open(), the simplest solution.
Alternatives:
- shm_open() + a shared pthread_mutex
- fcntl() for cross process locking, and a ptrace_mutex for intra-process
locking.
Signed-off-by: Manfred Spraul <manfred.spraul@de.bosch.com>
Signed-off-by: Wouter Verhelst <w@uter.be>