]> git.itanic.dy.fi Git - linux-stable/commitdiff
erofs: fix error return code in erofs_fscache_{meta_,}read_folio
authorSun Ke <sunke32@huawei.com>
Mon, 15 Aug 2022 03:48:29 +0000 (11:48 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 15 Sep 2022 08:47:16 +0000 (10:47 +0200)
[ Upstream commit 5bd9628b784cc5e38e1c7ebb680bbd6ee741230e ]

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: Jingbo Xu <jefflexu@linux.alibaba.com>
Reviewed-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Reviewed-by: Chao Yu <chao@kernel.org>
Link: https://lore.kernel.org/r/20220815034829.3940803-1-sunke32@huawei.com
Signed-off-by: Gao Xiang <hsiangkao@linux.alibaba.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
fs/erofs/fscache.c

index 8e01d89c3319e993293ba8099f5556dd7bfe6edc..b5fd9d71e67f1a215ec8e9690d802f4388df09ba 100644 (file)
@@ -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,