Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1218326pxb; Thu, 16 Sep 2021 02:28:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzhdpl3UimbYBnT/i1OOX0PjP+9kqQlcQTd2p0YDNuSu1giPVLnBoViEg6qbAS80HaSOR1+ X-Received: by 2002:a17:906:adb:: with SMTP id z27mr5372735ejf.235.1631784525870; Thu, 16 Sep 2021 02:28:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631784525; cv=none; d=google.com; s=arc-20160816; b=HlFPiVaeVGBpsAq0FwrQJw8Q0RCmN7Ve+oAiu/UzD0HhfZtLPQbe2ijpu+XKvzZU3N G2D5cTJsguOUqQLRGhQU9VPxYBoGkhyTefYn7Mbt7eBKkYudLGdqKG8fiT03Sus+lmMd v9wG99GUJa540s5yHeYmnCJufQqTb+NKTBlHse5Yyj6MooGtyJazfHLNFhgFsY0r/WXS kmIxWOooYD1O5j4oJlWi6Sy8YC+J7IhovFOMNdNFGCx3nXK3IZNpR/6pCCqb1EuwjY5k SVzQc11UujUmyFhdOJvaBfsxzoo3uxkOZiHe8HyuDRytO4Z3afN1YHC7aS8uuQ+Z1zST sdNw== 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=7nE19N6KqBC2PUdZRD7JUk10mwF9kRC+vEbjtRhrWFY=; b=OiZc1hWBFN98ms5gM1C+maNajb3wkewu1pYInFNu7UtKWnWXj4VrXlMojYj7hSqScO TqrjCzBKNxTXiKX3pVyFffqeVz4Di5f0FjVy0Io3vgi+lrTnVcqhC9k9SP2B4FIgNc2W NcAcWFGrmR16qMf05xVJt5/uYVqjIRqj9hFIqwXqUMzkDDpUZpg9RQ/39E33XU3M9uZ5 yNIj002lh1/TBexCGD/Ts9o/CnpBVThI8pYVUx05RdH869NnYNseiLfV0/GwhIHj2F+2 1LAPrmX8riUE/1mFgXiSYpen4UqkfCKpvSE+p6mKKG7Z6RXr1Z5zpJs4ycFq6OwtMWTJ MeLQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id ka17si2853053ejc.609.2021.09.16.02.28.18; Thu, 16 Sep 2021 02:28:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235783AbhIPJZk (ORCPT + 99 others); Thu, 16 Sep 2021 05:25:40 -0400 Received: from szxga02-in.huawei.com ([45.249.212.188]:15427 "EHLO szxga02-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235479AbhIPJZ0 (ORCPT ); Thu, 16 Sep 2021 05:25:26 -0400 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.55]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4H9BPV1rhhzRG9V; Thu, 16 Sep 2021 17:19:58 +0800 (CST) Received: from dggema762-chm.china.huawei.com (10.1.198.204) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256) id 15.1.2308.8; Thu, 16 Sep 2021 17:24:04 +0800 Received: from huawei.com (10.175.127.227) by dggema762-chm.china.huawei.com (10.1.198.204) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.2308.8; Thu, 16 Sep 2021 17:24:03 +0800 From: Yu Kuai To: , , , CC: , , , , Subject: [patch v8 4/7] nbd: don't start request if nbd_queue_rq() failed Date: Thu, 16 Sep 2021 17:33:47 +0800 Message-ID: <20210916093350.1410403-5-yukuai3@huawei.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210916093350.1410403-1-yukuai3@huawei.com> References: <20210916093350.1410403-1-yukuai3@huawei.com> MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems705-chm.china.huawei.com (10.3.19.182) To dggema762-chm.china.huawei.com (10.1.198.204) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org commit 6a468d5990ec ("nbd: don't start req until after the dead connection logic") move blk_mq_start_request() from nbd_queue_rq() to nbd_handle_cmd() to skip starting request if the connection is dead. However, request is still started in other error paths. Currently, blk_mq_end_request() will be called immediately if nbd_queue_rq() failed, thus start request in such situation is useless. So remove blk_mq_start_request() from error paths in nbd_handle_cmd(). Signed-off-by: Yu Kuai --- drivers/block/nbd.c | 3 --- 1 file changed, 3 deletions(-) diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index c724a5bd7fa4..22c91d8901f6 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c @@ -934,7 +934,6 @@ static int nbd_handle_cmd(struct nbd_cmd *cmd, int index) if (!refcount_inc_not_zero(&nbd->config_refs)) { dev_err_ratelimited(disk_to_dev(nbd->disk), "Socks array is empty\n"); - blk_mq_start_request(req); return -EINVAL; } config = nbd->config; @@ -943,7 +942,6 @@ static int nbd_handle_cmd(struct nbd_cmd *cmd, int index) dev_err_ratelimited(disk_to_dev(nbd->disk), "Attempted send on invalid socket\n"); nbd_config_put(nbd); - blk_mq_start_request(req); return -EINVAL; } cmd->status = BLK_STS_OK; @@ -967,7 +965,6 @@ static int nbd_handle_cmd(struct nbd_cmd *cmd, int index) */ sock_shutdown(nbd); nbd_config_put(nbd); - blk_mq_start_request(req); return -EIO; } goto again; -- 2.31.1