scsi: target: split out helper for cxn timeout error stashing
Replace existing nested code blocks with helper function calls. Signed-off-by: David Disseldorp <ddiss@suse.de> Signed-off-by: Martin K. Petersen <martin.petersen@oracle.com>
This commit is contained in:
parent
c62ae3005b
commit
dce6190ca7
|
@ -770,21 +770,8 @@ void iscsit_handle_time2retain_timeout(struct timer_list *t)
|
|||
|
||||
pr_err("Time2Retain timer expired for SID: %u, cleaning up"
|
||||
" iSCSI session.\n", sess->sid);
|
||||
{
|
||||
struct iscsi_tiqn *tiqn = tpg->tpg_tiqn;
|
||||
|
||||
if (tiqn) {
|
||||
spin_lock(&tiqn->sess_err_stats.lock);
|
||||
strcpy(tiqn->sess_err_stats.last_sess_fail_rem_name,
|
||||
(void *)sess->sess_ops->InitiatorName);
|
||||
tiqn->sess_err_stats.last_sess_failure_type =
|
||||
ISCSI_SESS_ERR_CXN_TIMEOUT;
|
||||
tiqn->sess_err_stats.cxn_timeout_errors++;
|
||||
atomic_long_inc(&sess->conn_timeout_errors);
|
||||
spin_unlock(&tiqn->sess_err_stats.lock);
|
||||
}
|
||||
}
|
||||
|
||||
iscsit_fill_cxn_timeout_err_stats(sess);
|
||||
spin_unlock_bh(&se_tpg->session_lock);
|
||||
iscsit_close_session(sess);
|
||||
}
|
||||
|
|
|
@ -933,22 +933,7 @@ void iscsit_handle_nopin_response_timeout(struct timer_list *t)
|
|||
conn->nopin_response_timer_flags &= ~ISCSI_TF_RUNNING;
|
||||
spin_unlock_bh(&conn->nopin_timer_lock);
|
||||
|
||||
{
|
||||
struct iscsi_portal_group *tpg = conn->sess->tpg;
|
||||
struct iscsi_tiqn *tiqn = tpg->tpg_tiqn;
|
||||
|
||||
if (tiqn) {
|
||||
spin_lock_bh(&tiqn->sess_err_stats.lock);
|
||||
strcpy(tiqn->sess_err_stats.last_sess_fail_rem_name,
|
||||
conn->sess->sess_ops->InitiatorName);
|
||||
tiqn->sess_err_stats.last_sess_failure_type =
|
||||
ISCSI_SESS_ERR_CXN_TIMEOUT;
|
||||
tiqn->sess_err_stats.cxn_timeout_errors++;
|
||||
atomic_long_inc(&conn->sess->conn_timeout_errors);
|
||||
spin_unlock_bh(&tiqn->sess_err_stats.lock);
|
||||
}
|
||||
}
|
||||
|
||||
iscsit_fill_cxn_timeout_err_stats(sess);
|
||||
iscsit_cause_connection_reinstatement(conn, 0);
|
||||
iscsit_dec_conn_usage_count(conn);
|
||||
}
|
||||
|
@ -1407,3 +1392,22 @@ struct iscsi_tiqn *iscsit_snmp_get_tiqn(struct iscsi_conn *conn)
|
|||
|
||||
return tpg->tpg_tiqn;
|
||||
}
|
||||
|
||||
void iscsit_fill_cxn_timeout_err_stats(struct iscsi_session *sess)
|
||||
{
|
||||
struct iscsi_portal_group *tpg = sess->tpg;
|
||||
struct iscsi_tiqn *tiqn = tpg->tpg_tiqn;
|
||||
|
||||
if (!tiqn)
|
||||
return;
|
||||
|
||||
spin_lock_bh(&tiqn->sess_err_stats.lock);
|
||||
strlcpy(tiqn->sess_err_stats.last_sess_fail_rem_name,
|
||||
sess->sess_ops->InitiatorName,
|
||||
sizeof(tiqn->sess_err_stats.last_sess_fail_rem_name));
|
||||
tiqn->sess_err_stats.last_sess_failure_type =
|
||||
ISCSI_SESS_ERR_CXN_TIMEOUT;
|
||||
tiqn->sess_err_stats.cxn_timeout_errors++;
|
||||
atomic_long_inc(&sess->conn_timeout_errors);
|
||||
spin_unlock_bh(&tiqn->sess_err_stats.lock);
|
||||
}
|
||||
|
|
|
@ -67,5 +67,6 @@ extern int rx_data(struct iscsi_conn *, struct kvec *, int, int);
|
|||
extern int tx_data(struct iscsi_conn *, struct kvec *, int, int);
|
||||
extern void iscsit_collect_login_stats(struct iscsi_conn *, u8, u8);
|
||||
extern struct iscsi_tiqn *iscsit_snmp_get_tiqn(struct iscsi_conn *);
|
||||
extern void iscsit_fill_cxn_timeout_err_stats(struct iscsi_session *);
|
||||
|
||||
#endif /*** ISCSI_TARGET_UTIL_H ***/
|
||||
|
|
Loading…
Reference in New Issue