From 13935275fbbfa74530370d120cc51c6d0a57fece Mon Sep 17 00:00:00 2001 From: Shuhei Matsumoto Date: Wed, 10 Apr 2019 16:41:51 +0900 Subject: [PATCH] lib/iscsi: Add target to iscsi_conns_start_exit() as an argument When target is specified, the function starts exiting any connection that belongs to the target. When target is not specified, the function starts exiting all connections. Change-Id: I0dfb56ceac5ee36d10547a9ab9a0f768ca8e02ec Signed-off-by: Shuhei Matsumoto Reviewed-on: https://review.gerrithub.io/c/spdk/spdk/+/450734 Tested-by: SPDK CI Jenkins Reviewed-by: Changpeng Liu Reviewed-by: Ben Walker Reviewed-by: Jim Harris --- lib/iscsi/conn.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index bc0f30dd8..28244b7fc 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -768,7 +768,7 @@ iscsi_conn_stop(struct spdk_iscsi_conn *conn) } static void -iscsi_conns_start_exit(void) +iscsi_conns_start_exit(struct spdk_iscsi_tgt_node *target) { struct spdk_iscsi_conn *conn; int i; @@ -781,6 +781,10 @@ iscsi_conns_start_exit(void) continue; } + if (target != NULL && conn->target != target) { + continue; + } + /* Do not set conn->state if the connection has already started exiting. * This ensures we do not move a connection from EXITED state back to EXITING. */ @@ -795,7 +799,7 @@ iscsi_conns_start_exit(void) void spdk_shutdown_iscsi_conns(void) { - iscsi_conns_start_exit(); + iscsi_conns_start_exit(NULL); g_shutdown_timer = spdk_poller_register(iscsi_conn_check_shutdown, NULL, 1000); }