Received: by 2002:ac8:6214:0:b0:429:955e:b7c6 with SMTP id ks20csp4450637qtb; Tue, 16 Jan 2024 12:47:06 -0800 (PST) X-Google-Smtp-Source: AGHT+IE2PyiJyleOt/n3FxHHVchGCRkaCNp8+TSr7p290TAguVRcG6cAiKjXaVUmQT+rqlau9wYe X-Received: by 2002:a17:906:4942:b0:a28:cf39:bf68 with SMTP id f2-20020a170906494200b00a28cf39bf68mr3601217ejt.115.1705438025877; Tue, 16 Jan 2024 12:47:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705438025; cv=pass; d=google.com; s=arc-20160816; b=zLVlOS21h/rJccWfmBxhtgAeNLlM8AVwC1NQNXOquYhQluhuXI8EYFk0rWh8ryJsmt hwbduv2hY0JmgS4HqN0uORhyANVDl/dd1/AfiYlExnHAEvOwDEaOQFtYpKD0DZnIC0WL q0qIj+xS2STN7hYJ/Lump6itkmS3JHC0bgNwUMglPhpkrRF4W8sQ77ZZz+z+/EAQVC2S Busfoys0lYNgcS+bBF/rpllXNPHUJtVwqWC8cVdIbwQC8vGWNFhU1SClNkGmQaBBe+zj oLoImQW+3Aakjnrb/zSXr2S54Mg3Zwob+yKDZv0xiXdgdGxHhqfQ5aA7M17hByebVycR Qa+A== 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=OcK1v5sLkBo+8RzBz2sjKDnPbd6daLoHSYYAyWxQWpQ=; fh=H/AEgLk1gcbxCTI9xdgjGhKPGh0iP9CMhXSt58byQ/k=; b=PI4EeMoSFfJ33iCwJ2aQEdWR5yJRirZlCrMbcxv8yEATony++N4EfFa8WIAnyQNdUR 5EnxgkDVLwVYkx8Gz6glU3cf7jixKcvoz5sCdXo1aYhKBdmL/qHthkWOKiJUfLJk4G5z b/Vbxp7A3so9GZ14bqMd68JzAbJX8U7gddLEojguFKoARwIjrY0KAlJ6TS0Rm7UXIN2l jT0hPBPP71X/XprQKY1Gkta50x6Ql7zl40O8x3gu0MaQPoyQXYVNZl6H6XcrFrtPrN1M luEA+ah1YCiWNH+Tzn8wA2G1HM6KbOi6AhwKYrUkfUwENGndYzyCuCYk48OxzJ1VO11r Em/A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=trt3OhCo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-27948-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27948-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. [147.75.80.249]) by mx.google.com with ESMTPS id ov12-20020a170906fc0c00b00a27d992a6d6si4981287ejb.610.2024.01.16.12.47.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 16 Jan 2024 12:47:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-27948-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=trt3OhCo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-27948-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-27948-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 7082C1F28DE1 for ; Tue, 16 Jan 2024 20:40:18 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B415212EE51; Tue, 16 Jan 2024 19:50:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="trt3OhCo" 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 D81B5574B9; Tue, 16 Jan 2024 19:50:39 +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=1705434639; cv=none; b=HTn751/hD5ooHp7xy+i+0N8oYuTKCYX1R6MtHfe/rt8XytUabdCXK/peBhuHqfWWvaf5YNhm0DO9adBTif32QmqnVRAKzpviiu8xnhWto5i4irlwO79BYyWZtwI7ZxAs+QRBZijgEe8nYGUymr47X3YyC5j/akXzaVqj4VRTeLU= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1705434639; c=relaxed/simple; bh=0d1xuC+FaJReAAN4MpEAixpItb3vPQAcvsPcZYbl8jc=; 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=B/msm3wF3qt+q1atN3tOLBZNmNh03/3lr5zGgLKqTNqzj8xyrydpxmE12x37NnVF3aCdpDKBB1cgv2xiNnnzAIhEnaReg/fW/a8ByjRL3vZHzQ1AhJFHcNn6399YVuadLYYoFYs9TvUn3FbiuXojL44V9vsqQOfv94yLyQFcmxg= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=trt3OhCo; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id D5B20C433B1; Tue, 16 Jan 2024 19:50:38 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1705434639; bh=0d1xuC+FaJReAAN4MpEAixpItb3vPQAcvsPcZYbl8jc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=trt3OhCoG4pHlEiUYvRYurVSUUCDezhfHToVaN45X34w62PpF94plGC7BKBLSNRV2 I4xC4RfmsIM2k5Dbm3Wg58VFvGfsEOZ7X35kGYlJ0p/3r+1y8fzWWZaq1DCZfXn/5+ fOkDmMdqVjENG1xWh8ZSYQCYeDEXLJU2yPgtRPfcHPsZ4w5xbkIE4HQ3MUCP6HRZ+I sJBW/GjyLprDEyBNKY39u8Ow2QshAEg814sGzY9Vwtrrj+F0rXL/DtLUcRU6AuArms BpKbYczntKYlDi8rIn8MR5RQz8lp0tRTsdqnwop1qmviqnk34bw7KhMezdGozdrvfF iz6XXOvlImSqw== 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 6.6 040/104] scsi: libfc: Don't schedule abort twice Date: Tue, 16 Jan 2024 14:46:06 -0500 Message-ID: <20240116194908.253437-40-sashal@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240116194908.253437-1-sashal@kernel.org> References: <20240116194908.253437-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 6.6.12 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 945adca5e72f..3f189cedf6db 100644 --- a/drivers/scsi/libfc/fc_fcp.c +++ b/drivers/scsi/libfc/fc_fcp.c @@ -265,6 +265,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; + } + this_cpu_inc(fsp->lp->stats->FcpPktAborts); fsp->state |= FC_SRB_ABORT_PENDING; @@ -1690,11 +1695,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