diff --git a/lib/iscsi/conn.c b/lib/iscsi/conn.c index 4c7a54fcf..3f2ba83af 100644 --- a/lib/iscsi/conn.c +++ b/lib/iscsi/conn.c @@ -862,7 +862,7 @@ iscsi_conn_request_logout(struct spdk_iscsi_conn *conn) } void -iscsi_conns_request_logout(struct spdk_iscsi_tgt_node *target) +iscsi_conns_request_logout(struct spdk_iscsi_tgt_node *target, int pg_tag) { struct spdk_iscsi_conn *conn; @@ -872,7 +872,8 @@ iscsi_conns_request_logout(struct spdk_iscsi_tgt_node *target) pthread_mutex_lock(&g_conns_mutex); TAILQ_FOREACH(conn, &g_active_conns, conn_link) { - if (target == NULL || conn->target == target) { + if ((target == NULL) || + (conn->target == target && (pg_tag < 0 || conn->pg_tag == pg_tag))) { iscsi_conn_request_logout(conn); } } @@ -882,7 +883,7 @@ iscsi_conns_request_logout(struct spdk_iscsi_tgt_node *target) void shutdown_iscsi_conns(void) { - iscsi_conns_request_logout(NULL); + iscsi_conns_request_logout(NULL, -1); g_shutdown_timer = SPDK_POLLER_REGISTER(iscsi_conn_check_shutdown, NULL, 1000); } diff --git a/lib/iscsi/conn.h b/lib/iscsi/conn.h index a85d2ddeb..be9f8342a 100644 --- a/lib/iscsi/conn.h +++ b/lib/iscsi/conn.h @@ -206,7 +206,7 @@ void iscsi_task_mgmt_cpl(struct spdk_scsi_task *scsi_task); int initialize_iscsi_conns(void); void shutdown_iscsi_conns(void); -void iscsi_conns_request_logout(struct spdk_iscsi_tgt_node *target); +void iscsi_conns_request_logout(struct spdk_iscsi_tgt_node *target, int pg_tag); int iscsi_get_active_conns(struct spdk_iscsi_tgt_node *target); int iscsi_conn_construct(struct spdk_iscsi_portal *portal, struct spdk_sock *sock); diff --git a/lib/iscsi/tgt_node.c b/lib/iscsi/tgt_node.c index 0807a3384..1e6f0ca50 100644 --- a/lib/iscsi/tgt_node.c +++ b/lib/iscsi/tgt_node.c @@ -687,7 +687,7 @@ iscsi_tgt_node_destruct(struct spdk_iscsi_tgt_node *target, target->destruct_cb_fn = cb_fn; target->destruct_cb_arg = cb_arg; - iscsi_conns_request_logout(target); + iscsi_conns_request_logout(target, -1); if (iscsi_get_active_conns(target) != 0) { target->destruct_poller = SPDK_POLLER_REGISTER(iscsi_tgt_node_check_active_conns, diff --git a/test/unit/lib/iscsi/common.c b/test/unit/lib/iscsi/common.c index e6631848a..11698320f 100644 --- a/test/unit/lib/iscsi/common.c +++ b/test/unit/lib/iscsi/common.c @@ -160,7 +160,7 @@ DEFINE_STUB(spdk_scsi_dev_delete_port, int, DEFINE_STUB_V(shutdown_iscsi_conns, (void)); -DEFINE_STUB_V(iscsi_conns_request_logout, (struct spdk_iscsi_tgt_node *target)); +DEFINE_STUB_V(iscsi_conns_request_logout, (struct spdk_iscsi_tgt_node *target, int pg_tag)); DEFINE_STUB(iscsi_get_active_conns, int, (struct spdk_iscsi_tgt_node *target), 0);