linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio
@ 2022-08-15  3:48 Sun Ke
  2022-08-15  4:03 ` Gao Xiang
                   ` (3 more replies)
  0 siblings, 4 replies; 8+ messages in thread
From: Sun Ke @ 2022-08-15  3:48 UTC (permalink / raw)
  To: xiang, chao; +Cc: linux-erofs, linux-kernel, kernel-janitors, yinxin.x, sunke32

If erofs_fscache_alloc_request fail and then goto out, it will return 0.
it should return a negative error code instead of 0.

Fixes: d435d53228dd ("erofs: change to use asynchronous io for fscache readpage/readahead")
Signed-off-by: Sun Ke <sunke32@huawei.com>
---
 fs/erofs/fscache.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c
index 8e01d89c3319..b5fd9d71e67f 100644
--- a/fs/erofs/fscache.c
+++ b/fs/erofs/fscache.c
@@ -222,8 +222,10 @@ static int erofs_fscache_meta_read_folio(struct file *data, struct folio *folio)
 
 	rreq = erofs_fscache_alloc_request(folio_mapping(folio),
 				folio_pos(folio), folio_size(folio));
-	if (IS_ERR(rreq))
+	if (IS_ERR(rreq)) {
+		ret = PTR_ERR(rreq);
 		goto out;
+	}
 
 	return erofs_fscache_read_folios_async(mdev.m_fscache->cookie,
 				rreq, mdev.m_pa);
@@ -301,8 +303,10 @@ static int erofs_fscache_read_folio(struct file *file, struct folio *folio)
 
 	rreq = erofs_fscache_alloc_request(folio_mapping(folio),
 				folio_pos(folio), folio_size(folio));
