Received: by 2002:a05:7412:8d1c:b0:fa:4c10:6cad with SMTP id bj28csp32899rdb; Tue, 16 Jan 2024 14:02:48 -0800 (PST) X-Google-Smtp-Source: AGHT+IH3Y/JrhBvE4L77BHqUMwZfKn282Gled2s9CaYQcZRIPPqj2yTxFUJwdSwzYByQMv27OHlq X-Received: by 2002:a17:907:3e0d:b0:a27:6e73:a248 with SMTP id hp13-20020a1709073e0d00b00a276e73a248mr3326532ejc.68.1705442568801; Tue, 16 Jan 2024 14:02:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705442568; cv=pass; d=google.com; s=arc-20160816; b=SbzZeDZqVYaWBiyl3OJICdI8rO0RxzUJjx08QQqO6cGM2ugWfnOVbwN/kaHligoUL7 gzE4gCUm3lNZDR7NZ+hRKJyZNAm9J6RwlgfRiMx9rdZTUwfp61XZ6k1JdX8Qd43iLWky HG9bjuu8S/FWiBzqoU/32ZmeGG4eQeMhjA//N012uPk9v6aNSxnsLp8uMrN0svzYbVpu dT25CnmPVacCvCu+HUPZGgE9VOPqJkaWdsihtu8MRTkG+IeIMb1FPE+2j88s1dST4LMj Wfrc+tsxOZjn+BF5xq+H8XQBW3eOOfkkSyvbsf2+qqW782mYUE4N5wqAAdIfaNix3i8X c0EQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=/3BpSRBwTnhlHiFTZphRU5aqFCcbamQOG7UugTwq5A4=; fh=H/AEgLk1gcbxCTI9xdgjGhKPGh0iP9CMhXSt58byQ/k=; b=gZXG+2nOjRQw8n/Y7C4fRuiRWfAo48wu2Pi6TM/r7JUxtQ9gOTjx3jmW5JIDzIpIEj bdKISMierlGhUmG8g2SsoqSHjiqgh+Eg/CYIpm2kPcjSeg0NH1JyUjdkqvME+EQu/HNZ MTPXS1aUReLx0Ejqp6kLDX0L6IEsYO+83Nepvh/oMpf0lVlIX5XdMgy9JFUrKtBx02g8 AaCU1iX6oKlB2Qrku1vKA/1guIlVY1eZRJCgLuNHlLpL3yB9ei63jiD79mrzvTbiTQ4M M42Cn6mAFjBA2VcRWazU68icAxpqaR9WZw3y87bZd3TOHChzOv+rZ4UM/b4g5Vf2+RGB GdqQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=By+7SD0u; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-28219-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28219-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ec2-20020a170906b6c200b00a2d348c55b8si3123128ejb.16.2024.01.16.14.02.48 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 14:02:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-28219-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=By+7SD0u; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-28219-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-28219-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id 616B01F2859A for ; Tue, 16 Jan 2024 22:02:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 994E767758; Tue, 16 Jan 2024 20:04:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="By+7SD0u" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BD0AD67723; Tue, 16 Jan 2024 20:04:48 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705435488; cv=none; b=SjzUfT3RAu76zRIKSflv+KBYpEfIt3hBAv3EtERYSZDhxkDAsALX9Vmcj1peU2V1M0rzItSG+BVZKvKrpJvQ1lV2R+v5+FXzMSQex3x8F0X899QH0NfOPjnq39n6/BpU3HMMN1cKnUD0C1Usb1Sgr7HTZvCpC+yHHh7jzl4UsmU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705435488; c=relaxed/simple; bh=2E5DkhatVCjnaZVP/uUdkTzUXdyfK7XbkiM1SjU/vM8=; h=Received:DKIM-Signature:From:To:Cc:Subject:Date:Message-ID: X-Mailer:In-Reply-To:References:MIME-Version:X-stable: X-Patchwork-Hint:X-stable-base:Content-Transfer-Encoding; b=P1C/L1gTDf3JY9WT+DxZ6I8kAqCfS5J9UjWR1BWUfm4/EjZCEEhD4oxN/HaRUqQnDSKfOi/rhOs9KKXxKLVz9bcMTWQXc3J4LpO3f9SRpBw3UBhOj8AYdLtjYsQ89HdMak9tNe2DJ+bFv/IhRoDOb6P+SZ2m11gec31vrsIrKyk= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=By+7SD0u; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id B946EC43390; Tue, 16 Jan 2024 20:04:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705435488; bh=2E5DkhatVCjnaZVP/uUdkTzUXdyfK7XbkiM1SjU/vM8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=By+7SD0u8HrUoVSa7YdBN4Wg54Pv2sjLZx2rKdeLZar/oYMRan8nb50lQYUnuQ/jz 87moT/IY46LyKJbQVOV9w+XWTzGJbsWM6qIKWmnA4Qqk0MuOxHfrIVzCjiwD3OjpJ3 OnltoaEOSd7B5Xv7TD2QYKwaQblXdY1TvsxIR33tya8y8JICvPKSMzIMZz1zU9Y3Ij ykFHqvhBl+1oWUO3q7m1N4ULdd63Ik+mt8wD1SZp5fvdATgZgqh+Ak0s7dH7ZgNGqM PlQ+kbwWa1MxfJOtuT1DWKtyQjZyYz2mNAjwirQuQHADHobi5n17nOGwURoO1rjMA/ IzK09OQgGQdxg== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Hannes Reinecke , Christoph Hellwig , "Martin K . Petersen" , Sasha Levin , jejb@linux.ibm.com, linux-scsi@vger.kernel.org Subject: [PATCH AUTOSEL 4.19 08/22] scsi: libfc: Don't schedule abort twice Date: Tue, 16 Jan 2024 15:04:02 -0500 Message-ID: <20240116200432.260016-8-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116200432.260016-1-sashal@kernel.org> References: <20240116200432.260016-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore X-stable-base: Linux 4.19.305 Content-Transfer-Encoding: 8bit From: Hannes Reinecke [ Upstream commit b57c4db5d23b9df0118a25e2441c9288edd73710 ] The current FC error recovery is sending up to three REC (recovery) frames in 10 second intervals, and as a final step sending an ABTS after 30 seconds for the command itself. Unfortunately sending an ABTS is also the action for the SCSI abort handler, and the default timeout for SCSI commands is also 30 seconds. This causes two ABTS to be scheduled, with the libfc one slightly earlier. The ABTS scheduled by SCSI EH then sees the command to be already aborted, and will always return with a 'GOOD' status irrespective on the actual result from the first ABTS. This causes the SCSI EH abort handler to always succeed, and SCSI EH never to be engaged. Fix this by not issuing an ABTS when a SCSI command is present for the exchange, but rather wait for the abort scheduled from SCSI EH. And warn if an abort is already scheduled to avoid similar errors in the future. Signed-off-by: Hannes Reinecke Link: https://lore.kernel.org/r/20231129165832.224100-2-hare@kernel.org Reviewed-by: Christoph Hellwig Signed-off-by: Martin K. Petersen Signed-off-by: Sasha Levin --- drivers/scsi/libfc/fc_fcp.c | 16 +++++++++++----- 1 file changed, 11 insertions(+), 5 deletions(-) diff --git a/drivers/scsi/libfc/fc_fcp.c b/drivers/scsi/libfc/fc_fcp.c index 4fae253d4f3d..119117443496 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c @@ -282,6 +282,11 @@ static int fc_fcp_send_abort(struct fc_fcp_pkt *fsp) if (!fsp->seq_ptr) return -EINVAL; + if (fsp->state & FC_SRB_ABORT_PENDING) { + FC_FCP_DBG(fsp, "abort already pending\n"); + return -EBUSY; + } + per_cpu_ptr(fsp->lp->stats, get_cpu())->FcpPktAborts++; put_cpu(); @@ -1710,11 +1715,12 @@ static void fc_fcp_recovery(struct fc_fcp_pkt *fsp, u8 code) fsp->status_code = code; fsp->cdb_status = 0; fsp->io_status = 0; - /* - * if this fails then we let the scsi command timer fire and - * scsi-ml escalate. - */ - fc_fcp_send_abort(fsp); + if (!fsp->cmd) + /* + * Only abort non-scsi commands; otherwise let the + * scsi command timer fire and scsi-ml escalate. + */ + fc_fcp_send_abort(fsp); } /** -- 2.43.0