Skip to content

Commit 5bd9628

Browse files
sunke-lphsiangkao
authored andcommitted
erofs: fix error return code in erofs_fscache_{meta_,}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: 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]>
1 parent 568035b commit 5bd9628

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

fs/erofs/fscache.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,8 +222,10 @@ static int erofs_fscache_meta_read_folio(struct file *data, struct folio *folio)
222222

223223
rreq = erofs_fscache_alloc_request(folio_mapping(folio),
224224
folio_pos(folio), folio_size(folio));
225-
if (IS_ERR(rreq))
225+
if (IS_ERR(rreq)) {
226+
ret = PTR_ERR(rreq);
226227
goto out;
228+
}
227229

228230
return erofs_fscache_read_folios_async(mdev.m_fscache->cookie,
229231
rreq, mdev.m_pa);
@@ -301,8 +303,10 @@ static int erofs_fscache_read_folio(struct file *file, struct folio *folio)
301303

302304
rreq = erofs_fscache_alloc_request(folio_mapping(folio),
303305
folio_pos(folio), folio_size(folio));
304-
if (IS_ERR(rreq))
306+
if (IS_ERR(rreq)) {
307+
ret = PTR_ERR(rreq);
305308
goto out_unlock;
309+
}
306310

307311
pstart = mdev.m_pa + (pos - map.m_la);
308312
return erofs_fscache_read_folios_async(mdev.m_fscache->cookie,

0 commit comments

Comments
 (0)