-	if (IS_ERR(rreq))
+	if (IS_ERR(rreq)) {
+		ret = PTR_ERR(rreq);
 		goto out_unlock;
+	}
 
 	pstart = mdev.m_pa + (pos - map.m_la);
 	return erofs_fscache_read_folios_async(mdev.m_fscache->cookie,
-- 
2.31.1


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

* Re: [PATCH] erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio
  2022-08-15  3:48 [PATCH] erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio Sun Ke
@ 2022-08-15  4:03 ` Gao Xiang
  2022-08-15 12:14 ` JeffleXu
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 8+ messages in thread
From: Gao Xiang @ 2022-08-15  4:03 UTC (permalink / raw)
  To: Sun Ke; +Cc: xiang, chao, linux-erofs, linux-kernel, kernel-janitors, yinxin.x

On Mon, Aug 15, 2022 at 11:48:29AM +0800, Sun Ke wrote:
> If erofs_fscache_alloc_request fail and then goto out, it will return 0.
> it should return a negative error code instead of 0.
> 
> Fixes: d435d53228dd ("erofs: change to use asynchronous io for fscache readpage/readahead")
> Signed-off-by: Sun Ke <sunke32@huawei.com>

Thanks for the catch! Looks good to me,

Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>

Thanks,
Gao Xiang

> ---
>  fs/erofs/fscache.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c
> index 8e01d89c3319..b5fd9d71e67f 100644
> --- a/fs/erofs/fscache.c
> +++ b/fs/erofs/fscache.c
> @@ -222,8 +222,10 @@ static int erofs_fscache_meta_read_folio(struct file *data, struct folio *folio)
>  
>  	rreq = erofs_fscache_alloc_request(folio_mapping(folio),
>  				folio_pos(folio), folio_size(folio));
> -	if (IS_ERR(rreq))
> +	if (IS_ERR(rreq)) {
> +		ret = PTR_ERR(rreq);
>  		goto out;
> +	}
>  
>  	return erofs_fscache_read_folios_async(mdev.m_fscache->cookie,
>  				rreq, mdev.m_pa);
> @@ -301,8 +303,10 @@ static int erofs_fscache_read_folio(struct file *file, struct folio *folio)
>  
>  	rreq = erofs_fscache_alloc_request(folio_mapping(folio),
>  				folio_pos(folio), folio_size(folio));
> -	if (IS_ERR(rreq))
> +	if (IS_ERR(rreq)) {
> +		ret = PTR_ERR(rreq);
>  		goto out_unlock;
> +	}
>  
>  	pstart = mdev.m_pa + (pos - map.m_la);
>  	return erofs_fscache_read_folios_async(mdev.m_fscache->cookie,
> -- 
> 2.31.1

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

* Re: [PATCH] erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio
  2022-08-15  3:48 [PATCH] erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio Sun Ke
  2022-08-15  4:03 ` Gao Xiang
@ 2022-08-15 12:14 ` JeffleXu
  2022-08-16  5:16 ` Gao Xiang
  2022-09-05 15:10 ` Chao Yu
  3 siblings, 0 replies; 8+ messages in thread
From: JeffleXu @ 2022-08-15 12:14 UTC (permalink / raw)
  To: Sun Ke, xiang, chao; +Cc: kernel-janitors, linux-erofs, linux-kernel, yinxin.x



On 8/15/22 11:48 AM, Sun Ke via Linux-erofs wrote:
> If erofs_fscache_alloc_request fail and then goto out, it will return 0.
> it should return a negative error code instead of 0.
> 
> Fixes: d435d53228dd ("erofs: change to use asynchronous io for fscache readpage/readahead")
> Signed-off-by: Sun Ke <sunke32@huawei.com>

LGTM.

Reviewed-by: Jingbo Xu <jefflexu@linux.alibaba.com>

> ---
>  fs/erofs/fscache.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c
> index 8e01d89c3319..b5fd9d71e67f 100644
> --- a/fs/erofs/fscache.c
> +++ b/fs/erofs/fscache.c
> @@ -222,8 +222,10 @@ static int erofs_fscache_meta_read_folio(struct file *data, struct folio *folio)
>  
>  	rreq = erofs_fscache_alloc_request(folio_mapping(folio),
>  				folio_pos(folio), folio_size(folio));
> -	if (IS_ERR(rreq))
> +	if (IS_ERR(rreq)) {
> +		ret = PTR_ERR(rreq);
>  		goto out;
> +	}
>  
>  	return erofs_fscache_read_folios_async(mdev.m_fscache->cookie,
>  				rreq, mdev.m_pa);
> @@ -301,8 +303,10 @@ static int erofs_fscache_read_folio(struct file *file, struct folio *folio)
>  
>  	rreq = erofs_fscache_alloc_request(folio_mapping(folio),
>  				folio_pos(folio), folio_size(folio));
> -	if (IS_ERR(rreq))
> +	if (IS_ERR(rreq)) {
> +		ret = PTR_ERR(rreq);
>  		goto out_unlock;
> +	}
>  
>  	pstart = mdev.m_pa + (pos - map.m_la);
>  	return erofs_fscache_read_folios_async(mdev.m_fscache->cookie,

-- 
Thanks,
Jingbo

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

* Re: [PATCH] erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio
  2022-08-15  3:48 [PATCH] erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio Sun Ke
  2022-08-15  4:03 ` Gao Xiang
  2022-08-15 12:14 ` JeffleXu
@ 2022-08-16  5:16 ` Gao Xiang
  2022-08-17  1:44   ` Sun Ke
  2022-09-05 15:10 ` Chao Yu
  3 siblings, 1 reply; 8+ messages in thread
From: Gao Xiang @ 2022-08-16  5:16 UTC (permalink / raw)
  To: Sun Ke; +Cc: xiang, chao, linux-erofs, linux-kernel, kernel-janitors, yinxin.x

On Mon, Aug 15, 2022 at 11:48:29AM +0800, Sun Ke wrote:
> If erofs_fscache_alloc_request fail and then goto out, it will return 0.
> it should return a negative error code instead of 0.
> 
> Fixes: d435d53228dd ("erofs: change to use asynchronous io for fscache readpage/readahead")
> Signed-off-by: Sun Ke <sunke32@huawei.com>

Minor, I tried to apply this patch by updating the patch title into
"erofs: fix error return code in erofs_fscache_{meta_,}read_folio"

since the original patch title is too long.

Thanks,
Gao Xiang

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

* Re: [PATCH] erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio
  2022-08-16  5:16 ` Gao Xiang
@ 2022-08-17  1:44   ` Sun Ke
  2022-08-17  2:41     ` Gao Xiang
  0 siblings, 1 reply; 8+ messages in thread
From: Sun Ke @ 2022-08-17  1:44 UTC (permalink / raw)
  To: Gao Xiang
  Cc: xiang, chao, linux-erofs, linux-kernel, kernel-janitors, yinxin.x



在 2022/8/16 13:16, Gao Xiang 写道:
> On Mon, Aug 15, 2022 at 11:48:29AM +0800, Sun Ke wrote:
>> If erofs_fscache_alloc_request fail and then goto out, it will return 0.
>> it should return a negative error code instead of 0.
>>
>> Fixes: d435d53228dd ("erofs: change to use asynchronous io for fscache readpage/readahead")
>> Signed-off-by: Sun Ke <sunke32@huawei.com>
> 
> Minor, I tried to apply this patch by updating the patch title into
> "erofs: fix error return code in erofs_fscache_{meta_,}read_folio"
> 
> since the original patch title is too long.

Should I send a v2 patch to update the title?

Thanks,
Sun Ke
> 
> Thanks,
> Gao Xiang
> .
> 

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

* Re: [PATCH] erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio
  2022-08-17  1:44   ` Sun Ke
@ 2022-08-17  2:41     ` Gao Xiang
  2022-08-17  2:48       ` Sun Ke
  0 siblings, 1 reply; 8+ messages in thread
From: Gao Xiang @ 2022-08-17  2:41 UTC (permalink / raw)
  To: Sun Ke; +Cc: xiang, chao, linux-erofs, linux-kernel, kernel-janitors, yinxin.x

Hi Ke,

On Wed, Aug 17, 2022 at 09:44:46AM +0800, Sun Ke wrote:
> 
> 
> 在 2022/8/16 13:16, Gao Xiang 写道:
> > On Mon, Aug 15, 2022 at 11:48:29AM +0800, Sun Ke wrote:
> > > If erofs_fscache_alloc_request fail and then goto out, it will return 0.
> > > it should return a negative error code instead of 0.
> > > 
> > > Fixes: d435d53228dd ("erofs: change to use asynchronous io for fscache readpage/readahead")
> > > Signed-off-by: Sun Ke <sunke32@huawei.com>
> > 
> > Minor, I tried to apply this patch by updating the patch title into
> > "erofs: fix error return code in erofs_fscache_{meta_,}read_folio"
> > 
> > since the original patch title is too long.
> 
> Should I send a v2 patch to update the title?

I've already updated this by hand if you have no concern ;)
will push out to -next today...

Thanks,
Gao Xiang

> 
> Thanks,
> Sun Ke
> > 
> > Thanks,
> > Gao Xiang
> > .
> > 

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

* Re: [PATCH] erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio
  2022-08-17  2:41     ` Gao Xiang
@ 2022-08-17  2:48       ` Sun Ke
  0 siblings, 0 replies; 8+ messages in thread
From: Sun Ke @ 2022-08-17  2:48 UTC (permalink / raw)
  To: Gao Xiang
  Cc: xiang, chao, linux-erofs, linux-kernel, kernel-janitors, yinxin.x



在 2022/8/17 10:41, Gao Xiang 写道:
> Hi Ke,
> 
> On Wed, Aug 17, 2022 at 09:44:46AM +0800, Sun Ke wrote:
>>
>>
>> 在 2022/8/16 13:16, Gao Xiang 写道:
>>> On Mon, Aug 15, 2022 at 11:48:29AM +0800, Sun Ke wrote:
>>>> If erofs_fscache_alloc_request fail and then goto out, it will return 0.
>>>> it should return a negative error code instead of 0.
>>>>
>>>> Fixes: d435d53228dd ("erofs: change to use asynchronous io for fscache readpage/readahead")
>>>> Signed-off-by: Sun Ke <sunke32@huawei.com>
>>>
>>> Minor, I tried to apply this patch by updating the patch title into
>>> "erofs: fix error return code in erofs_fscache_{meta_,}read_folio"
>>>
>>> since the original patch title is too long.
>>
>> Should I send a v2 patch to update the title?
> 
> I've already updated this by hand if you have no concern ;)
> will push out to -next today...
;)

Thanks,
Sun Ke
> 
> Thanks,
> Gao Xiang
> 
>>
>> Thanks,
>> Sun Ke
>>>
>>> Thanks,
>>> Gao Xiang
>>> .
>>>
> .
> 

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

* Re: [PATCH] erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio
  2022-08-15  3:48 [PATCH] erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio Sun Ke
                   ` (2 preceding siblings ...)
  2022-08-16  5:16 ` Gao Xiang
@ 2022-09-05 15:10 ` Chao Yu
  3 siblings, 0 replies; 8+ messages in thread
From: Chao Yu @ 2022-09-05 15:10 UTC (permalink / raw)
  To: Sun Ke, xiang; +Cc: linux-erofs, linux-kernel, kernel-janitors, yinxin.x

On 2022/8/15 11:48, Sun Ke wrote:
> If erofs_fscache_alloc_request fail and then goto out, it will return 0.
> it should return a negative error code instead of 0.
> 
> Fixes: d435d53228dd ("erofs: change to use asynchronous io for fscache readpage/readahead")
> Signed-off-by: Sun Ke <sunke32@huawei.com>

Reviewed-by: Chao Yu <chao@kernel.org>

Thanks,

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

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

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-08-15  3:48 [PATCH] erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio Sun Ke
2022-08-15  4:03 ` Gao Xiang
2022-08-15 12:14 ` JeffleXu
2022-08-16  5:16 ` Gao Xiang
2022-08-17  1:44   ` Sun Ke
2022-08-17  2:41     ` Gao Xiang
2022-08-17  2:48       ` Sun Ke
2022-09-05 15:10 ` Chao Yu

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).