From patchwork Fri Nov 4 05:40:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jingbo Xu X-Patchwork-Id: 15335 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp188337wru; Thu, 3 Nov 2022 22:44:00 -0700 (PDT) X-Google-Smtp-Source: AMsMyM4rwHM2QbncyNX6hLKhsmQvP7BLS+k4Bzz2+FnSwC8lrDTTuqimDfkLPyBBcyIEskDjNJ67 X-Received: by 2002:a17:906:9bc2:b0:7ad:975f:b567 with SMTP id de2-20020a1709069bc200b007ad975fb567mr33454230ejc.107.1667540640120; Thu, 03 Nov 2022 22:44:00 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1667540640; cv=none; d=google.com; s=arc-20160816; b=JqwB0++Q4xbaCzHQ5BtRNNn49dN5lZ+USSPB+Adilcm+AXP+dL+w69zkkUNB9bzzwr exzqKxz4ugXnp01TETu9v6RJV/8WOSLXM6+xw04whOWBKAYK7x6PSbhHV1xDehdI+QIn 5RmOsjZ+ySHSIuTCHD7pmUjv+oUYvTQ7wpoE+wMEpk2/i96EaUDV3CNW6YTzPotHjdjX hHulwlk9pVZ30TtusS4+aahGKN2Cu0Iijov46LQEKkUynFG7+lIgiNss94ML0YtJKNcf geQnD7fQWLb6hQ2/DFF23OK9rFTkOZ2siMuvxH/ch3hiRi/+A7YpOhpz8UZcnzpndEIy MNoA== 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 Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id hg5-20020a1709072cc500b0078da30cb4bfsi4435864ejc.428.2022.11.03.22.43.35; Thu, 03 Nov 2022 22:44:00 -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 + 99 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 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 X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1748543094093459256?= X-GMAIL-MSGID: =?utf-8?q?1748543094093459256?= 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 Reviewed-by: Gao Xiang Reviewed-by: Jia Zhu Reviewed-by: Chao Yu --- 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;