Skip to contentSkip to conversation

erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio

PATCH In review Sun Ke 4 participants 8 messages Aug 15, 2022 – Sep 5, 2022

Subsystems (2)
lore
Share & tools
lore

Sun Ke

author
#0 lore raw

PATCH 1/1 erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio

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")
---
 fs/erofs/fscache.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/erofs/fscache.c +6 -2
index 8e01d89c3319..b5fd9d71e67f 100644
@@ -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,
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#1 lore raw
Quoted 5 lines · Sun Ke

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

Thanks for the catch! Looks good to me,

Thanks,
Gao Xiang

Quoted 34 lines
---
 fs/erofs/fscache.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/erofs/fscache.c +6 -2
index 8e01d89c3319..b5fd9d71e67f 100644
@@ -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,
Signature · 1 line
2.31.1
Reviewed-by on v1 1/1
#2 lore raw
In reply to Sun Ke
Quoted 5 lines · Sun Ke via Linux-erofs

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

LGTM.

Quoted 32 lines
---
 fs/erofs/fscache.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)
fs/erofs/fscache.c +6 -2
index 8e01d89c3319..b5fd9d71e67f 100644
@@ -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,
Signature · 2 lines
Thanks,
Jingbo
#3 lore raw
In reply to Sun Ke
Quoted 5 lines · Sun Ke

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

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

author
#4 lore raw
Quoted 11 lines · Gao Xiang
Quoted 5 lines · Sun Ke

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

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

Quoted 5 lines

Thanks,
Gao Xiang
.

#5 lore raw

Hi Ke,

Quoted 10 lines · Sun Ke
Quoted 7 lines · Gao Xiang
Quoted 5 lines · Sun Ke

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")
Quoted 6 lines
Quoted 4 lines

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

Quoted 8 lines

Thanks,
Sun Ke

Quoted 5 lines

Thanks,
Gao Xiang
.

author
#6 lore raw
Quoted 16 lines · Gao Xiang

Hi Ke,

Quoted 13 lines · Sun Ke
Quoted 10 lines · Gao Xiang
Quoted 5 lines · Sun Ke

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

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

Quoted 6 lines
Quoted 3 lines
Quoted 1 line

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

Quoted 14 lines

Thanks,
Gao Xiang

Quoted 8 lines

Thanks,
Sun Ke

Quoted 5 lines

Thanks,
Gao Xiang
.

.