From patchwork Thu Oct 22 12:34:49 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Muneendra Kumar M X-Patchwork-Id: 11851857 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 03A4914B2 for ; Thu, 22 Oct 2020 19:28:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id CD42E2466D for ; Thu, 22 Oct 2020 19:28:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=broadcom.com header.i=@broadcom.com header.b="Ao+N+zTM" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S370203AbgJVT23 (ORCPT ); Thu, 22 Oct 2020 15:28:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2508349AbgJVT23 (ORCPT ); Thu, 22 Oct 2020 15:28:29 -0400 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 2CF9DC0613CE for ; Thu, 22 Oct 2020 12:28:29 -0700 (PDT) Received: by mail-pl1-x641.google.com with SMTP id t4so1476423plq.13 for ; Thu, 22 Oct 2020 12:28:29 -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=3zq35Fg2X25UHROfLAAKqHg+C070OElbqopYZARNkMc=; b=Ao+N+zTMfSTBmw79QvQjDipObSomlDpb33GG9ZHX6tvs8O/TeYehnx45t2dgXPxVNb IOdEFe283IZVUYBIo/nU9aVjRtV1fnp+KsiRIIKe2dvtGWcc06XwH3dmwT0IFpHdjX1D A5HCGXLTlRrfS97YZD9UC+jif+E4lB5Am8wNo= 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=3zq35Fg2X25UHROfLAAKqHg+C070OElbqopYZARNkMc=; b=DpC3eI7pFqzJJy2uAsN1TH8XXTYHSEb5re4JaCoUZU9ZyfCQdwSdCtNY3B6Qp65pp4 u/18YDN3XH+BEZna3+XhWcLwcF521PdqTAUHUfp5e3y85kzG6ojb6wTQuIx29GhJzhid PjYx/zBBdrcCTgdw4eO/Z5kszo29UEFt2TOSIWm/NxAvliPl5N0jhvMkqylaiAJ6l6nR 4Qu6958tDFmqiQSTxX3bMzi7OStZQTrfF+gnhFlQtkJTGVrxD3XFsfa0oYp0qrJDEOTd LjAOpAB2FMjnd9gMcXvmBh8QQnibIloRyeVDklkxmcO9uWeJ4Ndk+h+WD1KQ1CNf4Wg/ aDAw== X-Gm-Message-State: AOAM533Dfe2Q0A2ll10BGg/kJ+cwVUKJw8TEO2T6k2M5PukV8RbdKm6q B7ZLPHX5Iy6aDXHZ1dz5EZbLFcgPc3bObodx7+PTz29Di5dMKMHM5UrYGOQBouJwTw+QfDoObVr 0Btl6DgF+2FAenQWQfRrlMCw46jbkDcJT86zzGeYnugcCNRxj3AyOVwlZzFcsdNATMkgYCRvnQ8 g7U0/Osjy9ugg= X-Google-Smtp-Source: ABdhPJw7+L1dMA1EBD8PazsggJaz43CgpsswULuta6QdEltoFNHjYEue14W9OleN8FWUI5HVPHY0xA== X-Received: by 2002:a17:902:369:b029:d6:1d46:21dc with SMTP id 96-20020a1709020369b02900d61d4621dcmr941853pld.56.1603394908164; Thu, 22 Oct 2020 12:28:28 -0700 (PDT) Received: from localhost.localdomain ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id s10sm2846759pji.7.2020.10.22.12.28.25 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Thu, 22 Oct 2020 12:28:27 -0700 (PDT) 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 v4 3/5] scsi: No retries on abort success Date: Thu, 22 Oct 2020 18:04:49 +0530 Message-Id: <1603370091-9337-4-git-send-email-muneendra.kumar@broadcom.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1603370091-9337-1-git-send-email-muneendra.kumar@broadcom.com> References: <1603370091-9337-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 --- v4: Modified the comments in the code appropriately 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..5c016270bda2 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 checking 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);