Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp852979pxk; Thu, 17 Sep 2020 19:07:23 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyMXY7P/8Z9ZqzKG8m5LU54nF5kQ6Bb3fZogdc9gcrJJAXi4s3vhsTOlM1LzCUtiHfBGSVg X-Received: by 2002:a05:6402:393:: with SMTP id o19mr36363570edv.34.1600394843033; Thu, 17 Sep 2020 19:07:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1600394843; cv=none; d=google.com; s=arc-20160816; b=s6SjnO5yvEgeDfducycINB4vmiC/YlHooFojTiTx4UHcwpWrHogl5YiIQVUiTS5uhR 5ZQj0k5FY8n6jAKGxkUuJacyKdEZYYrKLbmgvJ1fcnWdtyIqpGoRqer1JCu5d6NlgOKK iVzfATZMXkzjXY5irvI89A1E3rTOaSse8QdlXQOCJeU27sm9zdyeGO+QnZF0P4giPE7f yVj0U/scVmj7ItJuwix6Jt1ySRm/IUqNTPWmEiU0saZiA2QOfs5EAQIfg4QZZ984Ad5X jr8XdXwUfIVK+IHR5/pRNwHXGqizGqDjtMQfg4zvo3Bmgfwd2DAsjRC6QBNVkqAy3aw4 9GZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=3gNp3vuU5fytI7GuQRZuEkYiU1YNErl6PJevi0FgCac=; b=cPaJ2ox1d7M6vTfpa7D91UzrNqxmhspmoKLuf+61VRX0aRVfcxsNqIiceawe+eQ/Rh szGaGOL2M5mAMKGZdfvF91XJ0s0LZTWmMcDPB6REPK6VoN5pW1waRVPxiNTQNFw0fsKx I9/quprhHCd39SBF3PEWCQzezUbyY1iZ9aEZ5U3L4/dPNg/NhCAhbDcKKdxJyfkfLRVa Zp1VwRBy0VjZqcffCkLDF6zjdrRLRBggFCIylq63lqMv6NymnulwnTNpeLdKndwvyf4d DoWR6lMOgoHgtU4cbCa7YuK0JlfSN20isAza6GHjSg7GtzB6/KyeUALdE9ejpVBH2SyZ NfvQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B4im8mxl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sa19si1271616ejb.506.2020.09.17.19.06.59; Thu, 17 Sep 2020 19:07:23 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=B4im8mxl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727382AbgIRCEr (ORCPT + 99 others); Thu, 17 Sep 2020 22:04:47 -0400 Received: from mail.kernel.org ([198.145.29.99]:52204 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726564AbgIRCEh (ORCPT ); Thu, 17 Sep 2020 22:04:37 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 53F5623787; Fri, 18 Sep 2020 02:04:36 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1600394677; bh=lkg8m6S1AERhd6OentmklbggICnz3oY6EXh/TQXZc0I=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=B4im8mxlm1iKyEWrxzKoZG9mklI1Nde/pUsKvQ2P073C1FEp6Nrkyaw5b4Q9lIqj3 u7jkRfdKb/ubEu4Z0SF4yvv6kIqPCEz7RfydkxHQ8u7qQSjNaYa3180ydYiWzQo68l iHVvxdaqf6AvVMX02kYj4tGTSqr19FhH66Px1Lyc= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Sagar Biradar , Balsundar P , "Martin K . Petersen" , Sasha Levin , linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 5.4 167/330] scsi: aacraid: Disabling TM path and only processing IOP reset Date: Thu, 17 Sep 2020 21:58:27 -0400 Message-Id: <20200918020110.2063155-167-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200918020110.2063155-1-sashal@kernel.org> References: <20200918020110.2063155-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sagar Biradar [ Upstream commit bef18d308a2215eff8c3411a23d7f34604ce56c3 ] Fixes the occasional adapter panic when sg_reset is issued with -d, -t, -b and -H flags. Removal of command type HBA_IU_TYPE_SCSI_TM_REQ in aac_hba_send since iu_type, request_id and fib_flags are not populated. Device and target reset handlers are made to send TMF commands only when reset_state is 0. Link: https://lore.kernel.org/r/1581553771-25796-1-git-send-email-Sagar.Biradar@microchip.com Reviewed-by: Sagar Biradar Signed-off-by: Sagar Biradar Signed-off-by: Balsundar P Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/aacraid/commsup.c | 2 +- drivers/scsi/aacraid/linit.c | 34 +++++++++++++++++++++++++--------- 2 files changed, 26 insertions(+), 10 deletions(-) diff --git a/drivers/scsi/aacraid/commsup.c b/drivers/scsi/aacraid/commsup.c index 2142a649e865b..90fb17c5dd69c 100644 --- a/drivers/scsi/aacraid/commsup.c +++ b/drivers/scsi/aacraid/commsup.c @@ -728,7 +728,7 @@ int aac_hba_send(u8 command, struct fib *fibptr, fib_callback callback, hbacmd->request_id = cpu_to_le32((((u32)(fibptr - dev->fibs)) << 2) + 1); fibptr->flags |= FIB_CONTEXT_FLAG_SCSI_CMD; - } else if (command != HBA_IU_TYPE_SCSI_TM_REQ) + } else return -EINVAL; diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index 4a858789e6c5e..514aed38b5afe 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c @@ -723,7 +723,11 @@ static int aac_eh_abort(struct scsi_cmnd* cmd) status = aac_hba_send(HBA_IU_TYPE_SCSI_TM_REQ, fib, (fib_callback) aac_hba_callback, (void *) cmd); - + if (status != -EINPROGRESS) { + aac_fib_complete(fib); + aac_fib_free(fib); + return ret; + } /* Wait up to 15 secs for completion */ for (count = 0; count < 15; ++count) { if (cmd->SCp.sent_command) { @@ -902,11 +906,11 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd) info = &aac->hba_map[bus][cid]; - if (info->devtype != AAC_DEVTYPE_NATIVE_RAW && - info->reset_state > 0) + if (!(info->devtype == AAC_DEVTYPE_NATIVE_RAW && + !(info->reset_state > 0))) return FAILED; - pr_err("%s: Host adapter reset request. SCSI hang ?\n", + pr_err("%s: Host device reset request. SCSI hang ?\n", AAC_DRIVERNAME); fib = aac_fib_alloc(aac); @@ -921,7 +925,12 @@ static int aac_eh_dev_reset(struct scsi_cmnd *cmd) status = aac_hba_send(command, fib, (fib_callback) aac_tmf_callback, (void *) info); - + if (status != -EINPROGRESS) { + info->reset_state = 0; + aac_fib_complete(fib); + aac_fib_free(fib); + return ret; + } /* Wait up to 15 seconds for completion */ for (count = 0; count < 15; ++count) { if (info->reset_state == 0) { @@ -960,11 +969,11 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd) info = &aac->hba_map[bus][cid]; - if (info->devtype != AAC_DEVTYPE_NATIVE_RAW && - info->reset_state > 0) + if (!(info->devtype == AAC_DEVTYPE_NATIVE_RAW && + !(info->reset_state > 0))) return FAILED; - pr_err("%s: Host adapter reset request. SCSI hang ?\n", + pr_err("%s: Host target reset request. SCSI hang ?\n", AAC_DRIVERNAME); fib = aac_fib_alloc(aac); @@ -981,6 +990,13 @@ static int aac_eh_target_reset(struct scsi_cmnd *cmd) (fib_callback) aac_tmf_callback, (void *) info); + if (status != -EINPROGRESS) { + info->reset_state = 0; + aac_fib_complete(fib); + aac_fib_free(fib); + return ret; + } + /* Wait up to 15 seconds for completion */ for (count = 0; count < 15; ++count) { if (info->reset_state <= 0) { @@ -1033,7 +1049,7 @@ static int aac_eh_bus_reset(struct scsi_cmnd* cmd) } } - pr_err("%s: Host adapter reset request. SCSI hang ?\n", AAC_DRIVERNAME); + pr_err("%s: Host bus reset request. SCSI hang ?\n", AAC_DRIVERNAME); /* * Check the health of the controller -- 2.25.1