From nobody Thu Apr 9 10:28:57 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 132B6C433FE for ; Fri, 4 Nov 2022 05:40:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231201AbiKDFko (ORCPT ); Fri, 4 Nov 2022 01:40:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51752 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230377AbiKDFkg (ORCPT ); Fri, 4 Nov 2022 01:40:36 -0400 Received: from out199-9.us.a.mail.aliyun.com (out199-9.us.a.mail.aliyun.com [47.90.199.9]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C0CD275DD for ; Thu, 3 Nov 2022 22:40:35 -0700 (PDT) X-Alimail-AntiSpam: AC=PASS;BC=-1|-1;BR=01201311R131e4;CH=green;DM=||false|;DS=||;FP=0|-1|-1|-1|0|-1|-1|-1;HT=ay29a033018046059;MF=jefflexu@linux.alibaba.com;NM=1;PH=DS;RN=7;SR=0;TI=SMTPD_---0VTve-EV_1667540429; Received: from localhost(mailfrom:jefflexu@linux.alibaba.com fp:SMTPD_---0VTve-EV_1667540429) by smtp.aliyun-inc.com; Fri, 04 Nov 2022 13:40:30 +0800 From: Jingbo Xu To: xiang@kernel.org, chao@kernel.org, huyue2@coolpad.com, linux-erofs@lists.ozlabs.org Cc: zhujia.zj@bytedance.com, yinxin.x@bytedance.com, linux-kernel@vger.kernel.org Subject: [PATCH 1/2] erofs: put metabuf in error path in fscache mode Date: Fri, 4 Nov 2022 13:40:27 +0800 Message-Id: <20221104054028.52208-2-jefflexu@linux.alibaba.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20221104054028.52208-1-jefflexu@linux.alibaba.com> References: <20221104054028.52208-1-jefflexu@linux.alibaba.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" For tail packing layout, put metabuf when error is encountered. Fixes: 1ae9470c3e14 ("erofs: clean up .read_folio() and .readahead() in fsc= ache mode") Signed-off-by: Jingbo Xu Reviewed-by: Chao Yu Reviewed-by: Gao Xiang Reviewed-by: Jia Zhu --- fs/erofs/fscache.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/fs/erofs/fscache.c b/fs/erofs/fscache.c index fe05bc51f9f2..83559008bfa8 100644 --- a/fs/erofs/fscache.c +++ b/fs/erofs/fscache.c @@ -287,8 +287,10 @@ static int erofs_fscache_data_read(struct address_spac= e *mapping, return PTR_ERR(src); =20 iov_iter_xarray(&iter, READ, &mapping->i_pages, pos, PAGE_SIZE); - if (copy_to_iter(src + offset, size, &iter) !=3D size) + if (copy_to_iter(src + offset, size, &iter) !=3D size) { + erofs_put_metabuf(&buf); return -EFAULT; + } iov_iter_zero(PAGE_SIZE - size, &iter); erofs_put_metabuf(&buf); return PAGE_SIZE; --=20 2.19.1.6.gb485710b