From patchwork Thu Oct 15 03:27:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar X-Patchwork-Id: 269788 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, 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 A88AFC433DF for ; Thu, 15 Oct 2020 10:21:16 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4863C2224A for ; Thu, 15 Oct 2020 10:21:16 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="PKvq21cB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730629AbgJOKVQ (ORCPT ); Thu, 15 Oct 2020 06:21:16 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46880 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726709AbgJOKVP (ORCPT ); Thu, 15 Oct 2020 06:21:15 -0400 Received: from mail-pj1-x1042.google.com (mail-pj1-x1042.google.com [IPv6:2607:f8b0:4864:20::1042]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 91268C061755 for ; Thu, 15 Oct 2020 03:21:15 -0700 (PDT) Received: by mail-pj1-x1042.google.com with SMTP id a1so1738279pjd.1 for ; Thu, 15 Oct 2020 03:21:15 -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=GU7MKdzHFZFkuzGoIm+K4K01Py2CI1GrQCHU3Ka/wCo=; b=PKvq21cB5Jx8SjlkavHFPl0Y3uEOkC6vT3NQn0pMgYS4qsodtOC4h4QDPV6qLz1e3l 3DAIFC8nCn2Fe1gac7zHSgFNKg5LhQl+Zy4GWTihZZzzdvCBgUCiorfY3AoX8X9wajN1 xQYbbwCRtHCykk3XcMT8FeM1M0IQNsLY/8Wwg= 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=GU7MKdzHFZFkuzGoIm+K4K01Py2CI1GrQCHU3Ka/wCo=; b=S8NbP/ZgLlh6KmP7LlBkx1yiP5ryzY0g1E39H5npQVSJ615Qkc1ZDaCpUUwZkvpExD iZrEeM7DzmvZtJ212KH4z+0lcG3zYFZdUqfP+xggUYJcmWKwMqpfRpIm4uZU5PwedaJZ npgaa6iqeChe/TPQWpDsmrlen0fKfYVBrVHpB8qXAZBAyN0qYx9gSCWtUVpJ/ju4IMca Zw23rFYg6DybKNCTis3zY9g+NkgMViUc9DWV7wFZGfiVYx3v+K08RA+8DOL+Pn/i94ew 9oMEnFOt9wHdQkaYCflrDFWEIwxxq9HGpxXqTDNWPIJmOZ3gry9kjL1fr1zgSJPwuUaa FeZg== X-Gm-Message-State: AOAM530CrfHiiyU+NXRELBc8tWGbJe3kPFA0CQigKUcU/bPmgJ070hwt HpViQKIxrk9wJn3ohE41k+zKiasTAh4QRW9Ch4vrm/QfHa4PSjMvylRos3nrJMVo82s7LFj5xMU 1DLtmVoZDS3zYZsoNWhs2QpQSQEUwprCtZiJA9y7RNuq+eRGDzs/eDpIhMsEf70GDU15lrxpy9C BkxyMO1CDcCho= X-Google-Smtp-Source: ABdhPJxnfPLoKBiLbnhNxUY6qPdzEGqa0eiZYNUvADUcEqSCkix2aC/FQxUuzHFZmLrLqNz+MPlWhQ== X-Received: by 2002:a17:90a:a60e:: with SMTP id c14mr3764516pjq.31.1602757274747; Thu, 15 Oct 2020 03:21:14 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id 194sm2802258pfz.182.2020.10.15.03.21.12 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Oct 2020 03:21:14 -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 v3 03/17] scsi: No retries on abort success Date: Thu, 15 Oct 2020 08:57:28 +0530 Message-Id: <1602732462-10443-4-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1602732462-10443-1-git-send-email-muneendra.kumar@broadcom.com> References: <1602732462-10443-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. 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 --- v3: Merged first part of the previous patch(v2 patch3) with this patch. v2: set the hostbyte as DID_TRANSPORT_MARGINAL instead of DID_TRANSPORT_FAILFAST. --- drivers/scsi/scsi_error.c | 10 ++++++++++ drivers/scsi/scsi_lib.c | 1 + 2 files changed, 11 insertions(+) diff --git a/drivers/scsi/scsi_error.c b/drivers/scsi/scsi_error.c index ae80daa5d831..aa30c1c9e9db 100644 --- a/drivers/scsi/scsi_error.c +++ b/drivers/scsi/scsi_error.c @@ -1763,6 +1763,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. diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index 2b5dea07498e..9606bad1542f 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -629,6 +629,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);