Lines Matching refs:tiqn

67 	struct iscsi_tiqn *tiqn = NULL;  in iscsit_get_tiqn_for_login()  local
70 list_for_each_entry(tiqn, &g_tiqn_list, tiqn_list) { in iscsit_get_tiqn_for_login()
71 if (!strcmp(tiqn->tiqn, buf)) { in iscsit_get_tiqn_for_login()
73 spin_lock(&tiqn->tiqn_state_lock); in iscsit_get_tiqn_for_login()
74 if (tiqn->tiqn_state == TIQN_STATE_ACTIVE) { in iscsit_get_tiqn_for_login()
75 tiqn->tiqn_access_count++; in iscsit_get_tiqn_for_login()
76 spin_unlock(&tiqn->tiqn_state_lock); in iscsit_get_tiqn_for_login()
78 return tiqn; in iscsit_get_tiqn_for_login()
80 spin_unlock(&tiqn->tiqn_state_lock); in iscsit_get_tiqn_for_login()
88 static int iscsit_set_tiqn_shutdown(struct iscsi_tiqn *tiqn) in iscsit_set_tiqn_shutdown() argument
90 spin_lock(&tiqn->tiqn_state_lock); in iscsit_set_tiqn_shutdown()
91 if (tiqn->tiqn_state == TIQN_STATE_ACTIVE) { in iscsit_set_tiqn_shutdown()
92 tiqn->tiqn_state = TIQN_STATE_SHUTDOWN; in iscsit_set_tiqn_shutdown()
93 spin_unlock(&tiqn->tiqn_state_lock); in iscsit_set_tiqn_shutdown()
96 spin_unlock(&tiqn->tiqn_state_lock); in iscsit_set_tiqn_shutdown()
101 void iscsit_put_tiqn_for_login(struct iscsi_tiqn *tiqn) in iscsit_put_tiqn_for_login() argument
103 spin_lock(&tiqn->tiqn_state_lock); in iscsit_put_tiqn_for_login()
104 tiqn->tiqn_access_count--; in iscsit_put_tiqn_for_login()
105 spin_unlock(&tiqn->tiqn_state_lock); in iscsit_put_tiqn_for_login()
114 struct iscsi_tiqn *tiqn = NULL; in iscsit_add_tiqn() local
123 tiqn = kzalloc(sizeof(*tiqn), GFP_KERNEL); in iscsit_add_tiqn()
124 if (!tiqn) in iscsit_add_tiqn()
127 sprintf(tiqn->tiqn, "%s", buf); in iscsit_add_tiqn()
128 INIT_LIST_HEAD(&tiqn->tiqn_list); in iscsit_add_tiqn()
129 INIT_LIST_HEAD(&tiqn->tiqn_tpg_list); in iscsit_add_tiqn()
130 spin_lock_init(&tiqn->tiqn_state_lock); in iscsit_add_tiqn()
131 spin_lock_init(&tiqn->tiqn_tpg_lock); in iscsit_add_tiqn()
132 spin_lock_init(&tiqn->sess_err_stats.lock); in iscsit_add_tiqn()
133 spin_lock_init(&tiqn->login_stats.lock); in iscsit_add_tiqn()
134 spin_lock_init(&tiqn->logout_stats.lock); in iscsit_add_tiqn()
136 tiqn->tiqn_state = TIQN_STATE_ACTIVE; in iscsit_add_tiqn()
146 kfree(tiqn); in iscsit_add_tiqn()
149 tiqn->tiqn_index = ret; in iscsit_add_tiqn()
150 list_add_tail(&tiqn->tiqn_list, &g_tiqn_list); in iscsit_add_tiqn()
155 pr_debug("CORE[0] - Added iSCSI Target IQN: %s\n", tiqn->tiqn); in iscsit_add_tiqn()
157 return tiqn; in iscsit_add_tiqn()
161 static void iscsit_wait_for_tiqn(struct iscsi_tiqn *tiqn) in iscsit_wait_for_tiqn() argument
166 spin_lock(&tiqn->tiqn_state_lock); in iscsit_wait_for_tiqn()
167 while (tiqn->tiqn_access_count != 0) { in iscsit_wait_for_tiqn()
168 spin_unlock(&tiqn->tiqn_state_lock); in iscsit_wait_for_tiqn()
170 spin_lock(&tiqn->tiqn_state_lock); in iscsit_wait_for_tiqn()
172 spin_unlock(&tiqn->tiqn_state_lock); in iscsit_wait_for_tiqn()
175 void iscsit_del_tiqn(struct iscsi_tiqn *tiqn) in iscsit_del_tiqn() argument
183 if (iscsit_set_tiqn_shutdown(tiqn) < 0) { in iscsit_del_tiqn()
188 iscsit_wait_for_tiqn(tiqn); in iscsit_del_tiqn()
191 list_del(&tiqn->tiqn_list); in iscsit_del_tiqn()
192 idr_remove(&tiqn_idr, tiqn->tiqn_index); in iscsit_del_tiqn()
196 tiqn->tiqn); in iscsit_del_tiqn()
197 kfree(tiqn); in iscsit_del_tiqn()
251 struct iscsi_tiqn *tiqn = tpg->tpg_tiqn; in iscsit_deaccess_np() local
258 if (tiqn) in iscsit_deaccess_np()
259 iscsit_put_tiqn_for_login(tiqn); in iscsit_deaccess_np()
2454 struct iscsi_tiqn *tiqn = iscsit_snmp_get_tiqn(conn); in iscsit_handle_logout_cmd() local
2459 if (tiqn) { in iscsit_handle_logout_cmd()
2460 spin_lock(&tiqn->logout_stats.lock); in iscsit_handle_logout_cmd()
2462 tiqn->logout_stats.normal_logouts++; in iscsit_handle_logout_cmd()
2464 tiqn->logout_stats.abnormal_logouts++; in iscsit_handle_logout_cmd()
2465 spin_unlock(&tiqn->logout_stats.lock); in iscsit_handle_logout_cmd()
3344 struct iscsi_tiqn *tiqn; in iscsit_build_sendtargets_response() local
3378 list_for_each_entry(tiqn, &g_tiqn_list, tiqn_list) { in iscsit_build_sendtargets_response()
3380 strcmp(tiqn->tiqn, text_ptr)) { in iscsit_build_sendtargets_response()
3386 spin_lock(&tiqn->tiqn_tpg_lock); in iscsit_build_sendtargets_response()
3387 list_for_each_entry(tpg, &tiqn->tiqn_tpg_list, tpg_list) { in iscsit_build_sendtargets_response()
3419 tiqn->tiqn); in iscsit_build_sendtargets_response()
3424 spin_unlock(&tiqn->tiqn_tpg_lock); in iscsit_build_sendtargets_response()
3453 spin_unlock(&tiqn->tiqn_tpg_lock); in iscsit_build_sendtargets_response()
3469 spin_unlock(&tiqn->tiqn_tpg_lock); in iscsit_build_sendtargets_response()