Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2080640rwb; Sun, 14 Aug 2022 20:56:14 -0700 (PDT) X-Google-Smtp-Source: AA6agR5FMOAtzcCwYwGngdyiLMXfpDu+8IgBnDuxakNDLDwG3heaOXAhUpjvkcJhZ8NPCzet8sOb X-Received: by 2002:a17:906:9b09:b0:730:9480:9729 with SMTP id eo9-20020a1709069b0900b0073094809729mr9423288ejc.588.1660535774496; Sun, 14 Aug 2022 20:56:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660535774; cv=none; d=google.com; s=arc-20160816; b=OKf5wyAgwkVCVa/6t0Nz/9fjxfYc7WmAdpGOXIdev3CoZ3a8Ck0rTUXQ4EpaIJfUHP keKLMOf5EKqKT3b258dWJz59hcWhAvky6XQVaspyN1bs10rF0cGbg42uvd6XSSups+fL EGpMey4Pg/92ki67DEZZ1TZvBFQQFNKk7LA6Q9iXbJQdQSvQ+14tn7bsOMZzQc8VKdX1 IrdU1mVC4o3GVgzNOtCcdMFSZEXOGDmD5G5MnkrdWnJV03kL3itFeYH9NoC5t7bVgM02 ePi06B0koPuirWEGxKCOl+ExtZIuan6ufkkObCdGTEmjuqdfNwW8P12zx9SrVWxu6edJ nBOw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=fwX1TCIyTWz0xP+8ZOwpknPc5c76aXBpni2Nn8yl60A=; b=AyPa77qEfSsmmtmZpUYo2vbsVoFBaerk/AGV/cmXF4UcHDjnk0fP+t0lt5JMYs+7wD q+px+InAMwYjg47Fg02xRa+qUD68y/MvoRkhHhXs3G3qZrg8mHIbAyvyLgUZ6lyAiKXR jafLfPZ8kK1gzKhrjLlIz1dMDdLhPbidaDNeMCL20EwQCztogRRpBQZsJRB8as/Ccqzg zR1Md0puRPYqEn8dJUT8fqXE9kTcIotOXUXIUqsJJIdbM/K5TcWj77z3WspfOYtnfL6D TH7syg+S7/Dgh9wf7dzikC609BJjrp5ArTQmEPfVxb4Ytx4sVAEpLw2xLUA+vZ/QhwSQ EwQw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e24-20020aa7d7d8000000b0043a72e21988si6267133eds.590.2022.08.14.20.55.47; Sun, 14 Aug 2022 20:56:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230310AbiHODg4 (ORCPT + 99 others); Sun, 14 Aug 2022 23:36:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43750 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229546AbiHODgz (ORCPT ); Sun, 14 Aug 2022 23:36:55 -0400 Received: from szxga08-in.huawei.com (szxga08-in.huawei.com [45.249.212.255]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 01CF71180E; Sun, 14 Aug 2022 20:36:54 -0700 (PDT) Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.54]) by szxga08-in.huawei.com (SkyGuard) with ESMTP id 4M5fy643rpz1M88V; Mon, 15 Aug 2022 11:33:34 +0800 (CST) Received: from kwepemm600010.china.huawei.com (7.193.23.86) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 15 Aug 2022 11:36:52 +0800 Received: from huawei.com (10.175.127.227) by kwepemm600010.china.huawei.com (7.193.23.86) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Mon, 15 Aug 2022 11:36:51 +0800 From: Sun Ke To: , CC: , , , , Subject: [PATCH] erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio Date: Mon, 15 Aug 2022 11:48:29 +0800 Message-ID: <20220815034829.3940803-1-sunke32@huawei.com> X-Mailer: git-send-email 2.31.1 MIME-Version: 1.0 Content-Transfer-Encoding: 7BIT Content-Type: text/plain; charset=US-ASCII X-Originating-IP: [10.175.127.227] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To kwepemm600010.china.huawei.com (7.193.23.86) X-CFilter-Loop: Reflected X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- fs/erofs/fscache.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c index 8e01d89c3319..b5fd9d71e67f 100644 --- a/fs/erofs/fscache.c +++ b/fs/erofs/fscache.c @@ -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, -- 2.31.1