From patchwork Mon Sep 28 04:50:50 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 257511 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.9 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 B59DEC2D0A8 for ; Mon, 28 Sep 2020 11:44:34 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 62B472100A for ; Mon, 28 Sep 2020 11:44:34 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="aCS3nyJq" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726608AbgI1Loe (ORCPT ); Mon, 28 Sep 2020 07:44:34 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42776 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726477AbgI1Lod (ORCPT ); Mon, 28 Sep 2020 07:44:33 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C846EC061755 for ; Mon, 28 Sep 2020 04:44:33 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id o20so739494pfp.11 for ; Mon, 28 Sep 2020 04:44:33 -0700 (PDT) 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=KUpNaFgRl0HDw2e/wlfHjsxjrP9lxzT7gZCGVc2ORy0=; b=aCS3nyJqxTtO/FJVIt5ndajM5XThEEu9CgCky/KofpSZQGfnqxtpGus9leXPyXAHc/ +G4B0DTyIyBqKLbpT217fppxGLenGgLM9w5EGnGd2CRgjItB/NWSVwRBzD0Tom+I1ku0 vvgL4k+WaZ39d0JrxrsKas8fCs5Dhk3JCWHBQ= 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=KUpNaFgRl0HDw2e/wlfHjsxjrP9lxzT7gZCGVc2ORy0=; b=PeoXtC0JYyhOYo0Hr6yeX7Tm2ol365ay/DjSljmylAcHdc2ejG8923fWUc/eOK7dTN s+pCjq09DFvX/rxEbT9ktt4LGU3I7oXqfBB82OLG2wkl2TOUz/+mv671eSU/7Vj38OdV 90Xw3qAZCvg5SWqMa++mdP6y2xZ6wySkliGGtdWXctfn8LJLZzwWpZVT/4AUOLhsfB2N 1eJmzp+3uixvuXS+6tgaYGvODyiZztCz0+QxkR6Vb81IpcdgL6nxNEaGx88O3zxBuJsx TZnUFRPDydMn/IdGm7FzfqqDQbDlfrB0lRhOSHWN1xghwItChDEVQDZ94tYyJFGM7eHw Hg3A== X-Gm-Message-State: AOAM533/fQosMPSDUeEt8ChUR9JipM20YHHwU0NIT8NacQcBJTLASKGW rigE506UIJPav0q18QmRrc+bECf9jQNRW44S/xueD5sQ4aodi6oCcMNQMqD1yoFySipHnLGf1n1 cmj7BwAdNtTkW8DACnVJqZSm/9BpuVeH4CWCLt0o7E53mQ5NznWtU1/UhCpCO6UqYyQjowiUHvu UKIID3UWky X-Google-Smtp-Source: ABdhPJwdUuEPkTAFp3iFLjHD0nJ+a5RGRhooOzo1nyz4p1qQFxgx5YrOaBD4yF0FjOtGChQuo+AzHg== X-Received: by 2002:a62:3585:0:b029:142:2501:3985 with SMTP id c127-20020a6235850000b029014225013985mr1100489pfa.74.1601293472794; Mon, 28 Sep 2020 04:44:32 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id w19sm1468866pfq.60.2020.09.28.04.44.30 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Sep 2020 04:44:32 -0700 (PDT) From: Muneendra To: linux-scsi@vger.kernel.org, hare@suse.de Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, Muneendra Subject: [PATCH v2 1/8] scsi: Added a new definition in scsi_cmnd.h Date: Mon, 28 Sep 2020 10:20:50 +0530 Message-Id: <1601268657-940-2-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com> References: <1601268657-940-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 Reviewed-by: Hannes Reinecke --- 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 e76bac4d14c5..e1883fee7659 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 Mon Sep 28 04:50:51 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 287310 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.9 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 30BE3C2D0A8 for ; Mon, 28 Sep 2020 11:44:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D46472100A for ; Mon, 28 Sep 2020 11:44:36 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="hDTBfIK1" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726614AbgI1Log (ORCPT ); Mon, 28 Sep 2020 07:44:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726477AbgI1Log (ORCPT ); Mon, 28 Sep 2020 07:44:36 -0400 Received: from mail-pj1-x1044.google.com (mail-pj1-x1044.google.com [IPv6:2607:f8b0:4864:20::1044]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 38184C061755 for ; Mon, 28 Sep 2020 04:44:36 -0700 (PDT) Received: by mail-pj1-x1044.google.com with SMTP id fa1so511867pjb.0 for ; Mon, 28 Sep 2020 04:44:36 -0700 (PDT) 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=PVhyCb1ClUd2x29vbOG/lyaoO7ChYmggcP68w7jtmQI=; b=hDTBfIK18kmNtE/Ab62r7Um8pxxg5HXv3hbzCIAc0hjl6MJNSfmdvTvHeReaAIe0tf f03wjGualp13pfdd90ZEoZQsge+EVD5WNOxvR87F49NAOgiREJolYh8aRBEDfoDT/+te aGTZg/X/NGHAPzkDwbtIJGMYDed6LZx+DfQfY= 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=PVhyCb1ClUd2x29vbOG/lyaoO7ChYmggcP68w7jtmQI=; b=teem1Vk87UgvvCDGUhcFnSzaKUwJPyUdFIFwj99iTErbuxAdTYfSRSXcepkJwRSKP2 FlYIDqxp2lNNVg5pojkiUIz/lTj1aC8fQe99ogHHEA9QCRPpLopUnOblA8aulrSrmj8y m5HNBEYw+OyIwfzgM7+8E1k9iCm7M2YUGnBSF+t13UejW5VeyvgElv/amnatvnmu/vJH OEo2Jpra9Tekqw7Gljk+PZtfI5tRw3xy0jqhrX/SGs3sWsxPRHyk492qeEnPRfIb3yDB mMb2d8nYoKy7njAk1VBydIshvPLy48DBTo8bvm5LDMXdIVFPEtd0K6MOIl9HfISWVIWn 3m8w== X-Gm-Message-State: AOAM533Jyo2Di48kfmUSxseEkER2ZbjMdoxzhLc3+FlGE1Qfttwu3iJi VBBSTh71wcS2fM5wFSmhHczcRZFRoLR0FCkPj9fThSsxPC0prkw1/fZu+3CbaZH/G4+ICtkI0x4 F7R6ynCGupkh6fbFcZH0yBkFuPumsH4fVuDlGJH6K0kCtts1SlMAxeENhv+b9lxkENHozKdXikP ywUoSrwisX X-Google-Smtp-Source: ABdhPJz5Yfrveov23+k8vnpG9EEyxlrlJfQrOXghCTyqUfIZm1O5TDQMBfNzj6az4Z7dsGpNM1YD0g== X-Received: by 2002:a17:90a:fc1:: with SMTP id 59mr1047039pjz.156.1601293475393; Mon, 28 Sep 2020 04:44:35 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id w19sm1468866pfq.60.2020.09.28.04.44.33 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Sep 2020 04:44:34 -0700 (PDT) From: Muneendra To: linux-scsi@vger.kernel.org, hare@suse.de Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, Muneendra Subject: [PATCH v2 2/8] scsi: Added a new error code in scsi.h Date: Mon, 28 Sep 2020 10:20:51 +0530 Message-Id: <1601268657-940-3-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com> References: <1601268657-940-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 Signed-off-by: Muneendra --- v2: New patch --- include/scsi/scsi.h | 1 + 1 file changed, 1 insertion(+) 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 Mon Sep 28 04:50: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: 257510 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.9 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 B82ADC2D0A8 for ; Mon, 28 Sep 2020 11:44:39 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 7123321D95 for ; Mon, 28 Sep 2020 11:44:39 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="LGZWHD5d" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726617AbgI1Loj (ORCPT ); Mon, 28 Sep 2020 07:44:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42792 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726477AbgI1Loi (ORCPT ); Mon, 28 Sep 2020 07:44:38 -0400 Received: from mail-pg1-x544.google.com (mail-pg1-x544.google.com [IPv6:2607:f8b0:4864:20::544]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D6607C061755 for ; Mon, 28 Sep 2020 04:44:38 -0700 (PDT) Received: by mail-pg1-x544.google.com with SMTP id o25so651835pgm.0 for ; Mon, 28 Sep 2020 04:44:38 -0700 (PDT) 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=ipZs9C50+egt+iGuh0khMSlAHX1K89Ohv1B509sSeHM=; b=LGZWHD5dZbOtiWGHbHXeaBER0zrCoLS6RgHYrFd/38od3MQPM9tE3zEl67JdYajrwZ hzlTttdGG8Eakict0jubtoZXwalgeYnBz+17gqcm1QK8m8UmZLb2bD/jj6NquABSXyho S1HhghAdIk5VyVm7DxSY1A66bEHushi4uW1kA= 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=ipZs9C50+egt+iGuh0khMSlAHX1K89Ohv1B509sSeHM=; b=YsAiYs7oigklri88mVYDp794w/RiAPUQichI7vMM1g2lS5kbXgdiCx8l9LDq4+67DY sRxnqAGOUb22CPSZcY8VSbRlQfGdrv2QGVvTBoifrtnVWzcoPOTCexFym1EHhvKNAJV/ JawyR6sT+bvz4mVfsjic8XJKQaLPdbTSHzxDCDe5eE6TW2UEboZpOPz9RVwzgPw3uvVz SVDQYZumXUi6uPgDTz1KqYC8G5WMaWLNS4MDXFVmPUmWhFZKB/I1rxm2HFbPdfqKrqFw bPTOa6dOj5/CRlpfLvVEfqc1eoNZxGlFLQcbcBKBFe0ZEmyGcEdaWbigEvRsLpIUFVh/ h1YA== X-Gm-Message-State: AOAM532nJ+eErfui2/VxqfbvDE6KbS6bF5paJxI+Wpb/yVI7aUsu/30q oadWKxFR72JLozfOlwEpI+oGtC2vfhjZlU72Nb39PD2SXITrLU8ygFhbNLJYG/7bxz8y+v8M5VD DF8/yADZaP4D2zubSIms2rPSAABbmSyeuWTHncAmAO/zmfOmW4zJ6Ts5l3STv7N73Gtu+BGtFxi oBS+fbFp+P X-Google-Smtp-Source: ABdhPJy5ThP8TISQd7Y2ZyFFI/FZ5X/AOmwi3tLArSFcPoASj28oRmWcrhTAcNcuonP53kQvyufFLw== X-Received: by 2002:a17:902:6902:b029:d0:cb2d:f26d with SMTP id j2-20020a1709026902b02900d0cb2df26dmr1304796plk.6.1601293477955; Mon, 28 Sep 2020 04:44:37 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id w19sm1468866pfq.60.2020.09.28.04.44.35 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Sep 2020 04:44:37 -0700 (PDT) From: Muneendra To: linux-scsi@vger.kernel.org, hare@suse.de Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, Muneendra Subject: [PATCH v2 3/8] scsi: Clear state bit SCMD_NORETRIES_ABORT of scsi_cmd before start request Date: Mon, 28 Sep 2020 10:20:52 +0530 Message-Id: <1601268657-940-4-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com> References: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Clearing the SCMD_NORETRIES_ABORT bit in state flag before blk_mq_start_request. Added a code in scsi_result_to_blk_status to translate a new error DID_TRANSPORT_MARGINAL to the corresponding blk_status_t i.e BLK_STS_TRANSPORT Signed-off-by: Muneendra --- v2: Made changes in scsi_result_to_blk_status to support DID_TRANSPORT_MARGINAL --- drivers/scsi/scsi_lib.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index f0ee11dc07e4..da95ae8b572f 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -643,6 +643,7 @@ static blk_status_t scsi_result_to_blk_status(struct scsi_cmnd *cmd, int result) return BLK_STS_OK; return BLK_STS_IOERR; case DID_TRANSPORT_FAILFAST: + case DID_TRANSPORT_MARGINAL: return BLK_STS_TRANSPORT; case DID_TARGET_FAILURE: set_host_byte(cmd, DID_OK); @@ -1689,6 +1690,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); blk_mq_start_request(req); } From patchwork Mon Sep 28 04:50:53 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 287309 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.9 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 8322FC2D0A8 for ; Mon, 28 Sep 2020 11:44:42 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 344FC2100A for ; Mon, 28 Sep 2020 11:44:42 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="C65Iz9Sh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726625AbgI1Lol (ORCPT ); Mon, 28 Sep 2020 07:44:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726477AbgI1Lol (ORCPT ); Mon, 28 Sep 2020 07:44:41 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A0266C061755 for ; Mon, 28 Sep 2020 04:44:41 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id f18so743874pfa.10 for ; Mon, 28 Sep 2020 04:44:41 -0700 (PDT) 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=MScz8qgOEcJMNFyXsLi4DRQ4XJsmdKpa2t/CJVpa96s=; b=C65Iz9ShCQOmduaJmR/0Ae07RDIQIPgl26c9uxshcvb2WKM6m8VM1F7sFwpJ5iYCTa aBlS4XJOm+EcrNY394C4GhyxDGBV8y1JpbSg7dC8wysfFqNtvT2F+XLGCHPN8BIbjQGz rMIo87uce3MYl4sImKpPNXOeSFIi4dnhWlZNw= 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=MScz8qgOEcJMNFyXsLi4DRQ4XJsmdKpa2t/CJVpa96s=; b=RqTOUcbwZG+oL42MXt7CsRO/Mp3GrENDErx3+GcdCBU3fdPv14fpEsbmYrpvpCrJVV wB7NM6tgXTA26N8QiPRh4Ke1pkIRPTAQk77wJy8hltpGOsWQP0qE+xE8zYrZCWE2CXts MPDl8gmzC6VZdD7TPQgAK+5H6tlvRVaY+dhXOEyHgBC8ZkvonjB6wFRpUEufSUX7Ps+a nrIfKg2zY+03FaMdbXh5BVpKVYJCH6rXw3FORn9lmRy/LVVsJPkPvsm227X83q8GhM1J dEDNtFV/l61jKCcNzwQidUDMIXgO0IQWhgShs6Uy0acjBghAWHUIPZz4h66kND568xNs cJWw== X-Gm-Message-State: AOAM531OTQXXQtzYl053lcg81Y4RMgNQK0LM9jYMm+L40ANwH/qR4lU3 zAmmO5eS4ufOrdtgYohiu8Yr9Jg8jJ5q+I8ICfQ5+WJ57YF8OC93BXXS7FUOC+LxhV/530PqE6o zxujNozULNjh5Wgcf1xC2nd6pc8J7Hm7RR+x6m+4VIYy8Tb7ntEHXLSORrr7LXnMHDOV44IU0V/ IQ77251R4K X-Google-Smtp-Source: ABdhPJw51E5epEnrlcBoTyvWksyIf3k3CPe1vw7VkTfqlkZVNiQQhCoTOCbSJqt1BHF3Vgz9clktJg== X-Received: by 2002:a17:902:a618:b029:d2:6379:ac0c with SMTP id u24-20020a170902a618b02900d26379ac0cmr1248403plq.82.1601293480600; Mon, 28 Sep 2020 04:44:40 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id w19sm1468866pfq.60.2020.09.28.04.44.38 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Sep 2020 04:44:40 -0700 (PDT) From: Muneendra To: linux-scsi@vger.kernel.org, hare@suse.de Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, Muneendra Subject: [PATCH v2 4/8] scsi: No retries on abort success Date: Mon, 28 Sep 2020 10:20:53 +0530 Message-Id: <1601268657-940-5-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com> References: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Made an additional check in scsi_noretry_cmd to verify whether user has decided not to do retries on abort success by setting the SCMD_NORETRIES_ABORT bit If SCMD_NORETRIES_ABORT bit is set we are making sure there won't be any retries done on the same path and also setting the host byte as DID_TRANSPORT_MARGINAL so that the error can be propogated as recoverable transport error to the blk layers. Signed-off-by: Muneendra --- v2: set the hostbyte as DID_TRANSPORT_MARGINAL instead of DID_TRANSPORT_FAILFAST. --- drivers/scsi/scsi_error.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 5f3726abed78..3f14ea10d5da 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1748,6 +1748,16 @@ int scsi_noretry_cmd(struct scsi_cmnd *scmd) return 0; check_type: + /* + * Check whether caller has decided not to do retries on + * abort success by setting the SCMD_NORETRIES_ABORT bit + */ + if ((test_bit(SCMD_NORETRIES_ABORT, &scmd->state)) && + (scmd->request->cmd_flags & REQ_FAILFAST_TRANSPORT)) { + set_host_byte(scmd, DID_TRANSPORT_MARGINAL); + return 1; + } + /* * assume caller has checked sense and determined * the check condition was retryable. From patchwork Mon Sep 28 04:50:54 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 257509 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.9 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 45F8EC2D0A8 for ; Mon, 28 Sep 2020 11:44:45 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id D170221D95 for ; Mon, 28 Sep 2020 11:44:44 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="da6z3gnC" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726558AbgI1Loo (ORCPT ); Mon, 28 Sep 2020 07:44:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726608AbgI1Loo (ORCPT ); Mon, 28 Sep 2020 07:44:44 -0400 Received: from mail-pf1-x444.google.com (mail-pf1-x444.google.com [IPv6:2607:f8b0:4864:20::444]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3BE9EC061755 for ; Mon, 28 Sep 2020 04:44:44 -0700 (PDT) Received: by mail-pf1-x444.google.com with SMTP id l126so762722pfd.5 for ; Mon, 28 Sep 2020 04:44:44 -0700 (PDT) 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=W+8t/wFNwhBkBbVsyEDmQ227b7g8+rNL8kbsStypFEg=; b=da6z3gnC/H2ozMdd3Ri58LpjKlz5X4ohVlxne6if68PKybnerEQyd4D/mKgZcGwwXZ Lz262nBy2j9ogfyFnrQhVnAQG4ESf5oF72q5XKlFYzQ9JxFUXcqT2G3YUJlj0qfQ/cXb nQ5jNoxAOHuNkRWYZKJYs262slujj+Z1omCcA= 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=W+8t/wFNwhBkBbVsyEDmQ227b7g8+rNL8kbsStypFEg=; b=QeYfV2/poS8yBw6m6CmKfwZGGN+y08MzNK44VJZ4lUs8710PPH/UK8FTf/bhEHf82s hTKEY5U9J+8BEnb1RJKL9IoQtY6GhoWLoDAtW5Nk4DcXz2fkOFRseNB/L6gSfWYvpxdg iRCQwXK12Gw7e8YWfvnJo/gB1e9sFNr24z1vKMSXAE9RhhILqAM75qGPDWveR8GkLlbw Ug/G03A6PxGOLBsZGCvaZoj/FUMF5/eBrseCiwPCadQ0J1W+EDT71OUqf1oXlUEtT7Q7 PwgNknPcGENl6ao08dLbXK1nia7GWYlmJ0C63zVqkuN8yYdJhNNp874j8j1clixCc60t vcew== X-Gm-Message-State: AOAM531iUzbkDzFxFt6uQZyCZiAXiaSXjxcJbKegAIt4U02Mj+CGV+O8 iTIpv+Ke9oq1wv43ngRt/LgaVfapoCa1J+iFR35h6+nj8EHzvbk8/D/jIIMOfd0hJ+IVMX5bU4d wTK3RtSR/HpcpmZlCfNtjq0uM0jmxWXBFyWp5NyU+CA2WddK/yEGtnaIeJdKaPfS2zgANuljBnJ 86rHaxP3X0 X-Google-Smtp-Source: ABdhPJxGxuoXq3UJyI4dntalbHM6ZlRvEv6wAfQlHvY/X8Sa+wZpX4GWi9zSIIE7wUjxin6y5xzXyw== X-Received: by 2002:a17:902:c281:b029:d2:2988:4906 with SMTP id i1-20020a170902c281b02900d229884906mr1238338pld.82.1601293483275; Mon, 28 Sep 2020 04:44:43 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id w19sm1468866pfq.60.2020.09.28.04.44.40 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Sep 2020 04:44:42 -0700 (PDT) From: Muneendra To: linux-scsi@vger.kernel.org, hare@suse.de Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, Muneendra Subject: [PATCH v2 5/8] scsi: Added routine to set/clear SCMD_NORETRIES_ABORT bit for outstanding io on scsi_dev Date: Mon, 28 Sep 2020 10:20:54 +0530 Message-Id: <1601268657-940-6-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com> References: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Added a new routine scsi_chg_noretries_abort_io_device(). This functions accepts two arguments Scsi_device and an integer(set). When set is passed as 1 this routine will set SCMD_NORETRIES_ABORT bit in scmd->state for all the pending io's on the scsi device associated with target port. When set is passed as 0 This routine will clear SCMD_NORETRIES_ABORT bit in scmd->state for all the pending io's on the scsi device associated with target port. Export the symbol so the routine can be called by scsi_transport_fc.c Added new function declaration scsi_chg_noretries_abort_io_device in scsi_priv.h Signed-off-by: Muneendra --- v2: Renamed the below functions as scsi_set_noretries_abort_io_device ->scsi_chg_noretries_abort_io_device __scsi_set_noretries_abort_io_device->__scsi_set_noretries_abort_io_device which accepts the value as an arg to set/clear the SCMD_NORETRIES_ABORT bit --- drivers/scsi/scsi_error.c | 76 +++++++++++++++++++++++++++++++++++++++ drivers/scsi/scsi_priv.h | 2 ++ 2 files changed, 78 insertions(+) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index 3f14ea10d5da..c0943f08b469 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -271,6 +271,82 @@ void scsi_eh_scmd_add(struct scsi_cmnd *scmd) call_rcu(&scmd->rcu, scsi_eh_inc_host_failed); } +static bool +scsi_clear_noretries_abort_io(struct request *rq, void *priv, bool reserved) +{ + struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(rq); + struct scsi_device *sdev = scmd->device; + + /* only clear SCMD_NORETRIES_ABORT on ios on a specific sdev */ + if (sdev != priv) + return true; + + /*Clear the SCMD_NORETRIES_ABORT bit*/ + if (READ_ONCE(rq->state) == MQ_RQ_IN_FLIGHT) + clear_bit(SCMD_NORETRIES_ABORT, &scmd->state); + return true; +} + +static bool +scsi_set_noretries_abort_io(struct request *rq, void *priv, bool reserved) +{ + struct scsi_cmnd *scmd = blk_mq_rq_to_pdu(rq); + struct scsi_device *sdev = scmd->device; + + /* only set SCMD_NORETRIES_ABORT on ios on a specific sdev */ + if (sdev != priv) + return true; + /* we don't want this command reissued on abort success + * so set SCMD_NORETRIES_ABORT bit to ensure it + * won't get reissued + */ + if (READ_ONCE(rq->state) == MQ_RQ_IN_FLIGHT) + set_bit(SCMD_NORETRIES_ABORT, &scmd->state); + return true; +} + +static int +__scsi_chg_noretries_abort_io_device(struct scsi_device *sdev, int set) +{ + + if (sdev->sdev_state != SDEV_RUNNING) + return -EINVAL; + + if (blk_queue_init_done(sdev->request_queue)) { + + blk_mq_quiesce_queue(sdev->request_queue); + + if (set) + blk_mq_tagset_busy_iter(&sdev->host->tag_set, + scsi_set_noretries_abort_io, sdev); + else + blk_mq_tagset_busy_iter(&sdev->host->tag_set, + scsi_clear_noretries_abort_io, sdev); + + blk_mq_unquiesce_queue(sdev->request_queue); + } + return 0; +} + +/* + * scsi_chg_noretries_abort_io_device - set/clear the SCMD_NORETRIES_ABORT + * bit for all the pending io's on a device + * @sdev: scsi_device + * @set: indicates to clear (0) or set (1) the SCMD_NORETRIES_ABORT flag + */ +int +scsi_chg_noretries_abort_io_device(struct scsi_device *sdev, int set) +{ + struct Scsi_Host *shost = sdev->host; + int ret = -EINVAL; + + mutex_lock(&shost->scan_mutex); + ret = __scsi_chg_noretries_abort_io_device(sdev, set); + mutex_unlock(&shost->scan_mutex); + return ret; +} +EXPORT_SYMBOL(scsi_chg_noretries_abort_io_device); + /** * scsi_times_out - Timeout function for normal scsi commands. * @req: request that is timing out. diff --git a/drivers/scsi/scsi_priv.h b/drivers/scsi/scsi_priv.h index d12ada035961..aba98a3294ce 100644 --- a/drivers/scsi/scsi_priv.h +++ b/drivers/scsi/scsi_priv.h @@ -81,6 +81,8 @@ void scsi_eh_ready_devs(struct Scsi_Host *shost, int scsi_eh_get_sense(struct list_head *work_q, struct list_head *done_q); int scsi_noretry_cmd(struct scsi_cmnd *scmd); +extern int scsi_chg_noretries_abort_io_device(struct scsi_device *sdev, + int set); /* scsi_lib.c */ extern int scsi_maybe_unblock_host(struct scsi_device *sdev); From patchwork Mon Sep 28 04:50:55 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 287308 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.9 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 D726FC2D0A8 for ; Mon, 28 Sep 2020 11:44:47 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8144721D95 for ; Mon, 28 Sep 2020 11:44:47 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="c7ODsJcA" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726630AbgI1Lor (ORCPT ); Mon, 28 Sep 2020 07:44:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42818 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726608AbgI1Lor (ORCPT ); Mon, 28 Sep 2020 07:44:47 -0400 Received: from mail-pj1-x1043.google.com (mail-pj1-x1043.google.com [IPv6:2607:f8b0:4864:20::1043]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EFEE7C061755 for ; Mon, 28 Sep 2020 04:44:46 -0700 (PDT) Received: by mail-pj1-x1043.google.com with SMTP id mn7so485355pjb.5 for ; Mon, 28 Sep 2020 04:44:46 -0700 (PDT) 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=2Oa7nLWj6s51DZc57OiVZhXUIx9niedcnvuQsf9d3Ls=; b=c7ODsJcAHVAEREasZy/RYGm8CW1kWtXRke8DWnxLf7FU8qm5rrEtWpPoAJ44qTNWl7 c2ZxaBTb/MaTWCRrMtc2J1Dw5XItD/CrOsRZ5N5IWeOeqHQnfmo1AsKDb54O1WEFjP/H qm/rmTkJO9hHmE0ul2mfXBOBrjaC4OrA1mxpY= 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=2Oa7nLWj6s51DZc57OiVZhXUIx9niedcnvuQsf9d3Ls=; b=gAEyNAKPOoBDOMaNY1CfccKTgepveSAofiEj/spdB/cvTXifM1h6z3SyJ7yfBzvNCT nxfunrb5b0VOu7AFoJyNpNcz0WwJ2nGKtZ/atBbyNgUaSG9uwBU6tlWqXWLDiQSSPyx8 2FyXIk+ZyzfVC3ExjBkkjTKnRkxSThCOhupwK46Josc0Xfvou3zw/O4sgmAVNTKueNtD uz0CoXgSmnCrw43MDAyhWzPnOS050DNBbOO/ixOdtTvPyLJZIWL3d8s9JXPv3smYXd34 UGBv59j2woO7heTpLZ7txWFKOkqHK0gx/KaIhd5iWvBMZTpeBHKDfImg+QtbgJUVGqfG Hl6g== X-Gm-Message-State: AOAM5313kQtpeTCW6qGnG9jgC1jhDLLynA2malqqmrmjDn2xzWu80kab mHQ6Tj4s8SxAr4t6+FmxCMHNZ6WN4cFG83FP+CBMjF6OxdCa65EgEnylLuFE0P24aTWOfm5Z+R1 x5wLCLOJDVyMfs9g1Txp3q/mzkA5TXGA4KgiKNSCPewwWd3aBOzsFMjbNTGxGmz9OSdIohfWsx+ xIEsqsCDan X-Google-Smtp-Source: ABdhPJxwV7uCS5YVJpDdkLZbENfht5AUw2vUe4TtRrf+DUBiss0QPpT+a8z9sPFn1lLJCMKMdZqsQA== X-Received: by 2002:a17:90b:d86:: with SMTP id bg6mr937203pjb.155.1601293486055; Mon, 28 Sep 2020 04:44:46 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id w19sm1468866pfq.60.2020.09.28.04.44.43 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Sep 2020 04:44:45 -0700 (PDT) From: Muneendra To: linux-scsi@vger.kernel.org, hare@suse.de Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, Muneendra Subject: [PATCH v2 6/8] scsi_transport_fc: Added a new rport state FC_PORTSTATE_MARGINAL Date: Mon, 28 Sep 2020 10:20:55 +0530 Message-Id: <1601268657-940-7-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com> References: <1601268657-940-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. Made changes in fc_remote_port_chkready function to treat marginal and online as same 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. Signed-off-by: Muneendra --- v2: New patch --- include/scsi/scsi_transport_fc.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) diff --git a/include/scsi/scsi_transport_fc.h b/include/scsi/scsi_transport_fc.h index 1c7dd35cb7a0..ee99c6ca7e45 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, }; @@ -383,6 +385,7 @@ struct fc_starget_attrs { /* aka fc_target_attrs */ u64 node_name; u64 port_name; u32 port_id; + enum fc_port_state port_state; }; #define fc_starget_node_name(x) \ @@ -391,6 +394,8 @@ struct fc_starget_attrs { /* aka fc_target_attrs */ (((struct fc_starget_attrs *)&(x)->starget_data)->port_name) #define fc_starget_port_id(x) \ (((struct fc_starget_attrs *)&(x)->starget_data)->port_id) +#define fc_starget_port_state(x) \ + (((struct fc_starget_attrs *)&(x)->starget_data)->port_state) #define starget_to_rport(s) \ scsi_is_fc_rport(s->dev.parent) ? dev_to_rport(s->dev.parent) : NULL @@ -723,6 +728,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) @@ -743,6 +749,24 @@ fc_remote_port_chkready(struct fc_rport *rport) return result; } +/** + * fc_rport_chkmarginal_set_noretries - Set the SCMD_NORETRIES_ABORT bit + * in cmd->state if port state is marginal prior to initiating + * io to the port. + * @rport: remote port to be checked + * @scmd: scsi_cmd + **/ +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); + +} + static inline u64 wwn_to_u64(const u8 *wwn) { return get_unaligned_be64(wwn); From patchwork Mon Sep 28 04:50:56 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 257508 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=-9.1 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, UNWANTED_LANGUAGE_BODY, 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 8B3B7C2D0A8 for ; Mon, 28 Sep 2020 11:44:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 3F65621D95 for ; Mon, 28 Sep 2020 11:44:50 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="AG35NFpn" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726632AbgI1Lou (ORCPT ); Mon, 28 Sep 2020 07:44:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42828 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726566AbgI1Lot (ORCPT ); Mon, 28 Sep 2020 07:44:49 -0400 Received: from mail-pf1-x442.google.com (mail-pf1-x442.google.com [IPv6:2607:f8b0:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B3929C061755 for ; Mon, 28 Sep 2020 04:44:49 -0700 (PDT) Received: by mail-pf1-x442.google.com with SMTP id b124so730630pfg.13 for ; Mon, 28 Sep 2020 04:44:49 -0700 (PDT) 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=Sc7vonzpvvxGP5Sb4LAvWi24bRLGzgQpwutoTor0jWQ=; b=AG35NFpn6hFB75n2vilyQmN06BqOU2STeslbtTl4fqc5Y77oyO1KtNpFmL72LnWs20 a0RxCifipGDh7UESTDkREth9ocxUELyRG3ELA9ulO1pcmgQ7zFiwKPOv0uJcMeamz2cn 8JsZAMyk1rpe/IKNoY63bs1KLvPUdxq6rA7E8= 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=Sc7vonzpvvxGP5Sb4LAvWi24bRLGzgQpwutoTor0jWQ=; b=F+wexXDDdsCIEVUdRVL9DVDo29rgcT/IH8Gb0cY+5LWO63LEUxUH++nNraTTNRtqOp FnOWhc7mMhuixfBFYNY1AxyThxlf9AbqcuGUpTk7VnlJBcvw+RLi1Lwuexf3YrEmEytH OuSTEUv5Njt8zGyS3cvaTO3bgh2ouVNluADXCgKcsve5TdTyLqop5J5eXVrrCAMap7dc JCgUdyI7P2AYdL4qA0yqrrjEkkwYWNLKsCepWNUCVHzIE/YXWyIclBaIMVJwrq8uWPq9 W7VRPHiy4MLEG2liSw9f3fHgfN90aSurGlCvcFjtitLy+vptK+NKihBeNbp7WB1LNcuX hWvA== X-Gm-Message-State: AOAM530gYDGgQ0RyvC0genghNwnzejis5cRBl49IjQnwKENgO6VFpFkf 2HxROOiahX7cJgOd8JHNNeqfZTQVfV8geNjhyUPprWbH2Bppzn5ZpRkLlx1S4/Jw0iUOBlrpCwr HObdCax+gva1/T/by/Osj4EJmSRiLXGXTkcbwQ0lCVgjpa7pMgFzgoCr8sL+0s5YNKlKEFQk5Zw bZgckxWAyf X-Google-Smtp-Source: ABdhPJxMa2VkH3VNhJlR7xaL/8Xve5XkMDWxQrcvHyxd+TW+bMVL8zZZt7Yi3bBswgPv/28PwGUBCA== X-Received: by 2002:a05:6a00:1b:b029:13e:d13d:a101 with SMTP id h27-20020a056a00001bb029013ed13da101mr9603790pfk.29.1601293488661; Mon, 28 Sep 2020 04:44:48 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id w19sm1468866pfq.60.2020.09.28.04.44.46 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Sep 2020 04:44:48 -0700 (PDT) From: Muneendra To: linux-scsi@vger.kernel.org, hare@suse.de Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, Muneendra Subject: [PATCH v2 7/8] scsi_transport_fc: Added a new sysfs attribute port_state Date: Mon, 28 Sep 2020 10:20:56 +0530 Message-Id: <1601268657-940-8-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com> References: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Added a new sysfs attribute port_state under fc_transport/target*/ With this new interface the user can move the port_state from Marginal -> Online and Online->Marginal. On Marginal :This interface will set SCMD_NORETRIES_ABORT bit in scmd->state for all the pending io's on the scsi device associated with target port. On Online :This interface will clear SCMD_NORETRIES_ABORT bit in scmd->state for all the pending io's on the scsi device associated with target port. Below is the interface provided to set the port state to Marginal and Online. echo "Marginal" >> /sys/class/fc_transport/targetX\:Y\:Z/port_state echo "Online" >> /sys/class/fc_transport/targetX\:Y\:Z/port_state 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. Signed-off-by: Muneendra --- v2: Changed from a noretries_abort attribute under fc_transport/target*/ to port_state for changing the port_state to a marginal state --- drivers/scsi/scsi_transport_fc.c | 140 +++++++++++++++++++++++++++---- 1 file changed, 122 insertions(+), 18 deletions(-) diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c index 2ff7f06203da..6fe2463c5a68 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 @@ -306,7 +309,7 @@ static void fc_scsi_scan_rport(struct work_struct *work); * Attribute counts pre object type... * Increase these values if you add attributes */ -#define FC_STARGET_NUM_ATTRS 3 +#define FC_STARGET_NUM_ATTRS 4 #define FC_RPORT_NUM_ATTRS 10 #define FC_VPORT_NUM_ATTRS 9 #define FC_HOST_NUM_ATTRS 29 @@ -358,10 +361,12 @@ static int fc_target_setup(struct transport_container *tc, struct device *dev, fc_starget_node_name(starget) = rport->node_name; fc_starget_port_name(starget) = rport->port_name; fc_starget_port_id(starget) = rport->port_id; + fc_starget_port_state(starget) = rport->port_state; } else { fc_starget_node_name(starget) = -1; fc_starget_port_name(starget) = -1; fc_starget_port_id(starget) = -1; + fc_starget_port_state(starget) = FC_PORTSTATE_UNKNOWN; } return 0; @@ -995,6 +1000,93 @@ static FC_DEVICE_ATTR(rport, fast_io_fail_tmo, S_IRUGO | S_IWUSR, /* * FC SCSI Target Attribute Management */ +static void scsi_target_chg_noretries_abort(struct scsi_target *starget, int set) +{ + struct scsi_device *sdev, *tmp; + struct Scsi_Host *shost = dev_to_shost(starget->dev.parent); + unsigned long flags; + + spin_lock_irqsave(shost->host_lock, flags); + list_for_each_entry_safe(sdev, tmp, &starget->devices, same_target_siblings) { + if (sdev->sdev_state == SDEV_DEL) + continue; + + spin_unlock_irqrestore(shost->host_lock, flags); + if (scsi_device_get(sdev)) + continue; + + spin_unlock_irqrestore(shost->host_lock, flags); + scsi_chg_noretries_abort_io_device(sdev, set); + spin_lock_irqsave(shost->host_lock, flags); + scsi_device_put(sdev); + } + spin_unlock_irqrestore(shost->host_lock, flags); +} + +/* + * Sets port_state to Marginal/Online. + * On Marginal it Sets no retries on abort in scmd->state for all + * outstanding io of all the scsi_devs + * This only allows ONLINE->MARGINAL and MARGINAL->ONLINE + */ +static ssize_t fc_target_set_marginal_state(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct scsi_target *starget = transport_class_to_starget(dev); + struct fc_rport *rport = starget_to_rport(starget); + enum fc_port_state port_state; + int ret = 0; + + ret = get_fc_port_state_match(buf, &port_state); + + if (port_state == FC_PORTSTATE_MARGINAL) { + + /* + * Change the state to marginal only if the + * current rport state is Online + * Allow only Online->marginal + */ + if (rport->port_state == FC_PORTSTATE_ONLINE) { + rport->port_state = port_state; + scsi_target_chg_noretries_abort(starget, 1); + } + + } else if (port_state == FC_PORTSTATE_ONLINE) { + /* + * Change the state to Online only if the + * current rport state is Marginal + * Allow only MArginal->Online + */ + + if (rport->port_state == FC_PORTSTATE_MARGINAL) { + rport->port_state = port_state; + scsi_target_chg_noretries_abort(starget, 0); + } + + + } else + return -EINVAL; + return count; +} + +static ssize_t +fc_target_show_port_state(struct device *dev, + struct device_attribute *attr, char *buf) +{ + const char *name; + struct scsi_target *starget = transport_class_to_starget(dev); + struct fc_rport *rport = starget_to_rport(starget); + + name = get_fc_port_state_name(rport->port_state); + if (!name) + return -EINVAL; + + return snprintf(buf, 20, "%s\n", name); +} + +static FC_DEVICE_ATTR(starget, port_state, 0444 | 0200, + fc_target_show_port_state, fc_target_set_marginal_state); /* * Note: in the target show function we recognize when the remote @@ -1037,6 +1129,13 @@ static FC_DEVICE_ATTR(starget, field, S_IRUGO, \ if (i->f->show_starget_##field) \ count++ +#define SETUP_PRIVATE_STARGET_ATTRIBUTE_RW(field) \ +do { \ + i->private_starget_attrs[count] = device_attr_starget_##field; \ + i->starget_attrs[count] = &i->private_starget_attrs[count]; \ + count++; \ +} while (0) + #define SETUP_STARGET_ATTRIBUTE_RW(field) \ i->private_starget_attrs[count] = device_attr_starget_##field; \ if (!i->f->set_starget_##field) { \ @@ -2095,7 +2194,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) && @@ -2198,7 +2298,7 @@ fc_attach_transport(struct fc_function_template *ft) SETUP_STARGET_ATTRIBUTE_RD(node_name); SETUP_STARGET_ATTRIBUTE_RD(port_name); SETUP_STARGET_ATTRIBUTE_RD(port_id); - + SETUP_PRIVATE_STARGET_ATTRIBUTE_RW(port_state); BUG_ON(count > FC_STARGET_NUM_ATTRS); i->starget_attrs[count] = NULL; @@ -2958,7 +3058,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 +3201,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 +3345,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_ONLINE)) && (rport->roles & FC_PORT_ROLE_FCP_TARGET) && !(i->f->disable_target_scan)) { scsi_scan_target(&rport->dev, rport->channel, @@ -3747,7 +3850,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; From patchwork Mon Sep 28 04:50:57 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 287307 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.9 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 EA632C2D0A8 for ; Mon, 28 Sep 2020 11:44:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id AD7572100A for ; Mon, 28 Sep 2020 11:44:52 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Z4MiORcQ" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726635AbgI1Low (ORCPT ); Mon, 28 Sep 2020 07:44:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726566AbgI1Low (ORCPT ); Mon, 28 Sep 2020 07:44:52 -0400 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 23805C061755 for ; Mon, 28 Sep 2020 04:44:52 -0700 (PDT) Received: by mail-pf1-x441.google.com with SMTP id k13so779794pfg.1 for ; Mon, 28 Sep 2020 04:44:52 -0700 (PDT) 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=eiFyY18Tau9U4/Da46ojnZm6Vig4UlGaWZb2kk1RBhU=; b=Z4MiORcQVYkJNzO0mgJ8f1cPeAt/NWJLGvz0yVaIPwdsWPffmFdUH0N4qG1kwSwp2U sDdOhfr3YqqDzTFbPf5EVBOfkN08FsJ/vLyF1G6p9MBxMtJHAczUUt6sJuZNJYhc6Mbl vEWM+bpMcX4Rk8LHNrAAs4uCOp3BExM3nq27s= 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=eiFyY18Tau9U4/Da46ojnZm6Vig4UlGaWZb2kk1RBhU=; b=eprrFfO9sSlIoO4+ls7tz3Sd4pOCcAP4DT3NO7CDOL4EnreKfh/umZ7S194i6BqN4Z qHKty9qBIZHZNxr4eBOv/FEe2DubMzOkvKgefpIJPWcpf7E7MQ4BIbhj20kwC+V/hqwF 8pZndWXU34kajlPF874bRaE6ynO43GgxX9jum7g4K0ipabuey+k1u0hiGcv4UY6xl3Ji 6UV/kj4C1rFWV1+wf2lbNZZve3bVAu+kM6wb3nXmM2rFBJW09Y+iuB+6VoLcHWwsrSzh 243OEZGl1crFzp4IjrPXwKrPx5i9MjBQtyINy+cJwiysAp0H6UDWrJ7F00ANvjUzflb5 HoVw== X-Gm-Message-State: AOAM530lW42xilo9p8Di8lAdwquYudRCW2onzt5jS6nkX18+iwIKVax1 +SLenwjcsPHAPa9HjVcgbcHhuA7S0QScSdcazgquxuLMJcG1FhDRtiOzB3rim3rYHp4rf7C1HD4 md37uyp5HiTT53CaZEJUrrHf4PZaFr5Wi3IBJjaferGkaDDw+Ec5EYzMvmxl6mqsscvjDYZMZuD krdIcCF0ls X-Google-Smtp-Source: ABdhPJwWvrZdabsbw3HZUENOeH2yT60D/EgcRBlQPgtn9lTqkCn3u6VPX8Qb0Xd03QWt1OmidnLBsg== X-Received: by 2002:aa7:941a:0:b029:142:2501:34dc with SMTP id x26-20020aa7941a0000b0290142250134dcmr1073976pfo.53.1601293491268; Mon, 28 Sep 2020 04:44:51 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id w19sm1468866pfq.60.2020.09.28.04.44.48 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 28 Sep 2020 04:44:50 -0700 (PDT) From: Muneendra To: linux-scsi@vger.kernel.org, hare@suse.de Cc: jsmart2021@gmail.com, emilne@redhat.com, mkumar@redhat.com, Muneendra Subject: [PATCH v2 8/8] lpfc: Added support to handle marginal state Date: Mon, 28 Sep 2020 10:20:57 +0530 Message-Id: <1601268657-940-9-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com> References: <1601268657-940-1-git-send-email-muneendra.kumar@broadcom.com> Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Added additional check to set SCMD_NORETRIES_ABORT bit in scmd->state if port state is marginal prior to initiating io to the port. Signed-off-by: Muneendra --- v2: New patch --- drivers/scsi/lpfc/lpfc_scsi.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/scsi/lpfc/lpfc_scsi.c b/drivers/scsi/lpfc/lpfc_scsi.c index 5e802c8b22a9..1198351d34a8 100644 --- a/drivers/scsi/lpfc/lpfc_scsi.c +++ b/drivers/scsi/lpfc/lpfc_scsi.c @@ -4526,6 +4526,12 @@ lpfc_queuecommand(struct Scsi_Host *shost, struct scsi_cmnd *cmnd) cmnd->result = err; goto out_fail_command; } + + /* + * If port state is marginal + * Set the SCMD_NORETRIES_ABORT bit in scmd->state + */ + fc_rport_chkmarginal_set_noretries(rport, cmnd); ndlp = rdata->pnode; if ((scsi_get_prot_op(cmnd) != SCSI_PROT_NORMAL) &&