mirror of
https://github.com/SCST-project/scst.git
synced 2026-08-18 13:16:34 +00:00
target_del(): don't exit on existing sessions
Target_del() might has not yet received all connections close events, so it can still has alive sessions. Wait for them to disappear. git-svn-id: http://svn.code.sf.net/p/scst/svn/trunk@4617 d57e44dd-8a1f-0410-8b47-8ef2f437770f
This commit is contained in:
+10
-6
@@ -28,6 +28,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <ifaddrs.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "iscsid.h"
|
||||
|
||||
@@ -340,13 +341,16 @@ int target_del(u32 tid, u32 cookie)
|
||||
|
||||
list_del(&target->tlist);
|
||||
|
||||
/* We might need to handle session(s) removal event(s) from the kernel */
|
||||
while (handle_iscsi_events(nl_fd, false) == 0);
|
||||
while (1) {
|
||||
/* We might need to handle session(s) removal event(s) from the kernel */
|
||||
while (handle_iscsi_events(nl_fd, false) == 0);
|
||||
|
||||
if (!list_empty(&target->sessions_list)) {
|
||||
log_error("%s: target %u still has sessions\n", __FUNCTION__,
|
||||
tid);
|
||||
exit(-1);
|
||||
if (list_empty(&target->sessions_list))
|
||||
break;
|
||||
|
||||
/* We have not yet received session(s) removal event(s), so keep waiting */
|
||||
log_debug(1, "Target %d has sessions, keep waiting", tid);
|
||||
usleep(50000);
|
||||
}
|
||||
|
||||
if (target->tgt_enabled)
|
||||
|
||||
Reference in New Issue
Block a user