From: Jingbo Xu <jefflexu@linux.alibaba.com>
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 [thread overview]
Message-ID: <20221104054028.52208-2-jefflexu@linux.alibaba.com> (raw)
In-Reply-To: <20221104054028.52208-1-jefflexu@linux.alibaba.com>
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 <jefflexu@linux.alibaba.com>
---
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
next prev parent reply other threads:[~2022-11-04 5:40 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-11-04 5:40 [PATCH 0/2] erofs: misc fixes for erofs in fscache mode Jingbo Xu
2022-11-04 5:40 ` Jingbo Xu [this message]
2022-11-04 10:03 ` [PATCH 1/2] erofs: put metabuf in error path " Gao Xiang
2022-11-07 14:41 ` [External] " Jia Zhu
2022-11-08 3:07 ` Chao Yu
2022-11-04 5:40 ` [PATCH 2/2] erofs: get correct count for unmapped range " Jingbo Xu
2022-11-04 10:03 ` Gao Xiang
2022-11-08 3:09 ` Chao Yu
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20221104054028.52208-2-jefflexu@linux.alibaba.com \
--to=jefflexu@linux.alibaba.com \
--cc=chao@kernel.org \
--cc=huyue2@coolpad.com \
--cc=linux-erofs@lists.ozlabs.org \
--cc=linux-kernel@vger.kernel.org \
--cc=xiang@kernel.org \
--cc=yinxin.x@bytedance.com \
--cc=zhujia.zj@bytedance.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox