summaryrefslogtreecommitdiffstats
path: root/src/server/server.c
diff options
context:
space:
mode:
authorSebastian Vater2025-08-19 16:53:14 +0200
committerSimon Rettberg2025-12-09 15:33:20 +0100
commit197f25c9c913940c87774c15bded85aa920be14b (patch)
treef3f9cd92be6532bdbc3064e2b1dc1d31e74ee28f /src/server/server.c
parent[SERVER] iscsi: Finish login handling, add NOP-In/Out handling (diff)
downloaddnbd3-197f25c9c913940c87774c15bded85aa920be14b.tar.gz
dnbd3-197f25c9c913940c87774c15bded85aa920be14b.tar.xz
dnbd3-197f25c9c913940c87774c15bded85aa920be14b.zip
[SERVER] iscsi: Hook into net.c, text response handling, more features:
- R2T handling - Portal groups - Fixes to login phase handling - Code refactoring - Remove obsolete PDU fields - SCSI INQUIRY handler - Persistent Reservation support - Implement SCSI block based operations - Implement other needed SCSI ops - Disks are now reported as read-only - Doxygen tags - Bugfixes for crashes, memleaks, etc.
Diffstat (limited to 'src/server/server.c')
-rw-r--r--src/server/server.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/server/server.c b/src/server/server.c
index d086930..0bbb417 100644
--- a/src/server/server.c
+++ b/src/server/server.c
@@ -27,6 +27,7 @@
#include "net.h"
#include "altservers.h"
#include "integrity.h"
+#include "iscsi.h"
#include "threadpool.h"
#include "rpc.h"
#include "fuse.h"
@@ -176,6 +177,10 @@ _Noreturn static void dnbd3_cleanup()
threadpool_waitEmpty();
+ // Destroy iSCSI global vector
+ iscsi_destroy();
+ pthread_rwlock_destroy( &iscsi_globvec_rwlock );
+
// Clean up images
retries = 5;
while ( !image_tryFreeAll() && --retries > 0 ) {
@@ -365,6 +370,12 @@ int main(int argc, char *argv[])
altservers_init();
integrity_init();
net_init();
+
+ if ( _iSCSIServer ) {
+ if ( (pthread_rwlock_init( &iscsi_globvec_rwlock, NULL ) != 0) || (iscsi_create() < 0) )
+ return EXIT_FAILURE;
+ }
+
uplink_globalsInit();
rpc_init();
if ( mountDir != NULL && !dfuse_init( "-oallow_other", mountDir ) ) {