public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] nvme/core:disable streams when get stream params failed
@ 2020-05-06  8:37 Wu Bo
  2020-05-12 16:06 ` Christoph Hellwig
  0 siblings, 1 reply; 3+ messages in thread
From: Wu Bo @ 2020-05-06  8:37 UTC (permalink / raw)
  To: kbusch, axboe, hch, sagi
  Cc: linux-nvme, linux-kernel, liuzhiqiang26, linfeilong, wubo40

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 | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
index f2adea9..afe1f5a 100644
--- a/drivers/nvme/host/core.c
+++ b/drivers/nvme/host/core.c
@@ -552,8 +552,10 @@ static int nvme_configure_directives(struct nvme_ctrl *ctrl)
 		return ret;
 
 	ret = nvme_get_stream_params(ctrl, &s, NVME_NSID_ALL);
-	if (ret)
+	if (ret) {
+		nvme_disable_streams(ctrl);
 		return ret;
+	}
 
 	ctrl->nssa = le16_to_cpu(s.nssa);
 	if (ctrl->nssa < BLK_MAX_WRITE_HINTS - 1) {
-- 
1.8.3.1


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

* Re: [PATCH] nvme/core:disable streams when get stream params failed
  2020-05-06  8:37 [PATCH] nvme/core:disable streams when get stream params failed Wu Bo
@ 2020-05-12 16:06 ` Christoph Hellwig
  2020-05-13  6:12   ` Wu Bo
  0 siblings, 1 reply; 3+ messages in thread
From: Christoph Hellwig @ 2020-05-12 16:06 UTC (permalink / raw)
  To: Wu Bo
  Cc: kbusch, axboe, hch, sagi, linux-nvme, linux-kernel, liuzhiqiang26,
	linfeilong

On Wed, May 06, 2020 at 04:37:01PM +0800, Wu Bo wrote:
> 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 | 4 +++-
>  1 file changed, 3 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
> index f2adea9..afe1f5a 100644
> --- a/drivers/nvme/host/core.c
> +++ b/drivers/nvme/host/core.c
> @@ -552,8 +552,10 @@ static int nvme_configure_directives(struct nvme_ctrl *ctrl)
>  		return ret;
>  
>  	ret = nvme_get_stream_params(ctrl, &s, NVME_NSID_ALL);
> -	if (ret)
> +	if (ret) {
> +		nvme_disable_streams(ctrl);
>  		return ret;
> +	}

Please use a out_disable goto label to not duplicate the error
handling with the other case that needs it.

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

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

On 2020/5/13 0:06, Christoph Hellwig wrote:
> On Wed, May 06, 2020 at 04:37:01PM +0800, Wu Bo wrote:
>> 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 | 4 +++-
>>   1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/nvme/host/core.c b/drivers/nvme/host/core.c
>> index f2adea9..afe1f5a 100644
>> --- a/drivers/nvme/host/core.c
>> +++ b/drivers/nvme/host/core.c
>> @@ -552,8 +552,10 @@ static int nvme_configure_directives(struct nvme_ctrl *ctrl)
>>   		return ret;
>>   
>>   	ret = nvme_get_stream_params(ctrl, &s, NVME_NSID_ALL);
>> -	if (ret)
>> +	if (ret) {
>> +		nvme_disable_streams(ctrl);
>>   		return ret;
>> +	}
> 
> Please use a out_disable goto label to not duplicate the error
> handling with the other case that needs it.
> 

OK, I will modify it in the V2 patch.

Thanks,
Wu Bo

> .
> 



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

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

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-05-06  8:37 [PATCH] nvme/core:disable streams when get stream params failed Wu Bo
2020-05-12 16:06 ` Christoph Hellwig
2020-05-13  6:12   ` Wu Bo

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox