Commit 5bd9628b authored by Sun Ke's avatar Sun Ke Committed by Gao Xiang
Browse files

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: d435d532 ("erofs: change to use asynchronous io for fscache readpage/readahead")
Signed-off-by: default avatarSun Ke <sunke32@huawei.com>
Reviewed-by: default avatarJingbo Xu <jefflexu@linux.alibaba.com>
Reviewed-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: default avatarChao Yu <chao@kernel.org>
Link: https://lore.kernel.org/r/20220815034829.3940803-1-sunke32@huawei.com


Signed-off-by: default avatarGao Xiang <hsiangkao@linux.alibaba.com>
parent 568035b0
Loading
Loading
Loading
Loading
+6 −2
Original line number Diff line number Diff line
@@ -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,