Received: by 2002:a05:6358:45e:b0:b5:b6eb:e1f9 with SMTP id 30csp3086405rwe; Mon, 29 Aug 2022 05:43:24 -0700 (PDT) X-Google-Smtp-Source: AA6agR61VFu1NWUH3rXDBkZlJcnRarBIKy6Xd3ZpXz3daHzS9+/ek6VMmFz880scN4zcSTHcRpgp X-Received: by 2002:a17:902:cccb:b0:172:60b7:4590 with SMTP id z11-20020a170902cccb00b0017260b74590mr16171350ple.152.1661777004541; Mon, 29 Aug 2022 05:43:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661777004; cv=none; d=google.com; s=arc-20160816; b=kmErTq/NBbTqTKOg4CfZgTlDlWTEva03/PCeeLLIBH0iaDb9Dg0IAqonKQSCY9HOVw gVBaETEUx6a3cTPZQYOFnvvFYNkxPPo9XV5N7QWJ/DzVqRo7eMqa+wX/WZ3XYYesDi1x htbGG9nItM7a4K7/Z6RxHJcK7AihSbLrSW76vgJ97gQWg8Wb91cMJ+SyCPgEzh38xUs3 yqQx1j0JbbHTeOI9T/Mx2itObUTKNHq6m3fXqVz+qTmMvvrKuDpiiWeCX6S7pU8OstPN lKiSbofo5vyPzUiKQYgZxOQR5/EtRl4uAhXEMYJLpXjQQku0h8H9Q4Dif6AuskZJjKR/ bOqQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=gEt+6sJc33uLrooSw1JUIUU+ofGlpNLItPd8GCz2vuU=; b=Van/pOAVC01i05nRMYqO7gxYKp/krajISc0ql47LryHBXuwwFNgXrA9vm/0caHnzyT tVB4bugcMILLv7ReYe0qdHPNZjI1BLkvD227KMrX2KS6KtvADf1bQaKTz/CSemdfNu7h egbKAUbTWYLccvF6E2QNZqV+0dtuXM8rMFmuUcWh5XQ9DKxcf5k7fj/jYC/EuKOY2mQF dcatSTH4lVQE52e/div5HDzf5NvocwTy4Kpxu2d6QmfcGla4KC/7YXWyM6QudFgFXokX H5xjWWwd+CfuavLIV0HMbPR5xZF/UvQgVu5OIMlMNZlgGcA/tpcYfMmZgxht2qALpbBK YqRg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WZe8b8D0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w64-20020a638243000000b00429a15b4d01si4126557pgd.814.2022.08.29.05.43.12; Mon, 29 Aug 2022 05:43:24 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WZe8b8D0; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233025AbiH2Lna (ORCPT + 99 others); Mon, 29 Aug 2022 07:43:30 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232912AbiH2LnE (ORCPT ); Mon, 29 Aug 2022 07:43:04 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B736C85AA7; Mon, 29 Aug 2022 04:27:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 3DCEC611D7; Mon, 29 Aug 2022 11:19:40 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4535FC433C1; Mon, 29 Aug 2022 11:19:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1661771979; bh=4WjlWH8J126wrlHjO6n2BS/x3Mg6Ty1H/2N1ZLuMDIQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WZe8b8D08L8p0Z2p/UJLqWX1znryL83L+08TK4qCzrqQYTdECCPQy2xHF6uDBpP1j Hr0GctG3vcdrjolTOgp8wiQkrT0ntcz3LQ8a+5TklyZDrA+Hr44tO4KLgozeBbJk1B ix6jeXP+5lRN8ndq8qxuz6KW02zS3saF72zfOKpE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Christoph Hellwig , Mike Christie , "Martin K. Petersen" Subject: [PATCH 5.19 153/158] scsi: core: Fix passthrough retry counter handling Date: Mon, 29 Aug 2022 13:00:03 +0200 Message-Id: <20220829105815.534215031@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220829105808.828227973@linuxfoundation.org> References: <20220829105808.828227973@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Mike Christie commit fac8e558da9485e13a0ae0488aa0b8a8c307cd34 upstream. Passthrough users will set the scsi_cmnd->allowed value and were expecting up to $allowed retries. The problem is that before: commit 6aded12b10e0 ("scsi: core: Remove struct scsi_request") we used to set the retries on the scsi_request then copy them over to scsi_cmnd->allowed in scsi_setup_scsi_cmnd. With that patch we now set scsi_cmnd->allowed to 0 in scsi_prepare_cmd and overwrite what the passthrough user set. This moves the allowed initialization to after the blk_rq_is_passthrough() check so it's only done for the non-passthrough path where the ULD init_command will normally set an allowed value it prefers. Link: https://lore.kernel.org/r/20220812011206.9157-1-michael.christie@oracle.com Fixes: 6aded12b10e0 ("scsi: core: Remove struct scsi_request") Reviewed-by: Christoph Hellwig Signed-off-by: Mike Christie Signed-off-by: Martin K. Petersen Signed-off-by: Greg Kroah-Hartman --- drivers/scsi/scsi_lib.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1549,7 +1549,6 @@ static blk_status_t scsi_prepare_cmd(str scsi_init_command(sdev, cmd); cmd->eh_eflags = 0; - cmd->allowed = 0; cmd->prot_type = 0; cmd->prot_flags = 0; cmd->submitter = 0; @@ -1600,6 +1599,8 @@ static blk_status_t scsi_prepare_cmd(str return ret; } + /* Usually overridden by the ULP */ + cmd->allowed = 0; memset(cmd->cmnd, 0, sizeof(cmd->cmnd)); return scsi_cmd_to_driver(cmd)->init_command(cmd); }