Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp325387ybk; Wed, 13 May 2020 00:55:00 -0700 (PDT) X-Google-Smtp-Source: APiQypKpAXJs7y5UnicVQYCki15clOhi+zz5m/A9yPSJo9lUzxBMTjza1RWuZkJxTm0niKvHbvVi X-Received: by 2002:a17:906:3791:: with SMTP id n17mr14995685ejc.262.1589356500814; Wed, 13 May 2020 00:55:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589356500; cv=none; d=google.com; s=arc-20160816; b=0DU5UxooP5kajLoGBRW1HkaJNS7w9v9zxX43RLy0y0b+e1M6NjJWUxUgx6AcCkpUeq igSkLyIUBhnHFWcdMJJMkB1rF8Hm/oCWq3VWfqJFAeILxfZUr+Omkq89uVj2eR38EQnK KI4lq80818S+raL5R1LpvKwTFSKZ728GpcfmyYmn71irZ8ojqNkAUVZJ/T7wT7CYOPlw LsayZT+IIf7tTCvot/pXf5bCvnBUegFiAPdyJZhQbJCHRzzSGSHWkD6zE8dyZbiih5k8 GCgpnIHYxIYzSIlwW/DZo7KUKVNlzy7CDrLkL4DXNz6I5BEswq0mxenPprUP7sWnZTtX ttUA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=eiUqIIe+7BWDJW4RF/Z3BDQiXOqs0NaDZqLczzJnZmw=; b=LTb6C5u3VMfjw1rCULoeV4smLeEzEknhdbO9Kgh9j+gvcSaR8p1pSHInoN7GL8lXj5 zYNX+cd5YKGZNJ4kwpIpservr1xFqFsEmKOGh0tdPUjxyEUt8cqJZJ2edhgM6mpJ4gSY s7PkCv1lueME57xdsUP4ZyHLU3KW3LjNG5XwFZKFoBKnwcrMfwCmZrUhMMiEbayaOYuq qyMviXd9tRtvWbz411XCyuM+hHtySKuBtdPFNzc8txMMtkT/oVCgrw9Sp/mvwPZu+xfS 07h93PZVxc4cDflaZrOKxhYub7bBIWmayxqXBAr/zk0dmOpfei9jYYgHqmzDDin8xKGl zraQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i3si5900558eds.277.2020.05.13.00.54.38; Wed, 13 May 2020 00:55:00 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729376AbgEMHv7 (ORCPT + 99 others); Wed, 13 May 2020 03:51:59 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:4401 "EHLO huawei.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728988AbgEMHv6 (ORCPT ); Wed, 13 May 2020 03:51:58 -0400 Received: from DGGEMS414-HUB.china.huawei.com (unknown [172.30.72.59]) by Forcepoint Email with ESMTP id 9F4B26A46A9277BEA75A; Wed, 13 May 2020 15:51:56 +0800 (CST) Received: from huawei.com (10.175.124.27) by DGGEMS414-HUB.china.huawei.com (10.3.19.214) with Microsoft SMTP Server id 14.3.487.0; Wed, 13 May 2020 15:51:49 +0800 From: Wu Bo To: , , , CC: , , , , Subject: [PATCH V2] nvme/core:disable streams when get stream params failed Date: Wed, 13 May 2020 16:05:32 +0800 Message-ID: <1589357132-511443-1-git-send-email-wubo40@huawei.com> X-Mailer: git-send-email 1.8.3.1 MIME-Version: 1.0 Content-Type: text/plain X-Originating-IP: [10.175.124.27] X-CFilter-Loop: Reflected Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org After enable nvme streams, then if get stream params failed, We should disable streams before return error in nvme_configure_directives() function. Signed-off-by: Wu Bo --- drivers/nvme/host/core.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c index f3c037f..298e60c 100644 --- a/drivers/nvme/host/core.c +++ b/drivers/nvme/host/core.c @@ -552,20 +552,24 @@ static int nvme_configure_directives(struct nvme_ctrl *ctrl) return ret; ret = nvme_get_stream_params(ctrl, &s, NVME_NSID_ALL); - if (ret) - return ret; + if (ret) { + goto out_disable_stream; + } ctrl->nssa = le16_to_cpu(s.nssa); if (ctrl->nssa < BLK_MAX_WRITE_HINTS - 1) { dev_info(ctrl->device, "too few streams (%u) available\n", ctrl->nssa); - nvme_disable_streams(ctrl); - return 0; + goto out_disable_stream; } ctrl->nr_streams = min_t(unsigned, ctrl->nssa, BLK_MAX_WRITE_HINTS - 1); dev_info(ctrl->device, "Using %u streams\n", ctrl->nr_streams); return 0; + +out_disable_stream: + nvme_disable_streams(ctrl); + return ret; } /* -- 1.8.3.1