From patchwork Thu Nov 5 06:09:52 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 318314 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=BAYES_00, DATE_IN_PAST_06_12, DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY, MIME_NO_TEXT, SPF_HELO_NONE, SPF_PASS, T_TVD_MIME_NO_HEADERS, USER_AGENT_GIT autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0EA9C00A89 for ; Thu, 5 Nov 2020 13:03:19 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3FA752087D for ; Thu, 5 Nov 2020 13:03:18 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="P40s09fa" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729768AbgKENDS (ORCPT ); Thu, 5 Nov 2020 08:03:18 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59186 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725468AbgKENDR (ORCPT ); Thu, 5 Nov 2020 08:03:17 -0500 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C83C3C0613CF for ; Thu, 5 Nov 2020 05:03:17 -0800 (PST) Received: by mail-pl1-x630.google.com with SMTP id g11so740883pll.13 for ; Thu, 05 Nov 2020 05:03:17 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=from:to:cc:subject:date:message-id; bh=PQh0cB4rrXx2GfrJLwLF2oq6CQHVuWzlfx4+vsB/rXA=; b=P40s09fa3zES1B//vyA1QrTp7iXSEQ3Y1/rivMkIoWoNUjNBDOZ0jM7cUJfaUHk/H7 Z15NkpkmWQ5VTZMmyInrTGZdr2QLV8wQiis9Kbv2H+DR5Ga4ml+nA9dmcUkqKoJdmrwC 570pYB+AiGd3snr4qB2OitHCtvvbqbyX2S4Nk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=PQh0cB4rrXx2GfrJLwLF2oq6CQHVuWzlfx4+vsB/rXA=; b=MsfsUWWF9y337gUPmjWH5bbzI6g/BFwBVh+J67ts466h26binXs3B1LnobtNRNRLKP KH0HNxZ5r7YitUnv1vJhJH8tF33fKy016exY4iTHCrRI9cusYfM//3uLrkqKQMClDI+x r1r44NN15ObYHUaoluV0VMFz7kRpTlzFh3lc57s8Dxp91Rr6irOH6b+ZjJjY2BRlucKw DFzSUEMROov/V9febmeL4fsnwAbYRnqHdSVBhAu7uA/Z2dDRlX24Dk3qc03FWufqiiAt kZq656Sxq/6TL7OLoALnp+1/0yRpA2BAOi4Tw3Wkq9XiwLonDywxWv3Dac12kmPI0Eiq PO3Q== X-Gm-Message-State: AOAM533f6UQL9ScqpI+riFywbO2fsFSshwW+1+PhSuCasBIYzK0N5ew0 3YijgBh3EU5Hxufrs8sCcA8rVAM7NSO0koAzNnGFXr3fDcOK4lkjwLRuUCAwHpNZOnar7bMufNg DDu9LWUss4ROqldOU+QfcS8Pe9s8lLvJoobhOR3RmSTFXFAA4T31BU1+cF+BocXX0I90Zi+4QI+ 9+werP/6p2pG4= X-Google-Smtp-Source: ABdhPJyNhCunBxKX8nnI08soBhL1MlJ2i6asWY8ddr44aiPMBfA9gyRR0rlX2h7ZukXi4lGWqZEPOA== X-Received: by 2002:a17:90a:fa93:: with SMTP id cu19mr2467656pjb.117.1604581396656; Thu, 05 Nov 2020 05:03:16 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id y141sm2491319pfb.17.2020.11.05.05.03.13 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 05 Nov 2020 05:03:15 -0800 (PST) From: Muneendra To: linux-scsi@vger.kernel.org, michael.christie@oracle.com, hare@suse.de Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, Muneendra Subject: [PATCH v6 0/4] scsi: Support to handle Intermittent errors Date: Thu, 5 Nov 2020 11:39:52 +0530 Message-Id: <1604556596-27228-1-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org This patch adds a support to prevent retries of all the io's after an abort succeeds on a particular device when transport connectivity to the device is encountering intermittent errors. Intermittent connectivity is a condition that can be detected by transport fabric notifications. A service can monitor the ELS notifications and take action on all the outstanding io's of a scsi device at that instant. This feature is intended to be used when the device is part of a multipath environment. When the service detects the poor connectivity, the multipath path can be placed in a marginal path group and ignored further io operations. After placing a path in the marginal path group,the daemon sets the port_state to Marginal which sets bit in scmd->state for all the io's on that particular device with the new sysfs interface provided in this patch.This prevent retries of all the io's if an io hits a scsi timeout which inturn issues an abort. On Abort succeeds on a marginal path the io will be immediately retried on another active path.On abort fails then the things escalates to existing target reset sg interface recovery process. Below is the interface provided to set the port state to Marginal and Online. echo "Marginal" >> /sys/class/fc_remote_ports/rport-X\:Y-Z/port_state echo "Online" >> /sys/class/fc_remote_ports/rport-X\:Y-Z/port_state The patches were cut against 5.10/scsi-queue tree --- v6: Reordered the patches to make patch ordering and more logical. v5: Added the DID_TRANSPORT_MARGINAL case to scsi_decide_disposition Made changes to clear the SCMD_NORETRIES_ABORT bit if the port_state has changed from marginal to online due to port_delete and port_add as we need the normal cmd retry behaviour while we are calling the eh handlers. Made changes in fc_scsi_scan_rport as we are checking FC_PORTSTATE_ONLINE instead of FC_PORTSTATE_ONLINE and FC_PORTSTATE_MARGINAL v4: Made changes in fc_eh_timed_out callout to set the SCMD_NORETRIES_ABORT if port state is marginal With this change, we removed the code to loop over running commands and fc_remote_port_chkready changes to set the SCMD_NORETRIES_ABORT Removed the scsi_cmd argument for fc_remote_port_chkready and reverted back the patches that addressed this change(argument) Removed unnecessary comments Handle the return of errors on failure. v3: Removed the port_state from starget attributes. Enabled the store functionality for port_state under remote port Added a new argument to scsi_cmd to fc_remote_port_chkready Used the existing scsi command iterators scsi_host_busy_iter. Rearranged the patches Added new patches to add new argument for fc_remote_port_chkready v2: Added new error code DID_TRANSPORT_MARGINAL to handle marginal errors. Added a new rport_state FC_PORTSTATE_MARGINAL and also added a new sysfs interface port_state to set the port_state to marginal. Added the support in lpfc to handle the marginal state. Muneendra (4): scsi: Added a new definition in scsi_cmnd.h scsi: No retries on abort success scsi_transport_fc: Added a new rport state FC_PORTSTATE_MARGINAL scsi_transport_fc: Added store fucntionality to set the rport port_state using sysfs drivers/scsi/scsi_error.c | 17 +++++ drivers/scsi/scsi_lib.c | 2 + drivers/scsi/scsi_transport_fc.c | 108 +++++++++++++++++++++++++------ include/scsi/scsi.h | 1 + include/scsi/scsi_cmnd.h | 3 + include/scsi/scsi_transport_fc.h | 19 ++++++ 6 files changed, 131 insertions(+), 19 deletions(-)