From patchwork Tue Nov 3 07:15:08 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 315375 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=-11.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,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 68405C388F9 for ; Tue, 3 Nov 2020 14:08:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id DDBD722264 for ; Tue, 3 Nov 2020 14:08:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="K2+iM6Tl" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729528AbgKCOIl (ORCPT ); Tue, 3 Nov 2020 09:08:41 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43908 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729361AbgKCOIk (ORCPT ); Tue, 3 Nov 2020 09:08:40 -0500 Received: from mail-pl1-x643.google.com (mail-pl1-x643.google.com [IPv6:2607:f8b0:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E417C0613D1 for ; Tue, 3 Nov 2020 06:08:40 -0800 (PST) Received: by mail-pl1-x643.google.com with SMTP id x23so8620931plr.6 for ; Tue, 03 Nov 2020 06:08:40 -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:in-reply-to:references; bh=tGPF1tZzbjg9RDUrVBN5ZLmFYpdjHRMWH4T2ul90m0c=; b=K2+iM6Tl55o1HcoKQEBSmoT3t7GxzV/wDQgS88qTXlW3BFGrWXaga+DkSQtQVqIRrX 5aKfa6G+6cWEDra7rVD/lhrSsbtSPhDgq2VAi/bYj74KXvc0kJISlnpqqVc0P/jufNxZ ZGaTy3LmSzzoUIb5pXmHksv7IyNR4jOa4BBVU= 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:in-reply-to :references; bh=tGPF1tZzbjg9RDUrVBN5ZLmFYpdjHRMWH4T2ul90m0c=; b=OTPQBaP1HhTkLzszPPPt1jtWfdQCu67/MLBAXt3+XcHHJZQXgbJw8+IDuDQFGXYoCU VeaK2VqIznYouB6djWmYVMUhTXPDRgCojvjIXk+ziO1drkS/8M1ESqZqq8gUUbQBdIEe TY6JyJhy4osQHmdmPVpIqR+LGkeYPyV/vbsoW4iJiJl76hU7P0ZEX9IdYs0eylZWqH7J AsOzecyVHp9iNiP/qSkyZT0LBV1x/29Oz8EYdhqbsnJZ0IMyzx9KLcOBWhQYK2QKGXe2 FfClQ5lZg0dH0Wxs65TEA9gF6CQrir3n+H9ZqBUJlf2nVnUfC2QW7XTddEY3fTM3x+ga FP+g== X-Gm-Message-State: AOAM531dTeFmH5/uxIG2YWaNrgexQoEnaX0fb+i4BjrXK37IoyZTyAZa XXzwKyExHpdo4YPnXI57URvABopGXG6dUwGiouwmnBVpNuOUVwk8tOYbPpMxhAD5oqUaxYRnlp6 beBm8tMnN8q93o1KIMVwGTu0+AbaAUNLsGE6a8/TpwUm61K/K0rwZeyoFBvno3Vn1wQ8EIVvq8I 3JnN9C0ee5biw= X-Google-Smtp-Source: ABdhPJyf7BIEUIRwRqDLlrGE3Zla/rRkBItcySnBqzdS9tbPCAF2Ff9yjLc6uZvmPQQGZMt4QMDYFg== X-Received: by 2002:a17:902:b196:b029:d5:a8fd:9a1c with SMTP id s22-20020a170902b196b02900d5a8fd9a1cmr26011382plr.44.1604412519300; Tue, 03 Nov 2020 06:08:39 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r19sm3525959pjo.23.2020.11.03.06.08.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 06:08:38 -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 v5 1/5] scsi: Added a new definition in scsi_cmnd.h Date: Tue, 3 Nov 2020 12:45:08 +0530 Message-Id: <1604387712-19801-2-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604387712-19801-1-git-send-email-muneendra.kumar@broadcom.com> References: <1604387712-19801-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Added a new definition SCMD_NORETRIES_ABORT in scsi_cmnd.h The SCMD_NORETRIES_ABORT defines the third bit postion in scmd->state Signed-off-by: Muneendra --- v5: No Change v4: No Change v3: No change v2: Modified the commit log --- include/scsi/scsi_cmnd.h | 3 +++ 1 file changed, 3 insertions(+) diff --git a/include/scsi/scsi_cmnd.h b/include/scsi/scsi_cmnd.h index 69ade4fb71aa..8dec4ec6bd5f 100644 --- a/include/scsi/scsi_cmnd.h +++ b/include/scsi/scsi_cmnd.h @@ -64,6 +64,9 @@ struct scsi_pointer { /* for scmd->state */ #define SCMD_STATE_COMPLETE 0 #define SCMD_STATE_INFLIGHT 1 +#define SCMD_NORETRIES_ABORT 2 /* If this bit is set then there won't be any + * retries of scmd on abort success + */ struct scsi_cmnd { struct scsi_request req; From patchwork Tue Nov 3 07:15:09 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 315373 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=-11.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,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 85613C388F7 for ; Tue, 3 Nov 2020 14:08:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 2B0A522243 for ; Tue, 3 Nov 2020 14:08:46 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="WISZXAUB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729527AbgKCOIp (ORCPT ); Tue, 3 Nov 2020 09:08:45 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729529AbgKCOIo (ORCPT ); Tue, 3 Nov 2020 09:08:44 -0500 Received: from mail-pl1-x641.google.com (mail-pl1-x641.google.com [IPv6:2607:f8b0:4864:20::641]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 901CDC0613D1 for ; Tue, 3 Nov 2020 06:08:44 -0800 (PST) Received: by mail-pl1-x641.google.com with SMTP id w11so8599689pll.8 for ; Tue, 03 Nov 2020 06:08:44 -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:in-reply-to:references; bh=u3pSgIxg9wnYG+RnsaKd7ypSQe33hfPQEmk6SiSOaxg=; b=WISZXAUBASxPYBTH9mXrQFsD6yFWU+E/NKIc1unzRoIhcOZVpHT7fyo+0MUJgxM6Pw s8e80BE/qEsN2kBjHq9eX1XQVWMETlLx6EftG5pc6T9a4SmlRxSBwRgDkdyv1Y6HtTko CEaQW3rtLMsZlOpgB74eXAiVtERLg6QgoIfSI= 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:in-reply-to :references; bh=u3pSgIxg9wnYG+RnsaKd7ypSQe33hfPQEmk6SiSOaxg=; b=IDfgVHfBKPQXpG0A8cV+O3OvefuEzey3bh2TgstlE4O6xS3LWyLsTLcYR+glHWqI8p JxJfqL3qLgTEdtjVh0MZyROL8U8Bd8Z1uvcOqa+ed9ypXwfTxSK7x6D5tt3i0CRAt8Q2 3ANhSdPN7/aGuaS2F6uamBvRt6zeFXTSQ1GRSw0dKJqTRx8RQ/Qz2iY0DlePLPvZN6CT EsElfa+sFqFh5I62MU40Jr7/LMFBV9WOobNgSoqjYiKrkrk0UEasRg80d6roT9tORSIZ kIywx0J61GVpL9vg0sF8eEOMUtu4o5s6OZHvKpe+Zr2e9Spgp0j4qPYHw+S5NpTb0ofZ aypA== X-Gm-Message-State: AOAM530fPPLDMfohIxOIkPPVpYOnrA8tJ5vFhsUpoSw2AuSZOrFTJmWb t5R8/WGHyZ7idebjYYxR9k43YS5ASp5MHGvZpe9IO/EyxHxs9tlgZjYm/6Sd75wehngeRq5lxft /VWYoZBnQnEIf2d4yrk9YtEIsGpEeM0a9/kWi/hCRWY+yXWTFG9Fn1/RCvGHYoSIS13cB32atRL GVoJj3SyhkQbo= X-Google-Smtp-Source: ABdhPJyUMdsXIGecoSjXJuxuO2dSjFphhu8xK9301K4czRMlNaGgVXx16X98STI4B7fh7Yozdve6QQ== X-Received: by 2002:a17:902:8698:b029:d3:b362:7342 with SMTP id g24-20020a1709028698b02900d3b3627342mr25457699plo.50.1604412523396; Tue, 03 Nov 2020 06:08:43 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r19sm3525959pjo.23.2020.11.03.06.08.39 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 06:08:42 -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 v5 2/5] scsi: Added a new error code in scsi.h Date: Tue, 3 Nov 2020 12:45:09 +0530 Message-Id: <1604387712-19801-3-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604387712-19801-1-git-send-email-muneendra.kumar@broadcom.com> References: <1604387712-19801-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Added a new error code DID_TRANSPORT_MARGINAL to handle marginal errors in scsi.h Clearing the SCMD_NORETRIES_ABORT bit in state flag before blk_mq_start_request Signed-off-by: Muneendra --- v5: No Change v4: No change v3: Rearranged the patch by merging second hunk of the previous(v2) patch3 to this patch v2: Newpatch --- drivers/scsi/scsi_lib.c | 1 + include/scsi/scsi.h | 1 + 2 files changed, 2 insertions(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 1a2e9bab42ef..2b5dea07498e 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1660,6 +1660,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx, req->rq_flags |= RQF_DONTPREP; } else { clear_bit(SCMD_STATE_COMPLETE, &cmd->state); + clear_bit(SCMD_NORETRIES_ABORT, &cmd->state); } cmd->flags &= SCMD_PRESERVED_FLAGS; diff --git a/include/scsi/scsi.h b/include/scsi/scsi.h index 5339baadc082..5b287ad8b727 100644 --- a/include/scsi/scsi.h +++ b/include/scsi/scsi.h @@ -159,6 +159,7 @@ static inline int scsi_is_wlun(u64 lun) * paths might yield different results */ #define DID_ALLOC_FAILURE 0x12 /* Space allocation on the device failed */ #define DID_MEDIUM_ERROR 0x13 /* Medium error */ +#define DID_TRANSPORT_MARGINAL 0x14 /* Transport marginal errors */ #define DRIVER_OK 0x00 /* Driver status */ /* From patchwork Tue Nov 3 07:15:11 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 315372 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=-11.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,INCLUDES_PATCH,MAILING_LIST_MULTI, MIME_HEADER_CTYPE_ONLY,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, T_TVD_MIME_NO_HEADERS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 8B39AC61DD8 for ; Tue, 3 Nov 2020 14:10:40 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 37FB122264 for ; Tue, 3 Nov 2020 14:10:40 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="OU0VCG46" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729541AbgKCOKj (ORCPT ); Tue, 3 Nov 2020 09:10:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43954 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729470AbgKCOIy (ORCPT ); Tue, 3 Nov 2020 09:08:54 -0500 Received: from mail-pf1-x441.google.com (mail-pf1-x441.google.com [IPv6:2607:f8b0:4864:20::441]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 485FEC0613D1 for ; Tue, 3 Nov 2020 06:08:54 -0800 (PST) Received: by mail-pf1-x441.google.com with SMTP id c20so14278874pfr.8 for ; Tue, 03 Nov 2020 06:08:54 -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:in-reply-to:references; bh=zFAyFa3GXu2CuUWMnmaYYZToQuRMkUUMDU7jXY22ATc=; b=OU0VCG4660hcdxrzHGzZY11caVZlas/NJK8vD1ByWiTv1cy9N1scmJxnumEifi9irb GJO5zf0CpANJoRvQRpJWaD2ZFSPS91Gs3F4rmi2YqS5+d2LUSOBGPSTailvGw44VAhsD /Y1rplipDb+N+0ZDl6a9lzfI9SruRHp9UhvQY= 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:in-reply-to :references; bh=zFAyFa3GXu2CuUWMnmaYYZToQuRMkUUMDU7jXY22ATc=; b=IZjDrhBO/2p+pD824u2y9JbDhRdGdnagbyBQm2Sb2FKa2z8dSVLBPnv7yCE40fVRGF FsqFJB/wy8dpUh1zvTJ2n+JAuj6uJ00Q5aIiP5mqF8A5NCaBGRmgn2197/AtoRQ1bRUV 1bhA9je/BzCx8ZkTNLpY7Fc6az23pfvxSxKJPcdVQzicUaZa265b2mai7t7TsvSEpUUy SmD4BX2PKTDp9KOKwE/M/5xvCrYtpKFK+XviRo5NyAc0aLqkhp8yQoD5MrMo4AarUdvr g+DN6+QDNp4WwMfTNNloK4DryXSohDWbiPtmOJyh0MXRIufCdcvepETjE4N8NKaXMbzE KHiQ== X-Gm-Message-State: AOAM533x6VoCOMvoXWF8XnOuxMkeSveAW+urL4kx6JjPjwkbX3JvoMB4 l9spaGqdntL00ig0+FqWXocRTdz8e8zyux+OCbe2IEMQ3U72TttL/aGDDZGUKezhQAC3nyJ/LTh GjAl2lNyViPf5e6/Ib9HdZeFYpIX6WptLMXnMrs3Lnl9ZoB1F9/QadSi7jxQOn1INYN43x+Z3YF GRTedf60TtzU8= X-Google-Smtp-Source: ABdhPJyRypSw8DqL1guD3/ezkMdEoi3EHSwimQrnEZ9tXd3Y0snjMVZvhmaXUNkJ6uv8s7vPOB98NQ== X-Received: by 2002:a63:7985:: with SMTP id u127mr16947753pgc.396.1604412533286; Tue, 03 Nov 2020 06:08:53 -0800 (PST) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id r19sm3525959pjo.23.2020.11.03.06.08.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Tue, 03 Nov 2020 06:08:51 -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 v5 4/5] scsi_transport_fc: Added a new rport state FC_PORTSTATE_MARGINAL Date: Tue, 3 Nov 2020 12:45:11 +0530 Message-Id: <1604387712-19801-5-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1604387712-19801-1-git-send-email-muneendra.kumar@broadcom.com> References: <1604387712-19801-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Added a new rport state FC_PORTSTATE_MARGINAL. Added a new inline function fc_rport_chkmarginal_set_noretries which will set the SCMD_NORETRIES_ABORT bit in cmd->state if rport state is marginal. Made changes in fc_eh_timed_out to call fc_rport_chkmarginal_set_noretries Also made changes in fc_remote_port_delete,fc_user_scan_tgt, fc_timeout_deleted_rport functions to handle the new rport state FC_PORTSTATE_MARGINAL. Made changes in fc_block_scsi_eh to clear the SCMD_NORETRIES_ABORT bit if the port_state is not marginal Signed-off-by: Muneendra --- v5: 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 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 to call fc_rport_chkmarginal_set_noretries so that SCMD_NORETRIES_ABORT bit in cmd->state is set if rport state is marginal. Removed the newly added scsi_cmd argument to fc_remote_port_chkready as the current patch handles only SCSI EH timeout/abort case. v3: Rearranged the patch so that all the changes with respect to new rport state is part of this patch. Added a new argument to scsi_cmd to fc_remote_port_chkready v2: New patch --- drivers/scsi/scsi_transport_fc.c | 47 ++++++++++++++++++++------------ include/scsi/scsi_transport_fc.h | 19 +++++++++++++ 2 files changed, 49 insertions(+), 17 deletions(-) diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 2ff7f06203da..0ac490816f3e 100644 --- a/drivers/scsi/scsi_transport_fc.c +++ b/drivers/scsi/scsi_transport_fc.c @@ -142,20 +142,23 @@ fc_enum_name_search(host_event_code, fc_host_event_code, static struct { enum fc_port_state value; char *name; + int matchlen; } fc_port_state_names[] = { - { FC_PORTSTATE_UNKNOWN, "Unknown" }, - { FC_PORTSTATE_NOTPRESENT, "Not Present" }, - { FC_PORTSTATE_ONLINE, "Online" }, - { FC_PORTSTATE_OFFLINE, "Offline" }, - { FC_PORTSTATE_BLOCKED, "Blocked" }, - { FC_PORTSTATE_BYPASSED, "Bypassed" }, - { FC_PORTSTATE_DIAGNOSTICS, "Diagnostics" }, - { FC_PORTSTATE_LINKDOWN, "Linkdown" }, - { FC_PORTSTATE_ERROR, "Error" }, - { FC_PORTSTATE_LOOPBACK, "Loopback" }, - { FC_PORTSTATE_DELETED, "Deleted" }, + { FC_PORTSTATE_UNKNOWN, "Unknown", 7}, + { FC_PORTSTATE_NOTPRESENT, "Not Present", 11 }, + { FC_PORTSTATE_ONLINE, "Online", 6 }, + { FC_PORTSTATE_OFFLINE, "Offline", 7 }, + { FC_PORTSTATE_BLOCKED, "Blocked", 7 }, + { FC_PORTSTATE_BYPASSED, "Bypassed", 8 }, + { FC_PORTSTATE_DIAGNOSTICS, "Diagnostics", 11 }, + { FC_PORTSTATE_LINKDOWN, "Linkdown", 8 }, + { FC_PORTSTATE_ERROR, "Error", 5 }, + { FC_PORTSTATE_LOOPBACK, "Loopback", 8 }, + { FC_PORTSTATE_DELETED, "Deleted", 7 }, + { FC_PORTSTATE_MARGINAL, "Marginal", 8 }, }; fc_enum_name_search(port_state, fc_port_state, fc_port_state_names) +fc_enum_name_match(port_state, fc_port_state, fc_port_state_names) #define FC_PORTSTATE_MAX_NAMELEN 20 @@ -2074,6 +2077,7 @@ fc_eh_timed_out(struct scsi_cmnd *scmd) if (rport->port_state == FC_PORTSTATE_BLOCKED) return BLK_EH_RESET_TIMER; + fc_rport_chkmarginal_set_noretries(rport, scmd); return BLK_EH_DONE; } EXPORT_SYMBOL(fc_eh_timed_out); @@ -2095,7 +2099,8 @@ fc_user_scan_tgt(struct Scsi_Host *shost, uint channel, uint id, u64 lun) if (rport->scsi_target_id == -1) continue; - if (rport->port_state != FC_PORTSTATE_ONLINE) + if ((rport->port_state != FC_PORTSTATE_ONLINE) && + (rport->port_state != FC_PORTSTATE_MARGINAL)) continue; if ((channel == rport->channel) && @@ -2958,7 +2963,8 @@ fc_remote_port_delete(struct fc_rport *rport) spin_lock_irqsave(shost->host_lock, flags); - if (rport->port_state != FC_PORTSTATE_ONLINE) { + if ((rport->port_state != FC_PORTSTATE_ONLINE) && + (rport->port_state != FC_PORTSTATE_MARGINAL)) { spin_unlock_irqrestore(shost->host_lock, flags); return; } @@ -3100,7 +3106,8 @@ fc_timeout_deleted_rport(struct work_struct *work) * target, validate it still is. If not, tear down the * scsi_target on it. */ - if ((rport->port_state == FC_PORTSTATE_ONLINE) && + if (((rport->port_state == FC_PORTSTATE_ONLINE) || + (rport->port_state == FC_PORTSTATE_MARGINAL)) && (rport->scsi_target_id != -1) && !(rport->roles & FC_PORT_ROLE_FCP_TARGET)) { dev_printk(KERN_ERR, &rport->dev, @@ -3243,7 +3250,8 @@ fc_scsi_scan_rport(struct work_struct *work) struct fc_internal *i = to_fc_internal(shost->transportt); unsigned long flags; - if ((rport->port_state == FC_PORTSTATE_ONLINE) && + if (((rport->port_state == FC_PORTSTATE_ONLINE) || + (rport->port_state == FC_PORTSTATE_MARGINAL)) && (rport->roles & FC_PORT_ROLE_FCP_TARGET) && !(i->f->disable_target_scan)) { scsi_scan_target(&rport->dev, rport->channel, @@ -3308,11 +3316,15 @@ EXPORT_SYMBOL(fc_block_rport); int fc_block_scsi_eh(struct scsi_cmnd *cmnd) { struct fc_rport *rport = starget_to_rport(scsi_target(cmnd->device)); + int ret = 0; if (WARN_ON_ONCE(!rport)) return FAST_IO_FAIL; - return fc_block_rport(rport); + ret = fc_block_rport(rport); + if (rport->port_state != FC_PORTSTATE_MARGINAL) + clear_bit(SCMD_NORETRIES_ABORT, &cmnd->state); + return ret; } EXPORT_SYMBOL(fc_block_scsi_eh); @@ -3747,7 +3759,8 @@ static blk_status_t fc_bsg_rport_prep(struct fc_rport *rport) !(rport->flags & FC_RPORT_FAST_FAIL_TIMEDOUT)) return BLK_STS_RESOURCE; - if (rport->port_state != FC_PORTSTATE_ONLINE) + if ((rport->port_state != FC_PORTSTATE_ONLINE) && + (rport->port_state != FC_PORTSTATE_MARGINAL)) return BLK_STS_IOERR; return BLK_STS_OK; diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 1c7dd35cb7a0..829bade13b89 100644 --- a/include/scsi/scsi_transport_fc.h +++ b/include/scsi/scsi_transport_fc.h @@ -14,6 +14,7 @@ #include #include #include +#include #include #include @@ -67,6 +68,7 @@ enum fc_port_state { FC_PORTSTATE_ERROR, FC_PORTSTATE_LOOPBACK, FC_PORTSTATE_DELETED, + FC_PORTSTATE_MARGINAL, }; @@ -707,6 +709,22 @@ struct fc_function_template { unsigned long disable_target_scan:1; }; +/** + * fc_rport_chkmarginal_set_noretries - Set the SCMD_NORETRIES_ABORT bit + * in cmd->state if port state is marginal + * @rport: remote port to be checked + * @scmd: scsi_cmd to set/clear the SCMD_NORETRIES_ABORT bit on Marginal state + **/ +static inline void +fc_rport_chkmarginal_set_noretries(struct fc_rport *rport, struct scsi_cmnd *cmd) +{ + if ((rport->port_state == FC_PORTSTATE_MARGINAL) && + (cmd->request->cmd_flags & REQ_FAILFAST_TRANSPORT)) + set_bit(SCMD_NORETRIES_ABORT, &cmd->state); + else + clear_bit(SCMD_NORETRIES_ABORT, &cmd->state); + +} /** * fc_remote_port_chkready - called to validate the remote port state @@ -723,6 +741,7 @@ fc_remote_port_chkready(struct fc_rport *rport) switch (rport->port_state) { case FC_PORTSTATE_ONLINE: + case FC_PORTSTATE_MARGINAL: if (rport->roles & FC_PORT_ROLE_FCP_TARGET) result = 0; else if (rport->flags & FC_RPORT_DEVLOSS_PENDING)