Received: by 2002:a05:6358:16cd:b0:dc:6189:e246 with SMTP id r13csp264748rwl; Thu, 3 Nov 2022 23:21:29 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7KUnev0Rc8huUxG7OPg/aWrhiPg7MsbWKnRB9N8g/ihahfdJk9tFyZqsTDSo97q2+DeolH X-Received: by 2002:a17:90b:1918:b0:213:d97c:c6c9 with SMTP id mp24-20020a17090b191800b00213d97cc6c9mr26960732pjb.198.1667542889161; Thu, 03 Nov 2022 23:21:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667542889; cv=none; d=google.com; s=arc-20160816; b=gxlwOUb6ev+s3V3vjd/FYRDFb14Xz4SEEU2aAM+8L03BoNk3LEBhyR0hQJN7RqYi0d LgvsJgEZ55LzZ/LZDCJBvbq1RU+juhcHvE5CmspqbL8R4OZ9Bb6/AY1K5xCzDMuK04dx 7HOuupb/dz3s3I2PbYU8xrj18cbElrkWsuOrB4ebmjUb2xAA1X6mOXRRg0T5JsMHH4oA C6zUDLHY07WgKknAHcOk+Dfklpdb/uPPtjnmzZCQie8of67RUPRIMnhK1R4A2gg9zA2H CbqBISrMNJY9+va3V6aNN9UMrlDoOAuhHg6aKVwMQgG7uHLQbb8wi/2BKZ/FiJp9zIbI Vo1A== 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 :references:in-reply-to:message-id:date:subject:cc:to:from; bh=k9HY3GJS/DeUVFkQcniYMofo7svGH3qCslnxPlrwSyA=; b=FJQnqO3bJVdz0NPWg3w/xSWv6ZuGYqiYqr5VF+Ejus+MIz19bj2QscF16lP9zdL5tw T2B/GVR/6GrdE6LxZIEhNpQW0W3VCUcWWldotFXvAMf89JW//FgLxPpbVGwSYbljlA/8 DTxPGlejVgkqxWoQ67nQKWiUEz9O/oy3NZykdMXe5YC9F+PbV36vQYKBPTd0m5QxvgZb fOPcReko5iAqHbGJJ1n5782eGxkf93JXr0wzel0FVe9TGqP60p1OhrXdBlLhhwC05RKX 45EubHPJp327adNNQV1SjJrcki03Ns72ovsTFTctDwDGLUjA0WF0n8Fu1MSMbFPiTdOB JLmQ== 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 202-20020a6304d3000000b004630aa449c2si4125824pge.242.2022.11.03.23.21.18; Thu, 03 Nov 2022 23:21:29 -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 S230185AbiKDFkn (ORCPT + 95 others); Fri, 4 Nov 2022 01:40:43 -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: 8bit X-Spam-Status: No, score=-9.9 required=5.0 tests=BAYES_00, ENV_AND_HDR_SPF_MATCH,SPF_HELO_NONE,SPF_PASS,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 For tail packing layout, put metabuf when error is encountered. Fixes: 1ae9470c3e14 ("erofs: clean up .read_folio() and .readahead() in fscache mode") Signed-off-by: Jingbo Xu --- 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_space *mapping, return PTR_ERR(src); iov_iter_xarray(&iter, READ, &mapping->i_pages, pos, PAGE_SIZE); - if (copy_to_iter(src + offset, size, &iter) != size) + if (copy_to_iter(src + offset, size, &iter) != size) { + erofs_put_metabuf(&buf); return -EFAULT; + } iov_iter_zero(PAGE_SIZE - size, &iter); erofs_put_metabuf(&buf); return PAGE_SIZE; -- 2.19.1.6.gb485710b