From patchwork Mon Jul 10 22:47:36 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Mauricio Faria de Oliveira X-Patchwork-Id: 9833847 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8449860363 for ; Mon, 10 Jul 2017 22:49:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 745A4283C7 for ; Mon, 10 Jul 2017 22:49:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 654492847D; Mon, 10 Jul 2017 22:49:15 +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=-6.9 required=2.0 tests=BAYES_00,RCVD_IN_DNSWL_HI autolearn=unavailable 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 D4DE4283C7 for ; Mon, 10 Jul 2017 22:49:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755131AbdGJWtI (ORCPT ); Mon, 10 Jul 2017 18:49:08 -0400 Received: from mx0b-001b2d01.pphosted.com ([148.163.158.5]:51014 "EHLO mx0a-001b2d01.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754956AbdGJWr5 (ORCPT ); Mon, 10 Jul 2017 18:47:57 -0400 Received: from pps.filterd (m0098421.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.21/8.16.0.21) with SMTP id v6AMYSnf059597 for ; Mon, 10 Jul 2017 18:47:56 -0400 Received: from e24smtp03.br.ibm.com (e24smtp03.br.ibm.com [32.104.18.24]) by mx0a-001b2d01.pphosted.com with ESMTP id 2bma0nv00p-1 (version=TLSv1.2 cipher=AES256-SHA bits=256 verify=NOT) for ; Mon, 10 Jul 2017 18:47:56 -0400 Received: from localhost by e24smtp03.br.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Mon, 10 Jul 2017 19:47:54 -0300 Received: from d24relay02.br.ibm.com (9.13.39.42) by e24smtp03.br.ibm.com (10.172.0.139) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Mon, 10 Jul 2017 19:47:53 -0300 Received: from d24av04.br.ibm.com (d24av04.br.ibm.com [9.8.31.97]) by d24relay02.br.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id v6AMlqDR15991010; Mon, 10 Jul 2017 19:47:52 -0300 Received: from d24av04.br.ibm.com (localhost [127.0.0.1]) by d24av04.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id v6AMlqij009522; Mon, 10 Jul 2017 19:47:53 -0300 Received: from t440.ibm.com ([9.85.207.174]) by d24av04.br.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with ESMTP id v6AMldAL009404; Mon, 10 Jul 2017 19:47:50 -0300 From: Mauricio Faria de Oliveira To: jejb@linux.vnet.ibm.com, martin.petersen@oracle.com Cc: hare@suse.de, bart.vanassche@sandisk.com, linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 3/4] scsi: scsi_dh_alua: do not print RTPG state if it remains unavailable/standby Date: Mon, 10 Jul 2017 19:47:36 -0300 X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1499726857-7875-1-git-send-email-mauricfo@linux.vnet.ibm.com> References: <1499726857-7875-1-git-send-email-mauricfo@linux.vnet.ibm.com> X-TM-AS-MML: disable x-cbid: 17071022-0024-0000-0000-00000189DEE6 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 17071022-0025-0000-0000-0000165208D7 Message-Id: <1499726857-7875-4-git-send-email-mauricfo@linux.vnet.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10432:, , definitions=2017-07-10_08:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 spamscore=0 suspectscore=0 malwarescore=0 phishscore=0 adultscore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1703280000 definitions=main-1707100389 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Path checkers will check paths of a port group in unavailable/standby state more frequently (as they are 'failed') - possibly for a long or indefinite period of time, and/or for a large number of paths. That might flood the kernel log with scsi_dh_alua RTPG state messages, due to the recheck scheduled in alua_check_sense() to update PG state. So, do not to print such message if unavailable/standby state remains (i.e., the PG did not transition to/from such states). All other cases continue to be printed. Signed-off-by: Mauricio Faria de Oliveira --- v2: - changed v1's alua_state_remains() into alua_rtpg_print_check(), which includes in the states (not) to print for (deduplicates code). - added support for Standby state too (requested in patch 1 of this set) (Bart Van Assche ) - remove superfluous parentheses in return statement. (Bart Van Assche ) - remove likely() hint (Bart Van Assche ) drivers/scsi/device_handler/scsi_dh_alua.c | 35 ++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/drivers/scsi/device_handler/scsi_dh_alua.c b/drivers/scsi/device_handler/scsi_dh_alua.c index 937341ddb767..e0bf0827a980 100644 --- a/drivers/scsi/device_handler/scsi_dh_alua.c +++ b/drivers/scsi/device_handler/scsi_dh_alua.c @@ -572,6 +572,30 @@ static void alua_rtpg_print_supported(struct scsi_device *sdev, } /* + * alua_rtpg_print_check - Whether to print RTPG state information + * on particular state transitions. + * @old_state: the old state value. + * @new_state: the new state value. + */ +static bool alua_rtpg_print_check(int old_state, int new_state) +{ + /* + * Do not print RTPG state information in case + * state remains either unavailable or standby. + * + * Print it for everything else. + */ + + switch (old_state) { + case SCSI_ACCESS_STATE_UNAVAILABLE: + case SCSI_ACCESS_STATE_STANDBY: + return old_state != new_state; + default: + return 1; + } +} + +/* * alua_rtpg - Evaluate REPORT TARGET GROUP STATES * @sdev: the device to be evaluated. * @@ -706,6 +730,7 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) if ((tmp_pg == pg) || !(tmp_pg->flags & ALUA_PG_RUNNING)) { struct alua_dh_data *h; + int tmp_pg_state_orig = tmp_pg->state; tmp_pg->state = desc[0] & 0x0f; tmp_pg->pref = desc[0] >> 7; @@ -718,10 +743,12 @@ static int alua_rtpg(struct scsi_device *sdev, struct alua_port_group *pg) } rcu_read_unlock(); - if (tmp_pg == pg) - alua_rtpg_print_supported(sdev, tmp_pg, desc[1]); - else - alua_rtpg_print(sdev, tmp_pg); + if (alua_rtpg_print_check(tmp_pg_state_orig, tmp_pg->state)) { + if (tmp_pg == pg) + alua_rtpg_print_supported(sdev, tmp_pg, desc[1]); + else + alua_rtpg_print(sdev, tmp_pg); + } } spin_unlock_irqrestore(&tmp_pg->lock, flags); }