From patchwork Tue Aug 16 08:08:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Sreekanth Reddy X-Patchwork-Id: 12944503 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 66BEAC2BB41 for ; Tue, 16 Aug 2022 09:33:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233443AbiHPJdE (ORCPT ); Tue, 16 Aug 2022 05:33:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50010 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231773AbiHPJce (ORCPT ); Tue, 16 Aug 2022 05:32:34 -0400 Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5556F43A1 for ; Tue, 16 Aug 2022 00:55:47 -0700 (PDT) Received: by mail-pl1-x62d.google.com with SMTP id w14so8499716plp.9 for ; Tue, 16 Aug 2022 00:55:47 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=broadcom.com; s=google; h=mime-version:message-id:date:subject:cc:to:from:from:to:cc; bh=CrGRx3UJFMu91qTHb6a+nzF/Bvy8L9hKl9c+fUtnNZ0=; b=FG6Tp9lOHGShFst2VeZh4TgBsXQ+aMIJ1kt//JJsTY5Jd8XfWORsiROxp/uWhKGbOL txsHLd3CMzqS4I0quHE2ZcsqbWa4eEXYgBzNqm9bq7NgtcK6+LzbvGtREsw1BfVk/jD3 TuxYsC5hdI9fzgvLS+fGCkr4gesMlbV3M2n2Y= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=mime-version:message-id:date:subject:cc:to:from:x-gm-message-state :from:to:cc; bh=CrGRx3UJFMu91qTHb6a+nzF/Bvy8L9hKl9c+fUtnNZ0=; b=rO8W1CDHKkqIg9hNcdFK1XIofaSTH5xz5HgOv1N2zvOhjCeCXwullYNcKq4soCk3+E PnxVsjb1vEd+Os7St6TUibJYCrr4AfCxGnPHYFq84VyEV6c1X4bOyIdClokaHbmzK93A MoDkO9lmhtnUhA1Niog5pzBIw8jgpQN8HWnOG/4+O95txXZ432bmF5aescwNItlqRzh4 AqRm/Vjmsjsf904ZN01ont30TgJKGvk/865yloIC0B89jQ0Ma+tItWT4ttZnnRJXMzOu j1aKGpeUHsU7DlFfkSNkrtcP608mwXGIqRR5dW4N2+XTIu0G0vD9xfc2hB4/jS6fJCUV bAwQ== X-Gm-Message-State: ACgBeo1Q2Id35WF3Q8WKAIDU869egKIYEUFLvYRTAHyZBpUIpZw9ABRX gj7/0q2EAQ/1w2qhAaB7ZrVTvZWaYMvaa+n+T4dWinmpF6QOaEkh5NWV7baEt1in3LWR81jVXZh XcFz74t7JtIKKC+Fz2WMXq384H4o713mZTO6MGAO2zjJmpba5wXXlJRGKWxOw33p7vuDFp5VPCv uz1n7WzAfx X-Google-Smtp-Source: AA6agR5BE3zQZCbylIqdhl+RCLlQb3XCqobRYO6G9ou4kcNTtQoxqfKrlPLiMa11dKeNttUphy68WQ== X-Received: by 2002:a17:90b:4a87:b0:1f7:8c7b:931a with SMTP id lp7-20020a17090b4a8700b001f78c7b931amr22159863pjb.241.1660636546006; Tue, 16 Aug 2022 00:55:46 -0700 (PDT) Received: from dhcp-10-123-20-36.dhcp.broadcom.net ([192.19.234.250]) by smtp.gmail.com with ESMTPSA id f10-20020a63f74a000000b003db7de758besm6986868pgk.5.2022.08.16.00.55.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Aug 2022 00:55:45 -0700 (PDT) From: Sreekanth Reddy To: linux-scsi@vger.kernel.org Cc: martin.petersen@oracle.com, Sreekanth Reddy Subject: [PATCH] mpt3sas: Stop Error handler escalation when device removed Date: Tue, 16 Aug 2022 13:38:01 +0530 Message-Id: <20220816080801.13929-1-sreekanth.reddy@broadcom.com> X-Mailer: git-send-email 2.27.0 MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org If SCSI Error Handler is going on for timedout I/Os on a drive and that corresponding drive is removed then stop escalating to higher level of reset by returning the TUR with "I_T NEXUS LOSS OCCURRED" sense key. Signed-off-by: Sreekanth Reddy --- drivers/scsi/mpt3sas/mpt3sas_scsih.c | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/drivers/scsi/mpt3sas/mpt3sas_scsih.c b/drivers/scsi/mpt3sas/mpt3sas_scsih.c index e54747a..465603b 100644 --- a/drivers/scsi/mpt3sas/mpt3sas_scsih.c +++ b/drivers/scsi/mpt3sas/mpt3sas_scsih.c @@ -5156,6 +5156,19 @@ scsih_qcmd(struct Scsi_Host *shost, struct scsi_cmnd *scmd) /* invalid device handle */ handle = sas_target_priv_data->handle; + + /* + * Avoid error handling escallation when device is disconnected + */ + if (handle == MPT3SAS_INVALID_DEVICE_HANDLE || sas_device_priv_data->block) { + if (scmd->device->host->shost_state == SHOST_RECOVERY && + scmd->cmnd[0] == TEST_UNIT_READY) { + scsi_build_sense(scmd, 0, UNIT_ATTENTION, 0x29, 0x07); + scsi_done(scmd); + return 0; + } + } + if (handle == MPT3SAS_INVALID_DEVICE_HANDLE) { scmd->result = DID_NO_CONNECT << 16; scsi_done(scmd);