Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2102399rwb; Sun, 14 Aug 2022 21:30:54 -0700 (PDT) X-Google-Smtp-Source: AA6agR4e7hxqKtYRRF+wB7SFO3teNl6BbHnbQBJw1ftz0zb+2TnMz7ML9x83Jdx5Cv29lw3FpfK5 X-Received: by 2002:a05:6402:27d2:b0:43e:3ff6:ad58 with SMTP id c18-20020a05640227d200b0043e3ff6ad58mr13061329ede.234.1660537854313; Sun, 14 Aug 2022 21:30:54 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660537854; cv=none; d=google.com; s=arc-20160816; b=RG73kQxKV77cvjqWWACJ5z9As05GOqkklhCM/p/hHqNgxhLfVp/bRpwGXdxpeUygNI jdx+Y8521BzNiHqyPOfdJ3DBC/qQv+lPrTrcWiuzE8wMAWiWbioR5Bd014IT1GQil3P+ lFxURZT71HcAAClZS0DNz/1Wdqqgw3jpokptFqVkr5DGLpJlCSI/Vl8R7GmuCLmKwQi2 UgEWwcjzxyN+SDabQc5u7y1uDicmVbpchn8wpNT7SW5HmkE6nb/JtShpwp/xbI1/eH+n pvaJi2SwDxyBqjvmRSUkYTMtMqwVs7I+cO5eOI9oQPEn8pfl2E2lCK/fARjEZjOP4fnr TAng== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=9wD1b0B/GmtvxA1CzA+9gpOpJxJCJ5UvrXBK+0hyp9w=; b=jN38Ti4CqpPsALTkSbWJk6JtJL4wvAgGU6tnouiMtCrHqDjTQ2Ka1a3h6jZ9bB/SSk 9zOLQQQPNJvWWeqUy0Dq3iM3TXl3i3vA3ljCvWpjUhqYVsCEWbXYNSAF/h4hBcnT20yo 8Jpz+QahFJRZO76fOzXVcTpJqzctkamjgSj9JljmctmWF2zuKAENye4gx7yS/1MLJjIs i+XflXbSer+bv+1N2IsNwaoLx5gQ41NkMQcV9XTOB3WDdpugpWOD997eC7JmFJ6NhwJV Obp7obBq0zgQ1vm+ClhF+2sjyRoRNGS8V39HgRbBDOV5MUvAZRjaR2MPvuK0n5Gd1vec dL2A== 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=NONE sp=NONE dis=NONE) header.from=alibaba.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wy6-20020a170906fe0600b0073150d71172si8190237ejb.1004.2022.08.14.21.30.28; Sun, 14 Aug 2022 21:30:54 -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=NONE sp=NONE dis=NONE) header.from=alibaba.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229929AbiHOEDr (ORCPT + 99 others); Mon, 15 Aug 2022 00:03:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33244 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229505AbiHOEDq (ORCPT ); Mon, 15 Aug 2022 00:03:46 -0400 Received: from out30-57.freemail.mail.aliyun.com (out30-57.freemail.mail.aliyun.com [115.124.30.57]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EB0361115D; Sun, 14 Aug 2022 21:03:41 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R971e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018045170;MF=hsiangkao@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VMClCGr_1660536217; Received: from B-P7TQMD6M-0146.local(mailfrom:hsiangkao@linux.alibaba.com fp:SMTPD_---0VMClCGr_1660536217) by smtp.aliyun-inc.com; Mon, 15 Aug 2022 12:03:38 +0800 Date: Mon, 15 Aug 2022 12:03:36 +0800 From: Gao Xiang To: Sun Ke Cc: xiang@kernel.org, chao@kernel.org, linux-erofs@lists.ozlabs.org, linux-kernel@vger.kernel.org, kernel-janitors@vger.kernel.org, yinxin.x@bytedance.com Subject: Re: [PATCH] erofs: fix error return code in erofs_fscache_meta_read_folio and erofs_fscache_read_folio Message-ID: References: <20220815034829.3940803-1-sunke32@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20220815034829.3940803-1-sunke32@huawei.com> X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,UNPARSEABLE_RELAY,USER_IN_DEF_SPF_WL 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 On Mon, Aug 15, 2022 at 11:48:29AM +0800, Sun Ke wrote: > 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 Thanks for the catch! Looks good to me, Reviewed-by: Gao Xiang Thanks, Gao Xiang > --- > 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