linux-nvme.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [RESENT PATCH V2] nvme/core:disable streams when get stream params failed
@ 2020-05-13  8:18 Wu Bo
  2020-05-14 15:12 ` Christoph Hellwig
  0 siblings, 1 reply; 2+ messages in thread
From: Wu Bo @ 2020-05-13  8:18 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi
  Cc: linfeilong, wubo40, linux-kernel, linux-nvme, liuzhiqiang26

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 <wubo40@huawei.com>
---
 drivers/nvme/host/core.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f3c037f..29bef53 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -553,19 +553,22 @@ static int nvme_configure_directives(struct nvme_ctrl *ctrl)
 
 	ret = nvme_get_stream_params(ctrl, &s, NVME_NSID_ALL);
 	if (ret)
-		return 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


_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply related	[flat|nested] 2+ messages in thread

* Re: [RESENT PATCH V2] nvme/core:disable streams when get stream params failed
  2020-05-13  8:18 [RESENT PATCH V2] nvme/core:disable streams when get stream params failed Wu Bo
@ 2020-05-14 15:12 ` Christoph Hellwig
  0 siblings, 0 replies; 2+ messages in thread
From: Christoph Hellwig @ 2020-05-14 15:12 UTC (permalink / raw)
  To: Wu Bo
  Cc: linfeilong, sagi, linux-kernel, linux-nvme, liuzhiqiang26, axboe,
	kbusch, hch

Thanks,

applied to nvme-5.8.

_______________________________________________
linux-nvme mailing list
linux-nvme@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-nvme

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2020-05-14 15:12 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-05-13  8:18 [RESENT PATCH V2] nvme/core:disable streams when get stream params failed Wu Bo
2020-05-14 15:12 ` Christoph Hellwig

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).