Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp7258136rwb; Wed, 23 Nov 2022 04:26:51 -0800 (PST) X-Google-Smtp-Source: AA0mqf4P5zNCmkRffYfNN6OOe9ZP+VHmnu6WODv+BBC8oJjzAtdaL/Ha1thxGwbHoWFdbVHwmfpX X-Received: by 2002:a63:4449:0:b0:477:a5e2:7b78 with SMTP id t9-20020a634449000000b00477a5e27b78mr5828153pgk.322.1669206411394; Wed, 23 Nov 2022 04:26:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669206411; cv=none; d=google.com; s=arc-20160816; b=RqKzbfL7o7iJh5MESriS/TxUT34PyH2E8a7gulN4Dc/CqNzajVnjhYix91ckaz2rBt fPiI0SnHJOJ+Ku0kpcAhTM1a4E8TS4AbWzt8ekgyUN1d6ajNB0MyAzSd3MOFeVr0c45U b5k5sSBv45usG87NwGMPf4LSuuXmaGBoLde3nStR4VLshq4Q2t3lqNfd4z6A5++0jGB/ Fek/pIxW/olQDaur0frXsU1FX0ToGMZrsPbaCxdxcdmGg/Z9v3UsIlxpLT6wpb1KsAhB 0Ye8M8+K2Rt21qpUbuG/sKtoaYSbVU1P0EUQ/QKR6F6FmmnAUw2kzbN4JrR732TNQiqU jv4A== 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; bh=HMMHGb4YeWCEe58+IL/3PmOmedDUK7noYyhiLZwiQBw=; b=nncXvaOiz8fJNeWBTMMHHZpNP4BRJ6B4UC/KFsZbIuGzJeLa/5VozYCG6HK6NmfaBr NcT6INd61xjToTnrh08Q3MtxP5RvxZYYHI0UyleQehKEUVofYtl1mhsH2yDkttL4F+dK sAZXEx8yL24aEPBpNtCIj3uieTY3+XzGwk/OD0Vo9108pyDeYs7MQXTzKMUNERm5Y1uP j36ijAggw/EZBNhv9mhdy/blJai2Tsb1hum8P0G/MgVrC8o2cDGjSaSMebiTd0BRlwcj lS/wpLYt01vAFF1VBYqybUFaAm/LbjC6XKT43+O1GRzqiM0x5uICefpCzL/GPY1ezeMx y4bg== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ja1-20020a170902efc100b001891509807fsi9897579plb.575.2022.11.23.04.26.40; Wed, 23 Nov 2022 04:26:51 -0800 (PST) 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; 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=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237192AbiKWMWN (ORCPT + 90 others); Wed, 23 Nov 2022 07:22:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236498AbiKWMVy (ORCPT ); Wed, 23 Nov 2022 07:21:54 -0500 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9C3AF3F077; Wed, 23 Nov 2022 04:21:53 -0800 (PST) Received: from dggpemm500020.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4NHKwx5BjLzRnsC; Wed, 23 Nov 2022 20:21:21 +0800 (CST) Received: from dggpemm500017.china.huawei.com (7.185.36.178) by dggpemm500020.china.huawei.com (7.185.36.49) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 23 Nov 2022 20:21:51 +0800 Received: from build.huawei.com (10.175.101.6) by dggpemm500017.china.huawei.com (7.185.36.178) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Wed, 23 Nov 2022 20:21:51 +0800 From: Wenchao Hao To: Lee Duncan , Chris Leech , "Mike Christie" , "James E . J . Bottomley" , "Martin K . Petersen" , , CC: , , , Wenchao Hao Subject: [PATCH v3 2/2] scsi: donot increase scsi_device's iorequest_cnt if dispatch failed Date: Wed, 23 Nov 2022 20:21:37 +0800 Message-ID: <20221123122137.150776-3-haowenchao@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20221123122137.150776-1-haowenchao@huawei.com> References: <20221123122137.150776-1-haowenchao@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.101.6] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggpemm500017.china.huawei.com (7.185.36.178) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS 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 If scsi_dispatch_cmd() failed, the scsi command did not send to disks, so it would never done from LLDs. scsi scsi_queue_rq() would return BLK_STS_RESOURCE if scsi_dispatch_cmd() failed, the related request would be requeued, and the timeout of this request would not fired any more, so no one would increase iodone_cnt which matches with this increase of iorequest_cnt. Signed-off-by: Wenchao Hao Reviewed-by: Mike Christie --- drivers/scsi/scsi_lib.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/scsi/scsi_lib.c b/drivers/scsi/scsi_lib.c index ec890865abae..a29d87e57430 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1464,8 +1464,6 @@ static int scsi_dispatch_cmd(struct scsi_cmnd *cmd) struct Scsi_Host *host = cmd->device->host; int rtn = 0; - atomic_inc(&cmd->device->iorequest_cnt); - /* check if the device is still usable */ if (unlikely(cmd->device->sdev_state == SDEV_DEL)) { /* in SDEV_DEL we error all commands. DID_NO_CONNECT @@ -1764,6 +1762,7 @@ static blk_status_t scsi_queue_rq(struct blk_mq_hw_ctx *hctx, goto out_dec_host_busy; } + atomic_inc(&cmd->device->iorequest_cnt); return BLK_STS_OK; out_dec_host_busy: -- 2.32.0