Skip to content

Commit

Permalink
erofs: fix error return code in erofs_fscache_{meta_,}read_folio
Browse files Browse the repository at this point in the history
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: d435d53 ("erofs: change to use asynchronous io for fscache readpage/readahead")
Signed-off-by: Sun Ke <[email protected]>
Reviewed-by: Jingbo Xu <[email protected]>
Reviewed-by: Gao Xiang <[email protected]>
Reviewed-by: Chao Yu <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Gao Xiang <[email protected]>
  • Loading branch information
sunke-lp authored and hsiangkao committed Sep 5, 2022
1 parent 568035b commit 5bd9628
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions fs/erofs/fscache.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 5bd9628

Please sign in to comment.