From d72f73b26eafb6147a1368e3b14bfc7b5fdf8f75 Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Wed, 10 Apr 2019 15:13:14 +0900 Subject: [PATCH] lib/iscsi: Add target to get_active_conns() as an argument Subsequent patches will exit only connections belonging to the specific target node. So add target to get_active_conns() as an argument. Change-Id: If0d9cad46614310e0fe17e69e75c1185146730f4 Signed-off-by: Shuhei Matsumoto Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450735 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/iscsi/conn.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index 28244b7fc..02d74fdf5 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -580,7 +580,7 @@ spdk_iscsi_conn_destruct(struct spdk_iscsi_conn *conn) } static int -iscsi_get_active_conns(void) +iscsi_get_active_conns(struct spdk_iscsi_tgt_node *target) { struct spdk_iscsi_conn *conn; int num = 0; @@ -592,6 +592,9 @@ iscsi_get_active_conns(void) if (conn == NULL) { continue; } + if (target != NULL && conn->target != target) { + continue; + } num++; } pthread_mutex_unlock(&g_conns_mutex); @@ -623,7 +626,7 @@ iscsi_conn_check_shutdown(void *arg) { struct spdk_event *event; - if (iscsi_get_active_conns() != 0) { + if (iscsi_get_active_conns(NULL) != 0) { return 1; }