Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2418228rwi; Fri, 21 Oct 2022 03:44:38 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7iWLbXNVdfTFaIFKhfsoHU+rvZP3yXP+3X09FLLDu3IjHY4dZeIKSjQep9HwBwwAUNyi2J X-Received: by 2002:a17:907:9611:b0:78d:bb06:90a3 with SMTP id gb17-20020a170907961100b0078dbb0690a3mr14904589ejc.233.1666349077876; Fri, 21 Oct 2022 03:44:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666349077; cv=none; d=google.com; s=arc-20160816; b=MLDeYBAJsXEt6JXVdW9cJ5DZv9Mxt1pKtIjG1LP3S9YMrXy7V6Gx2ks0bFulp0amqZ QAd/ECOk4ArcZgvMQo7Q/U0hBkn8cNeVm11zdnRe+8MKodDjnoQ3R73hyPkZE2o+Xd2g na16K9So06NQkcx1rTzuQJZn2Cu4nLWK68PeiVDlqo5v60rfBiFVcOWwkbo5XooEIbM6 BJ8Zp7EhQ/xnF5FwbWwsE0ITdWrPsHqHPeq7fPS4NaPk/+j2yAe08J10NoqY27i5lRk5 CTz8lDjPFA1J/gNk+0FzBbEFl1MJmSqEASlR9UiW1c94EPvgjB4zxRhmmXxvMH2Dv64P pmUg== 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=4M4wAGTaVDIICN3zc2u8ysY0oGRhbASaQlu9xZ9pjtw=; b=oe+Wz1DEt+QTunuimTSAXFW4ew0JcXznDQhe3udAgS8ZF+uSwdOEjh+/8CWJWz4wNa FZsod36Ek+z0DlSYZlqSyO+8d64KEDVC8Fu1oZQU0vlBgKbwxw5p2iqChwEHMtutrh8i 4eE9mVUCQHSn3EafhDIhtvT7zwNTODcjPLKO63OFu9tKJzPeU2mzJL0XJ0D2bk8Dx8mF 6Cc0RbqQOP5eKZV6jVckD+fcYdh2xY9lz13mfRJvAnB6mBk6307q/qHS6juRtsCcbuBz xCXv48T+0r/LU+C/PWb0sorEeoVkfXKotLtov7wRC1m45eA5hqlj9SdsE199dXoOdg8x +5TQ== 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 sg20-20020a170907a41400b007918f4994f4si15150617ejc.15.2022.10.21.03.44.12; Fri, 21 Oct 2022 03:44:37 -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; 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 S229864AbiJUKkg (ORCPT + 99 others); Fri, 21 Oct 2022 06:40:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53606 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229740AbiJUKkb (ORCPT ); Fri, 21 Oct 2022 06:40:31 -0400 Received: from szxga02-in.huawei.com (szxga02-in.huawei.com [45.249.212.188]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 08547FFFB4; Fri, 21 Oct 2022 03:40:24 -0700 (PDT) Received: from dggpemm500023.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4Mv18H2j8tzVhxv; Fri, 21 Oct 2022 18:35:43 +0800 (CST) Received: from dggpemm500017.china.huawei.com (7.185.36.178) by dggpemm500023.china.huawei.com (7.185.36.83) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.31; Fri, 21 Oct 2022 18:40:11 +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; Fri, 21 Oct 2022 18:40:11 +0800 From: Wenchao Hao To: "James E . J . Bottomley" , "Martin K . Petersen" , , CC: Steffen Maier , , , Wenchao Hao Subject: [PATCH v2 2/2] scsi: donot increase scsi_device's iorequest_cnt if dispatch failed Date: Fri, 21 Oct 2022 19:56:38 -0400 Message-ID: <20221021235638.1968832-3-haowenchao@huawei.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20221021235638.1968832-1-haowenchao@huawei.com> References: <20221021235638.1968832-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: dggems702-chm.china.huawei.com (10.3.19.179) To dggpemm500017.china.huawei.com (7.185.36.178) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-1.0 required=5.0 tests=BAYES_00,DATE_IN_FUTURE_12_24, RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_PASS autolearn=no 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 --- 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 8b89fab7c420..71edb9ffbe16 100644 --- a/drivers/scsi/scsi_lib.c +++ b/drivers/scsi/scsi_lib.c @@ -1469,8 +1469,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.35.3