From patchwork Tue Oct 9 11:37:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Disseldorp X-Patchwork-Id: 10632365 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28D9216B1 for ; Tue, 9 Oct 2018 11:37:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 163AA2884A for ; Tue, 9 Oct 2018 11:37:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AD5E28C31; Tue, 9 Oct 2018 11:37:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A49F12884A for ; Tue, 9 Oct 2018 11:37:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726451AbeJISxv (ORCPT ); Tue, 9 Oct 2018 14:53:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:52906 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726160AbeJISxu (ORCPT ); Tue, 9 Oct 2018 14:53:50 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 9BE19AFED for ; Tue, 9 Oct 2018 11:37:16 +0000 (UTC) From: David Disseldorp To: target-devel@vger.kernel.org Cc: David Disseldorp Subject: [PATCH 1/4] target: use ISCSI_IQN_LEN in iscsi_target_stat Date: Tue, 9 Oct 2018 13:37:03 +0200 Message-Id: <20181009113706.27696-2-ddiss@suse.de> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20181009113706.27696-1-ddiss@suse.de> References: <20181009113706.27696-1-ddiss@suse.de> Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Move the ISCSI_IQN_LEN definition up, so that it can be used in more places instead of a hardcoded value. Signed-off-by: David Disseldorp --- drivers/target/iscsi/iscsi_target_stat.c | 4 ++-- include/target/iscsi/iscsi_target_core.h | 6 +++--- include/target/iscsi/iscsi_target_stat.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_stat.c b/drivers/target/iscsi/iscsi_target_stat.c index df0a39811dc2..bb98882bdaa7 100644 --- a/drivers/target/iscsi/iscsi_target_stat.c +++ b/drivers/target/iscsi/iscsi_target_stat.c @@ -328,10 +328,10 @@ static ssize_t iscsi_stat_tgt_attr_fail_intr_name_show(struct config_item *item, { struct iscsi_tiqn *tiqn = iscsi_tgt_attr_tiqn(item); struct iscsi_login_stats *lstat = &tiqn->login_stats; - unsigned char buf[224]; + unsigned char buf[ISCSI_IQN_LEN]; spin_lock(&lstat->lock); - snprintf(buf, 224, "%s", lstat->last_intr_fail_name[0] ? + snprintf(buf, ISCSI_IQN_LEN, "%s", lstat->last_intr_fail_name[0] ? lstat->last_intr_fail_name : NONE); spin_unlock(&lstat->lock); diff --git a/include/target/iscsi/iscsi_target_core.h b/include/target/iscsi/iscsi_target_core.h index f2e6abea8490..24c398f4a68f 100644 --- a/include/target/iscsi/iscsi_target_core.h +++ b/include/target/iscsi/iscsi_target_core.h @@ -25,6 +25,7 @@ struct sock; #define ISCSIT_TCP_BACKLOG 256 #define ISCSI_RX_THREAD_NAME "iscsi_trx" #define ISCSI_TX_THREAD_NAME "iscsi_ttx" +#define ISCSI_IQN_LEN 224 /* struct iscsi_node_attrib sanity values */ #define NA_DATAOUT_TIMEOUT 3 @@ -270,9 +271,9 @@ struct iscsi_conn_ops { }; struct iscsi_sess_ops { - char InitiatorName[224]; + char InitiatorName[ISCSI_IQN_LEN]; char InitiatorAlias[256]; - char TargetName[224]; + char TargetName[ISCSI_IQN_LEN]; char TargetAlias[256]; char TargetAddress[256]; u16 TargetPortalGroupTag; /* [0..65535] */ @@ -855,7 +856,6 @@ struct iscsi_wwn_stat_grps { }; struct iscsi_tiqn { -#define ISCSI_IQN_LEN 224 unsigned char tiqn[ISCSI_IQN_LEN]; enum tiqn_state_table tiqn_state; int tiqn_access_count; diff --git a/include/target/iscsi/iscsi_target_stat.h b/include/target/iscsi/iscsi_target_stat.h index 4d75a2c426ca..ff6a47209313 100644 --- a/include/target/iscsi/iscsi_target_stat.h +++ b/include/target/iscsi/iscsi_target_stat.h @@ -33,7 +33,7 @@ struct iscsi_sess_err_stats { u32 cxn_timeout_errors; u32 pdu_format_errors; u32 last_sess_failure_type; - char last_sess_fail_rem_name[224]; + char last_sess_fail_rem_name[ISCSI_IQN_LEN]; } ____cacheline_aligned; /* iSCSI login failure types (sub oids) */ @@ -56,7 +56,7 @@ struct iscsi_login_stats { u32 last_fail_type; int last_intr_fail_ip_family; struct sockaddr_storage last_intr_fail_sockaddr; - char last_intr_fail_name[224]; + char last_intr_fail_name[ISCSI_IQN_LEN]; } ____cacheline_aligned; /* iSCSI logout stats */ From patchwork Tue Oct 9 11:37:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Disseldorp X-Patchwork-Id: 10632367 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id C3CD113AA for ; Tue, 9 Oct 2018 11:37:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AFC892884A for ; Tue, 9 Oct 2018 11:37:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A491A28C3F; Tue, 9 Oct 2018 11:37:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C3C62884A for ; Tue, 9 Oct 2018 11:37:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726160AbeJISxv (ORCPT ); Tue, 9 Oct 2018 14:53:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:52918 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726103AbeJISxv (ORCPT ); Tue, 9 Oct 2018 14:53:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 783AEAFF6 for ; Tue, 9 Oct 2018 11:37:17 +0000 (UTC) From: David Disseldorp To: target-devel@vger.kernel.org Cc: David Disseldorp Subject: [PATCH 2/4] target: log Data-Out timeouts as errors Date: Tue, 9 Oct 2018 13:37:04 +0200 Message-Id: <20181009113706.27696-3-ddiss@suse.de> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20181009113706.27696-1-ddiss@suse.de> References: <20181009113706.27696-1-ddiss@suse.de> Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Data-Out timeouts resulting in connection outages should be logged as errors. Signed-off-by: David Disseldorp --- drivers/target/iscsi/iscsi_target_erl1.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c index 5efa42b939a1..d75cc11ca83c 100644 --- a/drivers/target/iscsi/iscsi_target_erl1.c +++ b/drivers/target/iscsi/iscsi_target_erl1.c @@ -1169,13 +1169,13 @@ void iscsit_handle_dataout_timeout(struct timer_list *t) na = iscsit_tpg_get_node_attrib(sess); if (!sess->sess_ops->ErrorRecoveryLevel) { - pr_debug("Unable to recover from DataOut timeout while" - " in ERL=0.\n"); + pr_err("Unable to recover from DataOut timeout while" + " in ERL=0, closing iSCSI connection.\n"); goto failure; } if (++cmd->dataout_timeout_retries == na->dataout_timeout_retries) { - pr_debug("Command ITT: 0x%08x exceeded max retries" + pr_err("Command ITT: 0x%08x exceeded max retries" " for DataOUT timeout %u, closing iSCSI connection.\n", cmd->init_task_tag, na->dataout_timeout_retries); goto failure; From patchwork Tue Oct 9 11:37:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Disseldorp X-Patchwork-Id: 10632369 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E4E2B17E3 for ; Tue, 9 Oct 2018 11:37:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D07F9288F4 for ; Tue, 9 Oct 2018 11:37:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C4D672884A; Tue, 9 Oct 2018 11:37:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7D6A9288F4 for ; Tue, 9 Oct 2018 11:37:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726103AbeJISxv (ORCPT ); Tue, 9 Oct 2018 14:53:51 -0400 Received: from mx2.suse.de ([195.135.220.15]:52924 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726418AbeJISxv (ORCPT ); Tue, 9 Oct 2018 14:53:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 84F79B00E for ; Tue, 9 Oct 2018 11:37:17 +0000 (UTC) From: David Disseldorp To: target-devel@vger.kernel.org Cc: David Disseldorp Subject: [PATCH 3/4] target: stash sess_err_stats on Data-Out timeout Date: Tue, 9 Oct 2018 13:37:05 +0200 Message-Id: <20181009113706.27696-4-ddiss@suse.de> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20181009113706.27696-1-ddiss@suse.de> References: <20181009113706.27696-1-ddiss@suse.de> Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP sess_err_stats are currently filled on NOP ping timeout, but not Data-Out timeout. Stash details of Data-Out timeouts using a ISCSI_SESS_ERR_CXN_TIMEOUT value for last_sess_failure_type. Signed-off-by: David Disseldorp --- drivers/target/iscsi/iscsi_target_erl1.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/target/iscsi/iscsi_target_erl1.c b/drivers/target/iscsi/iscsi_target_erl1.c index d75cc11ca83c..44ba50feae6d 100644 --- a/drivers/target/iscsi/iscsi_target_erl1.c +++ b/drivers/target/iscsi/iscsi_target_erl1.c @@ -1224,6 +1224,21 @@ void iscsit_handle_dataout_timeout(struct timer_list *t) failure: spin_unlock_bh(&cmd->dataout_timeout_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_cause_connection_reinstatement(conn, 0); iscsit_dec_conn_usage_count(conn); } From patchwork Tue Oct 9 11:37:06 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Disseldorp X-Patchwork-Id: 10632371 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 230C23CF1 for ; Tue, 9 Oct 2018 11:37:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0FE522884A for ; Tue, 9 Oct 2018 11:37:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0471C288F4; Tue, 9 Oct 2018 11:37:20 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B612F28C40 for ; Tue, 9 Oct 2018 11:37:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726418AbeJISxw (ORCPT ); Tue, 9 Oct 2018 14:53:52 -0400 Received: from mx2.suse.de ([195.135.220.15]:52926 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1726439AbeJISxv (ORCPT ); Tue, 9 Oct 2018 14:53:51 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id 89C6DB011 for ; Tue, 9 Oct 2018 11:37:17 +0000 (UTC) From: David Disseldorp To: target-devel@vger.kernel.org Cc: David Disseldorp Subject: [PATCH 4/4] target: log NOP ping timeouts as errors Date: Tue, 9 Oct 2018 13:37:06 +0200 Message-Id: <20181009113706.27696-5-ddiss@suse.de> X-Mailer: git-send-email 2.13.7 In-Reply-To: <20181009113706.27696-1-ddiss@suse.de> References: <20181009113706.27696-1-ddiss@suse.de> Sender: target-devel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: target-devel@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Events resulting in connection outages like this should be logged as errors. Signed-off-by: David Disseldorp --- drivers/target/iscsi/iscsi_target_util.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/target/iscsi/iscsi_target_util.c b/drivers/target/iscsi/iscsi_target_util.c index 49be1e41290c..b20e87f0795f 100644 --- a/drivers/target/iscsi/iscsi_target_util.c +++ b/drivers/target/iscsi/iscsi_target_util.c @@ -925,7 +925,7 @@ void iscsit_handle_nopin_response_timeout(struct timer_list *t) return; } - pr_debug("Did not receive response to NOPIN on CID: %hu on" + pr_err("Did not receive response to NOPIN on CID: %hu on" " SID: %u, failing connection.\n", conn->cid, conn->sess->sid); conn->nopin_response_timer_flags &= ~ISCSI_TF_RUNNING;